xref: /llvm-project/lldb/test/API/lang/c/step_over_no_deadlock/TestStepOverDoesntBlock.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1"""
2Test that step over will let other threads run when necessary
3"""
4
5import lldb
6from lldbsuite.test.decorators import *
7from lldbsuite.test.lldbtest import *
8from lldbsuite.test import lldbutil
9
10
11class StepOverDoesntDeadlockTestCase(TestBase):
12    def test_step_over(self):
13        """Test that when step over steps over a function it lets other threads run."""
14        self.build()
15        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
16            self,
17            "without running the first thread at least somewhat",
18            lldb.SBFileSpec("locking.cpp"),
19        )
20        # This is just testing that the step over actually completes.
21        # If the test fails this step never return, so failure is really
22        # signaled by the test timing out.
23
24        thread.StepOver()
25        state = process.GetState()
26        self.assertState(state, lldb.eStateStopped)
27