diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/thread')
89 files changed, 1907 insertions, 874 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/TestNumThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/TestNumThreads.py index 8184ddcfbf48..094c86705969 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/TestNumThreads.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/TestNumThreads.py @@ -5,12 +5,13 @@ Test number of threads. from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil + class NumberOfThreadsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -28,18 +29,23 @@ class NumberOfThreadsTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint with 1 location. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.line, num_expected_locations=1) # The breakpoint list should show 3 locations. - self.expect("breakpoint list -f", "Breakpoint location shown correctly", - substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.line]) + self.expect( + "breakpoint list -f", + "Breakpoint location shown correctly", + substrs=[ + "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % + self.line]) # Run the program. self.runCmd("run", RUN_SUCCEEDED) # Stopped once. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ["stop reason = breakpoint 1."]) + substrs=["stop reason = breakpoint 1."]) # Get the target process target = self.dbg.GetSelectedTarget() @@ -50,4 +56,6 @@ class NumberOfThreadsTestCase(TestBase): # Using std::thread may involve extra threads, so we assert that there are # at least 4 rather than exactly 4. - self.assertTrue(num_threads >= 4, 'Number of expected threads and actual threads do not match.') + self.assertTrue( + num_threads >= 4, + 'Number of expected threads and actual threads do not match.') diff --git a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py b/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py index 902adacb2abd..ba5094f6de3e 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py @@ -2,13 +2,15 @@ Test regression for Bug 25251. """ -import os, time +import os +import time import unittest2 import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class BreakpointAfterJoinTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -17,11 +19,13 @@ class BreakpointAfterJoinTestCase(TestBase): # Call super's setUp(). TestBase.setUp(self) # Find the line number for our breakpoint. - self.breakpoint = line_number('ParallelTask.cpp', '// Set breakpoint here') - - @skipIfTargetAndroid(archs=["arm"]) # The android-arm compiler can't compile the inferior - # because of an issue around std::future. - # TODO: Change the test to don't depend on std::future<T> + self.breakpoint = line_number( + 'ParallelTask.cpp', '// Set breakpoint here') + + # The android-arm compiler can't compile the inferior + @skipIfTargetAndroid(archs=["arm"]) + # because of an issue around std::future. + # TODO: Change the test to don't depend on std::future<T> def test(self): """Test breakpoint handling after a thread join.""" self.build(dictionary=self.getBuildFlags()) @@ -30,23 +34,28 @@ class BreakpointAfterJoinTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint - lldbutil.run_break_set_by_file_and_line (self, "ParallelTask.cpp", self.breakpoint, num_expected_locations=-1) + lldbutil.run_break_set_by_file_and_line( + self, "ParallelTask.cpp", self.breakpoint, num_expected_locations=-1) # The breakpoint list should show 1 location. - self.expect("breakpoint list -f", "Breakpoint location shown correctly", - substrs = ["1: file = 'ParallelTask.cpp', line = %d, exact_match = 0" % self.breakpoint]) + self.expect( + "breakpoint list -f", + "Breakpoint location shown correctly", + substrs=[ + "1: file = 'ParallelTask.cpp', line = %d, exact_match = 0" % + self.breakpoint]) # Run the program. self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - 'stop reason = breakpoint']) + substrs=['stopped', + 'stop reason = breakpoint']) # This should not result in a segmentation fault self.expect("thread backtrace all", STOPPED_DUE_TO_BREAKPOINT, - substrs = ["stop reason = breakpoint 1."]) + substrs=["stop reason = breakpoint 1."]) # Run to completion self.runCmd("continue") diff --git a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py b/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py index 8ef0fb0a000d..d1d70c58c4c7 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py @@ -5,13 +5,14 @@ Test number of threads. from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class BreakpointAfterJoinTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -22,9 +23,15 @@ class BreakpointAfterJoinTestCase(TestBase): # Find the line number for our breakpoint. self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained") + @expectedFailureAll( + oslist=["linux"], + bugnumber="llvm.org/pr15824 thread states not properly maintained") + @expectedFailureAll( + oslist=lldbplatformutil.getDarwinOSTriples(), + bugnumber="llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>") + @expectedFailureAll( + oslist=["freebsd"], + bugnumber="llvm.org/pr18190 thread states not properly maintained") def test(self): """Test breakpoint handling after a thread join.""" self.build(dictionary=self.getBuildFlags()) @@ -33,19 +40,24 @@ class BreakpointAfterJoinTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.breakpoint, num_expected_locations=1) # The breakpoint list should show 1 location. - self.expect("breakpoint list -f", "Breakpoint location shown correctly", - substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.breakpoint]) + self.expect( + "breakpoint list -f", + "Breakpoint location shown correctly", + substrs=[ + "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % + self.breakpoint]) # Run the program. self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - 'stop reason = breakpoint']) + substrs=['stopped', + 'stop reason = breakpoint']) # Get the target process target = self.dbg.GetSelectedTarget() @@ -59,12 +71,15 @@ class BreakpointAfterJoinTestCase(TestBase): num_threads = process.GetNumThreads() # Make sure we see at least six threads - self.assertTrue(num_threads >= 6, 'Number of expected threads and actual threads do not match.') + self.assertTrue( + num_threads >= 6, + 'Number of expected threads and actual threads do not match.') # Make sure all threads are stopped for i in range(0, num_threads): - self.assertTrue(process.GetThreadAtIndex(i).IsStopped(), - "Thread {0} didn't stop during breakpoint.".format(i)) + self.assertTrue( + process.GetThreadAtIndex(i).IsStopped(), + "Thread {0} didn't stop during breakpoint.".format(i)) # Run to completion self.runCmd("continue") @@ -75,4 +90,6 @@ class BreakpointAfterJoinTestCase(TestBase): self.runCmd("process status") # At this point, the inferior process should have exited. - self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) + self.assertTrue( + process.GetState() == lldb.eStateExited, + PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py deleted file mode 100644 index 30adcccd203f..000000000000 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py +++ /dev/null @@ -1,525 +0,0 @@ -""" -A stress-test of sorts for LLDB's handling of threads in the inferior. - -This test sets a breakpoint in the main thread where test parameters (numbers of -threads) can be adjusted, runs the inferior to that point, and modifies the -locals that control the event thread counts. This test also sets a breakpoint in -breakpoint_func (the function executed by each 'breakpoint' thread) and a -watchpoint on a global modified in watchpoint_func. The inferior is continued -until exit or a crash takes place, and the number of events seen by LLDB is -verified to match the expected number of events. -""" - -from __future__ import print_function - - - -import unittest2 -import os, time -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -@skipIfWindows -class ConcurrentEventsTestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - # - ## Tests for multiple threads that generate a single event. - # - @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test") - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_many_breakpoints(self): - """Test 100 breakpoints from 100 threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=100) - - @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test") - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_many_watchpoints(self): - """Test 100 watchpoints from 100 threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=100) - - @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test") - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_many_signals(self): - """Test 100 signals from 100 threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_signal_threads=100) - - @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test") - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_many_crash(self): - """Test 100 threads that cause a segfault.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_crash_threads=100) - - - # - ## Tests for concurrent signal and breakpoint - # - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_signal_break(self): - """Test signal and a breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=1, num_signal_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_delay_signal_break(self): - """Test (1-second delay) signal and a breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=1, num_delay_signal_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_signal_delay_break(self): - """Test signal and a (1 second delay) breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_delay_breakpoint_threads=1, num_signal_threads=1) - - - # - ## Tests for concurrent watchpoint and breakpoint - # - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_watch_break(self): - """Test watchpoint and a breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=1, num_watchpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_delay_watch_break(self): - """Test (1-second delay) watchpoint and a breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=1, num_delay_watchpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_watch_break_delay(self): - """Test watchpoint and a (1 second delay) breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_delay_breakpoint_threads=1, num_watchpoint_threads=1) - - # - ## Tests for concurrent signal and watchpoint - # - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_signal_watch(self): - """Test a watchpoint and a signal in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_signal_threads=1, num_watchpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_delay_signal_watch(self): - """Test a watchpoint and a (1 second delay) signal in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_delay_signal_threads=1, num_watchpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_signal_delay_watch(self): - """Test a (1 second delay) watchpoint and a signal in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_signal_threads=1, num_delay_watchpoint_threads=1) - - - # - ## Tests for multiple breakpoint threads - # - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_two_breakpoint_threads(self): - """Test two threads that trigger a breakpoint. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=2) - - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_breakpoint_one_delay_breakpoint_threads(self): - """Test threads that trigger a breakpoint where one thread has a 1 second delay. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=1, - num_delay_breakpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_two_breakpoints_one_signal(self): - """Test two threads that trigger a breakpoint and one signal thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=2, num_signal_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_breakpoint_delay_breakpoint_one_signal(self): - """Test two threads that trigger a breakpoint (one with a 1 second delay) and one signal thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=1, - num_delay_breakpoint_threads=1, - num_signal_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_two_breakpoints_one_delay_signal(self): - """Test two threads that trigger a breakpoint and one (1 second delay) signal thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=2, num_delay_signal_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_two_breakpoints_one_watchpoint(self): - """Test two threads that trigger a breakpoint and one watchpoint thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=2, num_watchpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_breakpoints_delayed_breakpoint_one_watchpoint(self): - """Test a breakpoint, a delayed breakpoint, and one watchpoint thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_breakpoint_threads=1, - num_delay_breakpoint_threads=1, - num_watchpoint_threads=1) - - # - ## Tests for multiple watchpoint threads - # - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_two_watchpoint_threads(self): - """Test two threads that trigger a watchpoint. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=2) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_watchpoint_with_delay_watchpoint_threads(self): - """Test two threads that trigger a watchpoint where one thread has a 1 second delay. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=1, - num_delay_watchpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_two_watchpoints_one_breakpoint(self): - """Test two threads that trigger a watchpoint and one breakpoint thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=2, num_breakpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_two_watchpoints_one_delay_breakpoint(self): - """Test two threads that trigger a watchpoint and one (1 second delay) breakpoint thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=2, num_delay_breakpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_watchpoint_delay_watchpoint_one_breakpoint(self): - """Test two threads that trigger a watchpoint (one with a 1 second delay) and one breakpoint thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=1, - num_delay_watchpoint_threads=1, - num_breakpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_two_watchpoints_one_signal(self): - """Test two threads that trigger a watchpoint and one signal thread. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=2, num_signal_threads=1) - - # - ## Test for watchpoint, signal and breakpoint happening concurrently - # - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_signal_watch_break(self): - """Test a signal/watchpoint/breakpoint in multiple threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_signal_threads=1, - num_watchpoint_threads=1, - num_breakpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_signal_watch_break(self): - """Test one signal thread with 5 watchpoint and breakpoint threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_signal_threads=1, - num_watchpoint_threads=5, - num_breakpoint_threads=5) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_signal_watch_break(self): - """Test with 5 watchpoint and breakpoint threads.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_watchpoint_threads=5, - num_breakpoint_threads=5) - - - # - ## Test for crashing threads happening concurrently with other events - # - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_crash_with_break(self): - """ Test a thread that crashes while another thread hits a breakpoint.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_crash_threads=1, num_breakpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_crash_with_watchpoint(self): - """ Test a thread that crashes while another thread hits a watchpoint.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_crash_threads=1, num_watchpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_crash_with_signal(self): - """ Test a thread that crashes while another thread generates a signal.""" - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_crash_threads=1, num_signal_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_crash_with_watchpoint_breakpoint_signal(self): - """ Test a thread that crashes while other threads generate a signal and hit a watchpoint and breakpoint. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_crash_threads=1, - num_breakpoint_threads=1, - num_signal_threads=1, - num_watchpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @skipIfRemoteDueToDeadlock - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_delayed_crash_with_breakpoint_watchpoint(self): - """ Test a thread with a delayed crash while other threads hit a watchpoint and a breakpoint. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_delay_crash_threads=1, - num_breakpoint_threads=1, - num_watchpoint_threads=1) - - @skipIfFreeBSD # timing out on buildbot - @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB. - def test_delayed_crash_with_breakpoint_signal(self): - """ Test a thread with a delayed crash while other threads generate a signal and hit a breakpoint. """ - self.build(dictionary=self.getBuildFlags()) - self.do_thread_actions(num_delay_crash_threads=1, - num_breakpoint_threads=1, - num_signal_threads=1) - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number for our breakpoint. - self.filename = 'main.cpp' - self.thread_breakpoint_line = line_number(self.filename, '// Set breakpoint here') - self.setup_breakpoint_line = line_number(self.filename, '// Break here and adjust num') - self.finish_breakpoint_line = line_number(self.filename, '// Break here and verify one thread is active') - - def describe_threads(self): - ret = [] - for x in self.inferior_process: - id = x.GetIndexID() - reason = x.GetStopReason() - status = "stopped" if x.IsStopped() else "running" - reason_str = lldbutil.stop_reason_to_str(reason) - if reason == lldb.eStopReasonBreakpoint: - bpid = x.GetStopReasonDataAtIndex(0) - bp = self.inferior_target.FindBreakpointByID(bpid) - reason_str = "%s hit %d times" % (lldbutil.get_description(bp), bp.GetHitCount()) - elif reason == lldb.eStopReasonWatchpoint: - watchid = x.GetStopReasonDataAtIndex(0) - watch = self.inferior_target.FindWatchpointByID(watchid) - reason_str = "%s hit %d times" % (lldbutil.get_description(watch), watch.GetHitCount()) - elif reason == lldb.eStopReasonSignal: - signals = self.inferior_process.GetUnixSignals() - signal_name = signals.GetSignalAsCString(x.GetStopReasonDataAtIndex(0)) - reason_str = "signal %s" % signal_name - - location = "\t".join([lldbutil.get_description(x.GetFrameAtIndex(i)) for i in range(x.GetNumFrames())]) - ret.append("thread %d %s due to %s at\n\t%s" % (id, status, reason_str, location)) - return ret - - def add_breakpoint(self, line, descriptions): - """ Adds a breakpoint at self.filename:line and appends its description to descriptions, and - returns the LLDB SBBreakpoint object. - """ - - bpno = lldbutil.run_break_set_by_file_and_line(self, self.filename, line, num_expected_locations=-1) - bp = self.inferior_target.FindBreakpointByID(bpno) - descriptions.append(": file = 'main.cpp', line = %d" % self.finish_breakpoint_line) - return bp - - def inferior_done(self): - """ Returns true if the inferior is done executing all the event threads (and is stopped at self.finish_breakpoint, - or has terminated execution. - """ - return self.finish_breakpoint.GetHitCount() > 0 or \ - self.crash_count > 0 or \ - self.inferior_process.GetState() == lldb.eStateExited - - def count_signaled_threads(self): - count = 0 - for thread in self.inferior_process: - if thread.GetStopReason() == lldb.eStopReasonSignal and thread.GetStopReasonDataAtIndex(0) == self.inferior_process.GetUnixSignals().GetSignalNumberFromName('SIGUSR1'): - count += 1 - return count - - def do_thread_actions(self, - num_breakpoint_threads = 0, - num_signal_threads = 0, - num_watchpoint_threads = 0, - num_crash_threads = 0, - num_delay_breakpoint_threads = 0, - num_delay_signal_threads = 0, - num_delay_watchpoint_threads = 0, - num_delay_crash_threads = 0): - """ Sets a breakpoint in the main thread where test parameters (numbers of threads) can be adjusted, runs the inferior - to that point, and modifies the locals that control the event thread counts. Also sets a breakpoint in - breakpoint_func (the function executed by each 'breakpoint' thread) and a watchpoint on a global modified in - watchpoint_func. The inferior is continued until exit or a crash takes place, and the number of events seen by LLDB - is verified to match the expected number of events. - """ - exe = os.path.join(os.getcwd(), "a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Get the target - self.inferior_target = self.dbg.GetSelectedTarget() - - expected_bps = [] - - # Initialize all the breakpoints (main thread/aux thread) - self.setup_breakpoint = self.add_breakpoint(self.setup_breakpoint_line, expected_bps) - self.finish_breakpoint = self.add_breakpoint(self.finish_breakpoint_line, expected_bps) - - # Set the thread breakpoint - if num_breakpoint_threads + num_delay_breakpoint_threads > 0: - self.thread_breakpoint = self.add_breakpoint(self.thread_breakpoint_line, expected_bps) - - # Verify breakpoints - self.expect("breakpoint list -f", "Breakpoint locations shown correctly", substrs = expected_bps) - - # Run the program. - self.runCmd("run", RUN_SUCCEEDED) - - # Check we are at line self.setup_breakpoint - self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT, - substrs = ["stop reason = breakpoint 1."]) - - # Initialize the (single) watchpoint on the global variable (g_watchme) - if num_watchpoint_threads + num_delay_watchpoint_threads > 0: - self.runCmd("watchpoint set variable g_watchme") - for w in self.inferior_target.watchpoint_iter(): - self.thread_watchpoint = w - self.assertTrue("g_watchme" in str(self.thread_watchpoint), "Watchpoint location not shown correctly") - - # Get the process - self.inferior_process = self.inferior_target.GetProcess() - - # We should be stopped at the setup site where we can set the number of - # threads doing each action (break/crash/signal/watch) - self.assertEqual(self.inferior_process.GetNumThreads(), 1, 'Expected to stop before any additional threads are spawned.') - - self.runCmd("expr num_breakpoint_threads=%d" % num_breakpoint_threads) - self.runCmd("expr num_crash_threads=%d" % num_crash_threads) - self.runCmd("expr num_signal_threads=%d" % num_signal_threads) - self.runCmd("expr num_watchpoint_threads=%d" % num_watchpoint_threads) - - self.runCmd("expr num_delay_breakpoint_threads=%d" % num_delay_breakpoint_threads) - self.runCmd("expr num_delay_crash_threads=%d" % num_delay_crash_threads) - self.runCmd("expr num_delay_signal_threads=%d" % num_delay_signal_threads) - self.runCmd("expr num_delay_watchpoint_threads=%d" % num_delay_watchpoint_threads) - - # Continue the inferior so threads are spawned - self.runCmd("continue") - - # Make sure we see all the threads. The inferior program's threads all synchronize with a pseudo-barrier; that is, - # the inferior program ensures all threads are started and running before any thread triggers its 'event'. - num_threads = self.inferior_process.GetNumThreads() - expected_num_threads = num_breakpoint_threads + num_delay_breakpoint_threads \ - + num_signal_threads + num_delay_signal_threads \ - + num_watchpoint_threads + num_delay_watchpoint_threads \ - + num_crash_threads + num_delay_crash_threads + 1 - self.assertEqual(num_threads, expected_num_threads, - 'Expected to see %d threads, but seeing %d. Details:\n%s' % (expected_num_threads, - num_threads, - "\n\t".join(self.describe_threads()))) - - self.signal_count = self.count_signaled_threads() - self.crash_count = len(lldbutil.get_crashed_threads(self, self.inferior_process)) - - # Run to completion (or crash) - while not self.inferior_done(): - if self.TraceOn(): - self.runCmd("thread backtrace all") - self.runCmd("continue") - self.signal_count += self.count_signaled_threads() - self.crash_count += len(lldbutil.get_crashed_threads(self, self.inferior_process)) - - if num_crash_threads > 0 or num_delay_crash_threads > 0: - # Expecting a crash - self.assertTrue(self.crash_count > 0, - "Expecting at least one thread to crash. Details: %s" % "\t\n".join(self.describe_threads())) - - # Ensure the zombie process is reaped - self.runCmd("process kill") - - elif num_crash_threads == 0 and num_delay_crash_threads == 0: - # There should be a single active thread (the main one) which hit the breakpoint after joining - self.assertEqual(1, self.finish_breakpoint.GetHitCount(), "Expected main thread (finish) breakpoint to be hit once") - - num_threads = self.inferior_process.GetNumThreads() - self.assertEqual(1, num_threads, "Expecting 1 thread but seeing %d. Details:%s" % (num_threads, - "\n\t".join(self.describe_threads()))) - self.runCmd("continue") - - # The inferior process should have exited without crashing - self.assertEqual(0, self.crash_count, "Unexpected thread(s) in crashed state") - self.assertEqual(self.inferior_process.GetState(), lldb.eStateExited, PROCESS_EXITED) - - # Verify the number of actions took place matches expected numbers - expected_breakpoint_threads = num_delay_breakpoint_threads + num_breakpoint_threads - breakpoint_hit_count = self.thread_breakpoint.GetHitCount() if expected_breakpoint_threads > 0 else 0 - self.assertEqual(expected_breakpoint_threads, breakpoint_hit_count, - "Expected %d breakpoint hits, but got %d" % (expected_breakpoint_threads, breakpoint_hit_count)) - - expected_signal_threads = num_delay_signal_threads + num_signal_threads - self.assertEqual(expected_signal_threads, self.signal_count, - "Expected %d stops due to signal delivery, but got %d" % (expected_signal_threads, self.signal_count)) - - expected_watchpoint_threads = num_delay_watchpoint_threads + num_watchpoint_threads - watchpoint_hit_count = self.thread_watchpoint.GetHitCount() if expected_watchpoint_threads > 0 else 0 - self.assertEqual(expected_watchpoint_threads, watchpoint_hit_count, - "Expected %d watchpoint hits, got %d" % (expected_watchpoint_threads, watchpoint_hit_count)) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile index 469c0809aa24..4b5e0ee94222 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/Makefile +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile @@ -1,7 +1,9 @@ -LEVEL = ../../../make +LEVEL = ../../../../make CXX_SOURCES := main.cpp ENABLE_THREADS := YES +VPATH = .. + include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/TestConcurrentBreakpointDelayBreakpointOneSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/TestConcurrentBreakpointDelayBreakpointOneSignal.py new file mode 100644 index 000000000000..2506a8231883 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/TestConcurrentBreakpointDelayBreakpointOneSignal.py @@ -0,0 +1,23 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentBreakpointDelayBreakpointOneSignal(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test two threads that trigger a breakpoint (one with a 1 second delay) and one signal thread. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_breakpoint_threads=1, + num_delay_breakpoint_threads=1, + num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/TestConcurrentBreakpointOneDelayBreakpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/TestConcurrentBreakpointOneDelayBreakpointThreads.py new file mode 100644 index 000000000000..8712342e5811 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/TestConcurrentBreakpointOneDelayBreakpointThreads.py @@ -0,0 +1,22 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentBreakpointOneDelayBreakpointThreads(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test threads that trigger a breakpoint where one thread has a 1 second delay. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_breakpoint_threads=1, + num_delay_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py new file mode 100644 index 000000000000..c600d8ed21be --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py @@ -0,0 +1,25 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentBreakpointsDelayedBreakpointOneWatchpoint( + ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test a breakpoint, a delayed breakpoint, and one watchpoint thread. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_breakpoint_threads=1, + num_delay_breakpoint_threads=1, + num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/TestConcurrentCrashWithBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/TestConcurrentCrashWithBreak.py new file mode 100644 index 000000000000..33d1074211ee --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/TestConcurrentCrashWithBreak.py @@ -0,0 +1,21 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentCrashWithBreak(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """ Test a thread that crashes while another thread hits a breakpoint.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_crash_threads=1, num_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/TestConcurrentCrashWithSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/TestConcurrentCrashWithSignal.py new file mode 100644 index 000000000000..560c79ed8a8f --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/TestConcurrentCrashWithSignal.py @@ -0,0 +1,21 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentCrashWithSignal(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """ Test a thread that crashes while another thread generates a signal.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_crash_threads=1, num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py new file mode 100644 index 000000000000..169903816fa9 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py @@ -0,0 +1,22 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentCrashWithWatchpoint(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """ Test a thread that crashes while another thread hits a watchpoint.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_crash_threads=1, num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py new file mode 100644 index 000000000000..4a58e7cf6d71 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py @@ -0,0 +1,25 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentCrashWithWatchpointBreakpointSignal(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """ Test a thread that crashes while other threads generate a signal and hit a watchpoint and breakpoint. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_crash_threads=1, + num_breakpoint_threads=1, + num_signal_threads=1, + num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/TestConcurrentDelaySignalBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/TestConcurrentDelaySignalBreak.py new file mode 100644 index 000000000000..442134f4a0c7 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/TestConcurrentDelaySignalBreak.py @@ -0,0 +1,23 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentDelaySignalBreak(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test (1-second delay) signal and a breakpoint in multiple threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions( + num_breakpoint_threads=1, + num_delay_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py new file mode 100644 index 000000000000..d5d4641bc164 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentDelaySignalWatch(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test a watchpoint and a (1 second delay) signal in multiple threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions( + num_delay_signal_threads=1, + num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py new file mode 100644 index 000000000000..9cbb40cb6019 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentDelayWatchBreak(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test (1-second delay) watchpoint and a breakpoint in multiple threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions( + num_breakpoint_threads=1, + num_delay_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/TestConcurrentDelayedCrashWithBreakpointSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/TestConcurrentDelayedCrashWithBreakpointSignal.py new file mode 100644 index 000000000000..2b7e1b457268 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/TestConcurrentDelayedCrashWithBreakpointSignal.py @@ -0,0 +1,23 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentDelayedCrashWithBreakpointSignal(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """ Test a thread with a delayed crash while other threads generate a signal and hit a breakpoint. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_delay_crash_threads=1, + num_breakpoint_threads=1, + num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py new file mode 100644 index 000000000000..ccbeeb07d3a8 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentDelayedCrashWithBreakpointWatchpoint(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """ Test a thread with a delayed crash while other threads hit a watchpoint and a breakpoint. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_delay_crash_threads=1, + num_breakpoint_threads=1, + num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/TestConcurrentManyBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/TestConcurrentManyBreakpoints.py new file mode 100644 index 000000000000..a9f3fbb799f1 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/TestConcurrentManyBreakpoints.py @@ -0,0 +1,23 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentManyBreakpoints(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @unittest2.skipIf( + TestBase.skipLongRunningTest(), + "Skip this long running test") + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test 100 breakpoints from 100 threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_breakpoint_threads=100) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/TestConcurrentManyCrash.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/TestConcurrentManyCrash.py new file mode 100644 index 000000000000..88ab1d5e204c --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/TestConcurrentManyCrash.py @@ -0,0 +1,23 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentManyCrash(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @unittest2.skipIf( + TestBase.skipLongRunningTest(), + "Skip this long running test") + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test 100 threads that cause a segfault.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_crash_threads=100) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/TestConcurrentManySignals.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/TestConcurrentManySignals.py new file mode 100644 index 000000000000..232b694c80f4 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/TestConcurrentManySignals.py @@ -0,0 +1,23 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentManySignals(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @unittest2.skipIf( + TestBase.skipLongRunningTest(), + "Skip this long running test") + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test 100 signals from 100 threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_signal_threads=100) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py new file mode 100644 index 000000000000..73c1704e7e54 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py @@ -0,0 +1,23 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentManyWatchpoints(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @unittest2.skipIf( + TestBase.skipLongRunningTest(), + "Skip this long running test") + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test 100 watchpoints from 100 threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_watchpoint_threads=100) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py new file mode 100644 index 000000000000..b9a7c5f568cb --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py @@ -0,0 +1,23 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentNWatchNBreak(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test with 5 watchpoint and breakpoint threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_watchpoint_threads=5, + num_breakpoint_threads=5) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/TestConcurrentSignalBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/TestConcurrentSignalBreak.py new file mode 100644 index 000000000000..b8819f286984 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/TestConcurrentSignalBreak.py @@ -0,0 +1,21 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentSignalBreak(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test signal and a breakpoint in multiple threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_breakpoint_threads=1, num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/TestConcurrentSignalDelayBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/TestConcurrentSignalDelayBreak.py new file mode 100644 index 000000000000..b7d8cb174d24 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/TestConcurrentSignalDelayBreak.py @@ -0,0 +1,23 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentSignalDelayBreak(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test signal and a (1 second delay) breakpoint in multiple threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions( + num_delay_breakpoint_threads=1, + num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py new file mode 100644 index 000000000000..128245343803 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentSignalDelayWatch(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test a (1 second delay) watchpoint and a signal in multiple threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions( + num_signal_threads=1, + num_delay_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py new file mode 100644 index 000000000000..56217e1e8c3f --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentSignalNWatchNBreak(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test one signal thread with 5 watchpoint and breakpoint threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_signal_threads=1, + num_watchpoint_threads=5, + num_breakpoint_threads=5) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py new file mode 100644 index 000000000000..001062896265 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py @@ -0,0 +1,22 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentSignalWatch(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test a watchpoint and a signal in multiple threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_signal_threads=1, num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py new file mode 100644 index 000000000000..d7725002f2bd --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentSignalWatchBreak(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test a signal/watchpoint/breakpoint in multiple threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_signal_threads=1, + num_watchpoint_threads=1, + num_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/TestConcurrentTwoBreakpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/TestConcurrentTwoBreakpointThreads.py new file mode 100644 index 000000000000..4e6bed2d5cbc --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/TestConcurrentTwoBreakpointThreads.py @@ -0,0 +1,21 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentTwoBreakpointThreads(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test two threads that trigger a breakpoint. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_breakpoint_threads=2) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/TestConcurrentTwoBreakpointsOneDelaySignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/TestConcurrentTwoBreakpointsOneDelaySignal.py new file mode 100644 index 000000000000..d7630575cb34 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/TestConcurrentTwoBreakpointsOneDelaySignal.py @@ -0,0 +1,23 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentTwoBreakpointsOneDelaySignal(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test two threads that trigger a breakpoint and one (1 second delay) signal thread. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions( + num_breakpoint_threads=2, + num_delay_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/TestConcurrentTwoBreakpointsOneSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/TestConcurrentTwoBreakpointsOneSignal.py new file mode 100644 index 000000000000..4c4caa533734 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/TestConcurrentTwoBreakpointsOneSignal.py @@ -0,0 +1,21 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentTwoBreakpointsOneSignal(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test two threads that trigger a breakpoint and one signal thread. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_breakpoint_threads=2, num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py new file mode 100644 index 000000000000..f26a5dc6f848 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentTwoBreakpointsOneWatchpoint(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test two threads that trigger a breakpoint and one watchpoint thread. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions( + num_breakpoint_threads=2, + num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py new file mode 100644 index 000000000000..059e077be98c --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py @@ -0,0 +1,22 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentTwoWatchpointThreads(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test two threads that trigger a watchpoint. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_watchpoint_threads=2) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py new file mode 100644 index 000000000000..4b3c35ea8e68 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentTwoWatchpointsOneBreakpoint(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test two threads that trigger a watchpoint and one breakpoint thread. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions( + num_watchpoint_threads=2, + num_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py new file mode 100644 index 000000000000..ae6f64451abf --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentTwoWatchpointsOneDelayBreakpoint(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test two threads that trigger a watchpoint and one (1 second delay) breakpoint thread. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions( + num_watchpoint_threads=2, + num_delay_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py new file mode 100644 index 000000000000..78f2dbbc8325 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py @@ -0,0 +1,22 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentTwoWatchpointsOneSignal(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test two threads that trigger a watchpoint and one signal thread. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_watchpoint_threads=2, num_signal_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py new file mode 100644 index 000000000000..ffa6909129ad --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentWatchBreak(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test watchpoint and a breakpoint in multiple threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions( + num_breakpoint_threads=1, + num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py new file mode 100644 index 000000000000..4c8b5b319ae4 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentWatchBreakDelay(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test watchpoint and a (1 second delay) breakpoint in multiple threads.""" + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions( + num_delay_breakpoint_threads=1, + num_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py new file mode 100644 index 000000000000..0d545b31230f --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py @@ -0,0 +1,24 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentWatchpointDelayWatchpointOneBreakpoint(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test two threads that trigger a watchpoint (one with a 1 second delay) and one breakpoint thread. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_watchpoint_threads=1, + num_delay_watchpoint_threads=1, + num_breakpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile new file mode 100644 index 000000000000..4b5e0ee94222 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile @@ -0,0 +1,9 @@ +LEVEL = ../../../../make + +CXX_SOURCES := main.cpp + +ENABLE_THREADS := YES + +VPATH = .. + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py new file mode 100644 index 000000000000..56cd85da88d3 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py @@ -0,0 +1,23 @@ +from __future__ import print_function + +import unittest2 + +from lldbsuite.test.decorators import * +from lldbsuite.test.concurrent_base import ConcurrentEventsBase +from lldbsuite.test.lldbtest import TestBase + + +@skipIfWindows +class ConcurrentWatchpointWithDelayWatchpointThreads(ConcurrentEventsBase): + + mydir = ConcurrentEventsBase.compute_mydir(__file__) + + @skipIfFreeBSD # timing out on buildbot + @skipIfRemoteDueToDeadlock + # Atomic sequences are not supported yet for MIPS in LLDB. + @skipIf(triple='^mips') + def test(self): + """Test two threads that trigger a watchpoint where one thread has a 1 second delay. """ + self.build(dictionary=self.getBuildFlags()) + self.do_thread_actions(num_watchpoint_threads=1, + num_delay_watchpoint_threads=1) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py b/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py index edd1e885ca9e..5343e19ee203 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py @@ -5,13 +5,13 @@ Test that step-inst over a crash behaves correctly. from __future__ import print_function - import os import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class CreateDuringStepTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -21,9 +21,8 @@ class CreateDuringStepTestCase(TestBase): self.breakpoint = line_number('main.cpp', '// Set breakpoint here') @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") - @expectedFailureAndroid("llvm.org/pr24497", archs=['arm', 'aarch64']) - @expectedFailureAll(oslist=["linux"], archs=["arm"], bugnumber="llvm.org/pr24497") - @expectedFailureAll(triple = re.compile('^mips')) # IO error due to breakpoint at invalid address + # IO error due to breakpoint at invalid address + @expectedFailureAll(triple=re.compile('^mips')) def test_step_inst_with(self): """Test thread creation during step-inst handling.""" self.build(dictionary=self.getBuildFlags()) @@ -32,21 +31,34 @@ class CreateDuringStepTestCase(TestBase): target = self.dbg.CreateTarget(exe) self.assertTrue(target and target.IsValid(), "Target is valid") - self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1) + self.bp_num = lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.breakpoint, num_expected_locations=1) # Run the program. - process = target.LaunchSimple(None, None, self.get_process_working_directory()) + process = target.LaunchSimple( + None, None, self.get_process_working_directory()) self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID) # The stop reason should be breakpoint. - self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertEqual( + process.GetState(), + lldb.eStateStopped, + PROCESS_STOPPED) + thread = lldbutil.get_stopped_thread( + process, lldb.eStopReasonBreakpoint) self.assertTrue(thread.IsValid(), STOPPED_DUE_TO_BREAKPOINT) # Keep stepping until the inferior crashes while process.GetState() == lldb.eStateStopped and not lldbutil.is_thread_crashed(self, thread): thread.StepInstruction(False) - self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) - self.assertTrue(lldbutil.is_thread_crashed(self, thread), "Thread has crashed") + self.assertEqual( + process.GetState(), + lldb.eStateStopped, + PROCESS_STOPPED) + self.assertTrue( + lldbutil.is_thread_crashed( + self, + thread), + "Thread has crashed") process.Kill() diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py b/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py index 1cb97355395f..fb6208a0d3e5 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py @@ -5,31 +5,33 @@ Test thread creation after process attach. from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class CreateAfterAttachTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIfFreeBSD # Hangs. May be the same as Linux issue llvm.org/pr16229 but - # not yet investigated. Revisit once required functionality - # is implemented for FreeBSD. - @skipIfWindows # Occasionally hangs on Windows, may be same as other issues. + @skipIfFreeBSD # Hangs. May be the same as Linux issue llvm.org/pr16229 but + # not yet investigated. Revisit once required functionality + # is implemented for FreeBSD. + # Occasionally hangs on Windows, may be same as other issues. + @skipIfWindows @skipIfiOSSimulator def test_create_after_attach_with_popen(self): """Test thread creation after process attach.""" self.build(dictionary=self.getBuildFlags(use_cpp11=False)) self.create_after_attach(use_fork=False) - @skipIfFreeBSD # Hangs. Revisit once required functionality is implemented - # for FreeBSD. + @skipIfFreeBSD # Hangs. Revisit once required functionality is implemented + # for FreeBSD. @skipIfRemote - @skipIfWindows # Windows doesn't have fork. + @skipIfWindows # Windows doesn't have fork. @skipIfiOSSimulator def test_create_after_attach_with_fork(self): """Test thread creation after process attach.""" @@ -66,13 +68,16 @@ class CreateAfterAttachTestCase(TestBase): self.assertTrue(process, PROCESS_IS_VALID) # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_1, num_expected_locations=1) # This should create a breakpoint in the second child thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_2, num_expected_locations=1) # This should create a breakpoint in the first child thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_3, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_3, num_expected_locations=1) # Note: With std::thread, we cannot rely on particular thread numbers. Using # std::thread may cause the program to spin up a thread pool (and it does on @@ -83,10 +88,10 @@ class CreateAfterAttachTestCase(TestBase): # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - '* thread #', - 'main', - 'stop reason = breakpoint']) + substrs=['stopped', + '* thread #', + 'main', + 'stop reason = breakpoint']) # Change a variable to escape the loop self.runCmd("expression main_thread_continue = 1") @@ -96,10 +101,10 @@ class CreateAfterAttachTestCase(TestBase): # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - '* thread #', - 'thread_2_func', - 'stop reason = breakpoint']) + substrs=['stopped', + '* thread #', + 'thread_2_func', + 'stop reason = breakpoint']) # Change a variable to escape the loop self.runCmd("expression child_thread_continue = 1") @@ -110,13 +115,15 @@ class CreateAfterAttachTestCase(TestBase): # The stop reason of the thread should be breakpoint. # Thread 3 may or may not have already exited. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - '* thread #', - 'thread_1_func', - 'stop reason = breakpoint']) + substrs=['stopped', + '* thread #', + 'thread_1_func', + 'stop reason = breakpoint']) # Run to completion self.runCmd("continue") # At this point, the inferior process should have exited. - self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) + self.assertTrue( + process.GetState() == lldb.eStateExited, + PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py b/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py index 9401826e304e..f6d6197e1f11 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py @@ -5,43 +5,74 @@ Test number of threads. from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class CreateDuringStepTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") + @expectedFailureAll( + oslist=["linux"], + bugnumber="llvm.org/pr15824 thread states not properly maintained") + @expectedFailureAll( + oslist=lldbplatformutil.getDarwinOSTriples(), + bugnumber="llvm.org/pr15824 thread states not properly maintained, <rdar://problem/28557237>") + @expectedFailureAll( + oslist=["freebsd"], + bugnumber="llvm.org/pr18190 thread states not properly maintained") + @expectedFailureAll( + oslist=["windows"], + bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") def test_step_inst(self): """Test thread creation during step-inst handling.""" self.build(dictionary=self.getBuildFlags()) - self.create_during_step_base("thread step-inst -m all-threads", 'stop reason = instruction step') - - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") + self.create_during_step_base( + "thread step-inst -m all-threads", + 'stop reason = instruction step') + + @expectedFailureAll( + oslist=["linux"], + bugnumber="llvm.org/pr15824 thread states not properly maintained") + @expectedFailureAll( + oslist=lldbplatformutil.getDarwinOSTriples(), + bugnumber="llvm.org/pr15824 thread states not properly maintained, <rdar://problem/28557237>") + @expectedFailureAll( + oslist=["freebsd"], + bugnumber="llvm.org/pr18190 thread states not properly maintained") + @expectedFailureAll( + oslist=["windows"], + bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") def test_step_over(self): """Test thread creation during step-over handling.""" self.build(dictionary=self.getBuildFlags()) - self.create_during_step_base("thread step-over -m all-threads", 'stop reason = step over') - - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") + self.create_during_step_base( + "thread step-over -m all-threads", + 'stop reason = step over') + + @expectedFailureAll( + oslist=["linux"], + bugnumber="llvm.org/pr15824 thread states not properly maintained") + @expectedFailureAll( + oslist=lldbplatformutil.getDarwinOSTriples(), + bugnumber="<rdar://problem/28574077>") + @expectedFailureAll( + oslist=["freebsd"], + bugnumber="llvm.org/pr18190 thread states not properly maintained") + @expectedFailureAll( + oslist=["windows"], + bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") def test_step_in(self): """Test thread creation during step-in handling.""" self.build(dictionary=self.getBuildFlags()) - self.create_during_step_base("thread step-in -m all-threads", 'stop reason = step in') + self.create_during_step_base( + "thread step-in -m all-threads", + 'stop reason = step in') def setUp(self): # Call super's setUp(). @@ -55,47 +86,33 @@ class CreateDuringStepTestCase(TestBase): exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - # This should create a breakpoint in the stepping thread. - self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1) + # Get the target process + target = self.dbg.GetSelectedTarget() - # The breakpoint list should show 1 location. - self.expect("breakpoint list -f", "Breakpoint location shown correctly", - substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.breakpoint]) + # This should create a breakpoint in the stepping thread. + self.bkpt = target.BreakpointCreateByLocation("main.cpp", self.breakpoint) # Run the program. self.runCmd("run", RUN_SUCCEEDED) - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - 'stop reason = breakpoint']) - - # Get the target process - target = self.dbg.GetSelectedTarget() process = target.GetProcess() + # The stop reason of the thread should be breakpoint. + stepping_thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, self.bkpt) + self.assertTrue(stepping_thread.IsValid(), "We stopped at the right breakpoint") + # Get the number of threads num_threads = process.GetNumThreads() # Make sure we see only two threads - self.assertTrue(num_threads == 2, 'Number of expected threads and actual threads do not match.') + self.assertTrue( + num_threads == 2, + 'Number of expected threads and actual threads do not match.') # Get the thread objects thread1 = process.GetThreadAtIndex(0) thread2 = process.GetThreadAtIndex(1) - # Make sure both threads are stopped - self.assertTrue(thread1.IsStopped(), "Thread 1 didn't stop during breakpoint") - self.assertTrue(thread2.IsStopped(), "Thread 2 didn't stop during breakpoint") - - # Find the thread that is stopped at the breakpoint - stepping_thread = None - for thread in process: - expected_bp_desc = "breakpoint %s." % self.bp_num - if expected_bp_desc in thread.GetStopDescription(100): - stepping_thread = thread - break - self.assertTrue(stepping_thread != None, "unable to find thread stopped at %s" % expected_bp_desc) current_line = self.breakpoint # Keep stepping until we've reached our designated continue point while current_line != self.continuepoint: @@ -108,21 +125,30 @@ class CreateDuringStepTestCase(TestBase): current_line = frame.GetLineEntry().GetLine() # Make sure we're still where we thought we were - self.assertTrue(current_line >= self.breakpoint, "Stepped to unexpected line, " + str(current_line)) - self.assertTrue(current_line <= self.continuepoint, "Stepped to unexpected line, " + str(current_line)) + self.assertTrue( + current_line >= self.breakpoint, + "Stepped to unexpected line, " + + str(current_line)) + self.assertTrue( + current_line <= self.continuepoint, + "Stepped to unexpected line, " + + str(current_line)) # Update the number of threads num_threads = process.GetNumThreads() # Check to see that we increased the number of threads as expected - self.assertTrue(num_threads == 3, 'Number of expected threads and actual threads do not match after thread exit.') + self.assertTrue( + num_threads == 3, + 'Number of expected threads and actual threads do not match after thread exit.') - self.expect("thread list", 'Process state is stopped due to step', - substrs = ['stopped', - step_stop_reason]) + stop_reason = stepping_thread.GetStopReason() + self.assertEqual(stop_reason, lldb.eStopReasonPlanComplete, "Stopped for plan completion") # Run to completion self.runCmd("process continue") # At this point, the inferior process should have exited. - self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) + self.assertTrue( + process.GetState() == lldb.eStateExited, + PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py index 2c394263d36e..5c0544f0ccab 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py @@ -5,13 +5,14 @@ Test number of threads. from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class ExitDuringBreakpointTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -22,10 +23,12 @@ class ExitDuringBreakpointTestCase(TestBase): # Find the line number for our breakpoint. self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") + @expectedFailureAll( + oslist=["linux"], + bugnumber="llvm.org/pr15824 thread states not properly maintained") + @expectedFailureAll( + oslist=["freebsd"], + bugnumber="llvm.org/pr18190 thread states not properly maintained") def test(self): """Test thread exit during breakpoint handling.""" self.build(dictionary=self.getBuildFlags()) @@ -33,19 +36,16 @@ class ExitDuringBreakpointTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1) - - # The breakpoint list should show 1 location. - self.expect("breakpoint list -f", "Breakpoint location shown correctly", - substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.breakpoint]) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.breakpoint, num_expected_locations=1) # Run the program. self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - 'stop reason = breakpoint']) + substrs=['stopped', + 'stop reason = breakpoint']) # Get the target process target = self.dbg.GetSelectedTarget() @@ -59,24 +59,14 @@ class ExitDuringBreakpointTestCase(TestBase): num_threads = process.GetNumThreads() # Make sure we see at least five threads - self.assertTrue(num_threads >= 5, 'Number of expected threads and actual threads do not match.') - - # Get the thread objects - thread1 = process.GetThreadAtIndex(0) - thread2 = process.GetThreadAtIndex(1) - thread3 = process.GetThreadAtIndex(2) - thread4 = process.GetThreadAtIndex(3) - thread5 = process.GetThreadAtIndex(4) - - # Make sure all threads are stopped - self.assertTrue(thread1.IsStopped(), "Thread 1 didn't stop during breakpoint") - self.assertTrue(thread2.IsStopped(), "Thread 2 didn't stop during breakpoint") - self.assertTrue(thread3.IsStopped(), "Thread 3 didn't stop during breakpoint") - self.assertTrue(thread4.IsStopped(), "Thread 4 didn't stop during breakpoint") - self.assertTrue(thread5.IsStopped(), "Thread 5 didn't stop during breakpoint") + self.assertTrue( + num_threads >= 5, + 'Number of expected threads and actual threads do not match.') # Run to completion self.runCmd("continue") # At this point, the inferior process should have exited. - self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) + self.assertTrue( + process.GetState() == lldb.eStateExited, + PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py index af4a022ed0c1..4ba04953d6f1 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py @@ -5,34 +5,44 @@ Test number of threads. from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class ExitDuringStepTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIfFreeBSD # llvm.org/pr21411: test is hanging + @skipIfFreeBSD # llvm.org/pr21411: test is hanging def test(self): """Test thread exit during step handling.""" self.build(dictionary=self.getBuildFlags()) - self.exit_during_step_base("thread step-inst -m all-threads", 'stop reason = instruction step') + self.exit_during_step_base( + "thread step-inst -m all-threads", + 'stop reason = instruction step', + True) - @skipIfFreeBSD # llvm.org/pr21411: test is hanging + @skipIfFreeBSD # llvm.org/pr21411: test is hanging def test_step_over(self): """Test thread exit during step-over handling.""" self.build(dictionary=self.getBuildFlags()) - self.exit_during_step_base("thread step-over -m all-threads", 'stop reason = step over') + self.exit_during_step_base( + "thread step-over -m all-threads", + 'stop reason = step over', + False) - @skipIfFreeBSD # llvm.org/pr21411: test is hanging + @skipIfFreeBSD # llvm.org/pr21411: test is hanging def test_step_in(self): """Test thread exit during step-in handling.""" self.build(dictionary=self.getBuildFlags()) - self.exit_during_step_base("thread step-in -m all-threads", 'stop reason = step in') + self.exit_during_step_base( + "thread step-in -m all-threads", + 'stop reason = step in', + False) def setUp(self): # Call super's setUp(). @@ -41,25 +51,30 @@ class ExitDuringStepTestCase(TestBase): self.breakpoint = line_number('main.cpp', '// Set breakpoint here') self.continuepoint = line_number('main.cpp', '// Continue from here') - def exit_during_step_base(self, step_cmd, step_stop_reason): + def exit_during_step_base(self, step_cmd, step_stop_reason, by_instruction): """Test thread exit during step handling.""" exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint in the main thread. - self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1) + self.bp_num = lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.breakpoint, num_expected_locations=1) # The breakpoint list should show 1 location. - self.expect("breakpoint list -f", "Breakpoint location shown correctly", - substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.breakpoint]) + self.expect( + "breakpoint list -f", + "Breakpoint location shown correctly", + substrs=[ + "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % + self.breakpoint]) # Run the program. self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - 'stop reason = breakpoint']) + substrs=['stopped', + 'stop reason = breakpoint']) # Get the target process target = self.dbg.GetSelectedTarget() @@ -67,14 +82,23 @@ class ExitDuringStepTestCase(TestBase): num_threads = process.GetNumThreads() # Make sure we see all three threads - self.assertGreaterEqual(num_threads, 3, 'Number of expected threads and actual threads do not match.') + self.assertGreaterEqual( + num_threads, + 3, + 'Number of expected threads and actual threads do not match.') - stepping_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(process, self.bp_num) - self.assertIsNotNone(stepping_thread, "Could not find a thread stopped at the breakpoint") + stepping_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id( + process, self.bp_num) + self.assertIsNotNone( + stepping_thread, + "Could not find a thread stopped at the breakpoint") current_line = self.breakpoint stepping_frame = stepping_thread.GetFrameAtIndex(0) - self.assertEqual(current_line, stepping_frame.GetLineEntry().GetLine(), "Starting line for stepping doesn't match breakpoint line.") + self.assertEqual( + current_line, + stepping_frame.GetLineEntry().GetLine(), + "Starting line for stepping doesn't match breakpoint line.") # Keep stepping until we've reached our designated continue point while current_line != self.continuepoint: @@ -90,8 +114,19 @@ class ExitDuringStepTestCase(TestBase): current_line = frame.GetLineEntry().GetLine() - self.assertGreaterEqual(current_line, self.breakpoint, "Stepped to unexpected line, " + str(current_line)) - self.assertLessEqual(current_line, self.continuepoint, "Stepped to unexpected line, " + str(current_line)) + if by_instruction and current_line == 0: + continue + + self.assertGreaterEqual( + current_line, + self.breakpoint, + "Stepped to unexpected line, " + + str(current_line)) + self.assertLessEqual( + current_line, + self.continuepoint, + "Stepped to unexpected line, " + + str(current_line)) self.runCmd("thread list") @@ -99,11 +134,14 @@ class ExitDuringStepTestCase(TestBase): new_num_threads = process.GetNumThreads() # Check to see that we reduced the number of threads as expected - self.assertEqual(new_num_threads, num_threads-1, 'Number of threads did not reduce by 1 after thread exit.') + self.assertEqual( + new_num_threads, + num_threads - 1, + 'Number of threads did not reduce by 1 after thread exit.') self.expect("thread list", 'Process state is stopped due to step', - substrs = ['stopped', - step_stop_reason]) + substrs=['stopped', + step_stop_reason]) # Run to completion self.runCmd("continue") diff --git a/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py b/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py index 4c55bcd982a7..26ee5d4084eb 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py @@ -5,13 +5,14 @@ Test jumping to different places. from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class ThreadJumpTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -29,31 +30,50 @@ class ThreadJumpTestCase(TestBase): self.mark4 = line_number('main.cpp', '// 4th marker') self.mark5 = line_number('other.cpp', '// other marker') - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.mark3, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.mark3, num_expected_locations=1) self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint 1. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT + " 1", - substrs=['stopped', 'main.cpp:{}'.format(self.mark3), 'stop reason = breakpoint 1']) + self.expect( + "thread list", + STOPPED_DUE_TO_BREAKPOINT + " 1", + substrs=[ + 'stopped', + 'main.cpp:{}'.format( + self.mark3), + 'stop reason = breakpoint 1']) - self.do_min_test(self.mark3, self.mark1, "i", "4"); # Try the int path, force it to return 'a' - self.do_min_test(self.mark3, self.mark2, "i", "5"); # Try the int path, force it to return 'b' - self.do_min_test(self.mark4, self.mark1, "j", "7"); # Try the double path, force it to return 'a' - self.do_min_test(self.mark4, self.mark2, "j", "8"); # Try the double path, force it to return 'b' + # Try the int path, force it to return 'a' + self.do_min_test(self.mark3, self.mark1, "i", "4") + # Try the int path, force it to return 'b' + self.do_min_test(self.mark3, self.mark2, "i", "5") + # Try the double path, force it to return 'a' + self.do_min_test(self.mark4, self.mark1, "j", "7") + # Try the double path, force it to return 'b' + self.do_min_test(self.mark4, self.mark2, "j", "8") # Try jumping to another function in a different file. - self.runCmd("thread jump --file other.cpp --line %i --force" % self.mark5) + self.runCmd( + "thread jump --file other.cpp --line %i --force" % + self.mark5) self.expect("process status", - substrs = ["at other.cpp:%i" % self.mark5]) + substrs=["at other.cpp:%i" % self.mark5]) # Try jumping to another function (without forcing) - self.expect("j main.cpp:%i" % self.mark1, COMMAND_FAILED_AS_EXPECTED, error = True, - substrs = ["error"]) - + self.expect( + "j main.cpp:%i" % + self.mark1, + COMMAND_FAILED_AS_EXPECTED, + error=True, + substrs=["error"]) + def do_min_test(self, start, jump, var, value): - self.runCmd("j %i" % start) # jump to the start marker + # jump to the start marker + self.runCmd("j %i" % start) self.runCmd("thread step-in") # step into the min fn - self.runCmd("j %i" % jump) # jump to the branch we're interested in + # jump to the branch we're interested in + self.runCmd("j %i" % jump) self.runCmd("thread step-out") # return out self.runCmd("thread step-over") # assign to the global - self.expect("expr %s" % var, substrs = [value]) # check it + self.expect("expr %s" % var, substrs=[value]) # check it diff --git a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py index d4b1eb32a9ae..18d88cb52113 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py @@ -5,13 +5,14 @@ Test number of threads. from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class MultipleBreakpointTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -22,10 +23,18 @@ class MultipleBreakpointTestCase(TestBase): # Find the line number for our breakpoint. self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained") - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") + @expectedFailureAll( + oslist=["linux"], + bugnumber="llvm.org/pr15824 thread states not properly maintained") + @expectedFailureAll( + oslist=lldbplatformutil.getDarwinOSTriples(), + bugnumber="llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>") + @expectedFailureAll( + oslist=["freebsd"], + bugnumber="llvm.org/pr18190 thread states not properly maintained") + @expectedFailureAll( + oslist=["windows"], + bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") def test(self): """Test simultaneous breakpoints in multiple threads.""" self.build(dictionary=self.getBuildFlags()) @@ -33,11 +42,8 @@ class MultipleBreakpointTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1) - - # The breakpoint list should show 1 location. - self.expect("breakpoint list -f", "Breakpoint location shown correctly", - substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.breakpoint]) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.breakpoint, num_expected_locations=1) # Run the program. self.runCmd("run", RUN_SUCCEEDED) @@ -45,8 +51,8 @@ class MultipleBreakpointTestCase(TestBase): # The stop reason of the thread should be breakpoint. # The breakpoint may be hit in either thread 2 or thread 3. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - 'stop reason = breakpoint']) + substrs=['stopped', + 'stop reason = breakpoint']) # Get the target process target = self.dbg.GetSelectedTarget() @@ -56,7 +62,9 @@ class MultipleBreakpointTestCase(TestBase): num_threads = process.GetNumThreads() # Make sure we see all three threads - self.assertTrue(num_threads >= 3, 'Number of expected threads and actual threads do not match.') + self.assertTrue( + num_threads >= 3, + 'Number of expected threads and actual threads do not match.') # Get the thread objects thread1 = process.GetThreadAtIndex(0) @@ -64,9 +72,15 @@ class MultipleBreakpointTestCase(TestBase): thread3 = process.GetThreadAtIndex(2) # Make sure both threads are stopped - self.assertTrue(thread1.IsStopped(), "Primary thread didn't stop during breakpoint") - self.assertTrue(thread2.IsStopped(), "Secondary thread didn't stop during breakpoint") - self.assertTrue(thread3.IsStopped(), "Tertiary thread didn't stop during breakpoint") + self.assertTrue( + thread1.IsStopped(), + "Primary thread didn't stop during breakpoint") + self.assertTrue( + thread2.IsStopped(), + "Secondary thread didn't stop during breakpoint") + self.assertTrue( + thread3.IsStopped(), + "Tertiary thread didn't stop during breakpoint") # Delete the first breakpoint then continue self.runCmd("breakpoint delete 1") @@ -75,4 +89,6 @@ class MultipleBreakpointTestCase(TestBase): self.runCmd("continue") # At this point, the inferior process should have exited. - self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) + self.assertTrue( + process.GetState() == lldb.eStateExited, + PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py b/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py index 5afb57bf4ba8..1fb52155c266 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py @@ -5,28 +5,37 @@ Test thread states. from __future__ import print_function - import unittest2 -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class ThreadStateTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained") + @expectedFailureAll( + oslist=["linux"], + bugnumber="llvm.org/pr15824 thread states not properly maintained") + @expectedFailureAll( + oslist=lldbplatformutil.getDarwinOSTriples(), + bugnumber="llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>") + @expectedFailureAll( + oslist=["freebsd"], + bugnumber="llvm.org/pr18190 thread states not properly maintained") def test_state_after_breakpoint(self): """Test thread state after breakpoint.""" self.build(dictionary=self.getBuildFlags(use_cpp11=False)) self.thread_state_after_breakpoint_test() - @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly - @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr23669") + @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly + @expectedFailureAll( + oslist=lldbplatformutil.getDarwinOSTriples(), + bugnumber="llvm.org/pr23669") @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr15824") @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24660") def test_state_after_continue(self): @@ -34,24 +43,31 @@ class ThreadStateTestCase(TestBase): self.build(dictionary=self.getBuildFlags(use_cpp11=False)) self.thread_state_after_continue_test() - @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly + @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly @expectedFailureDarwin('llvm.org/pr23669') @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24660") - @unittest2.expectedFailure("llvm.org/pr16712") # thread states not properly maintained + # thread states not properly maintained + @unittest2.expectedFailure("llvm.org/pr16712") def test_state_after_expression(self): """Test thread state after expression.""" self.build(dictionary=self.getBuildFlags(use_cpp11=False)) self.thread_state_after_expression_test() - @unittest2.expectedFailure("llvm.org/pr16712") # thread states not properly maintained - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") + # thread states not properly maintained + @unittest2.expectedFailure("llvm.org/pr16712") + @expectedFailureAll( + oslist=["windows"], + bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") def test_process_interrupt(self): """Test process interrupt.""" self.build(dictionary=self.getBuildFlags(use_cpp11=False)) self.process_interrupt_test() - @unittest2.expectedFailure("llvm.org/pr15824") # thread states not properly maintained - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") + # thread states not properly maintained + @unittest2.expectedFailure("llvm.org/pr15824 and <rdar://problem/28557237>") + @expectedFailureAll( + oslist=["windows"], + bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly") def test_process_state(self): """Test thread states (comprehensive).""" self.build(dictionary=self.getBuildFlags(use_cpp11=False)) @@ -70,7 +86,8 @@ class ThreadStateTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint in the main thread. - bp = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1) + bp = lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_1, num_expected_locations=1) # Run the program. self.runCmd("run", RUN_SUCCEEDED) @@ -79,12 +96,16 @@ class ThreadStateTestCase(TestBase): target = self.dbg.GetSelectedTarget() process = target.GetProcess() - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + thread = lldbutil.get_stopped_thread( + process, lldb.eStopReasonBreakpoint) self.assertIsNotNone(thread) # Make sure the thread is in the stopped state. - self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 1.") - self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' during breakpoint 1.") + self.assertTrue( + thread.IsStopped(), + "Thread state isn't \'stopped\' during breakpoint 1.") + self.assertFalse(thread.IsSuspended(), + "Thread state is \'suspended\' during breakpoint 1.") # Kill the process self.runCmd("process kill") @@ -92,8 +113,12 @@ class ThreadStateTestCase(TestBase): def wait_for_running_event(self, process): listener = self.dbg.GetListener() if lldb.remote_platform: - lldbutil.expect_state_changes(self, listener, process, [lldb.eStateConnected]) - lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning]) + lldbutil.expect_state_changes( + self, listener, process, [ + lldb.eStateConnected]) + lldbutil.expect_state_changes( + self, listener, process, [ + lldb.eStateRunning]) def thread_state_after_continue_test(self): """Test thread state after continue.""" @@ -101,8 +126,10 @@ class ThreadStateTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1) - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_1, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_2, num_expected_locations=1) # Run the program. self.runCmd("run", RUN_SUCCEEDED) @@ -111,17 +138,23 @@ class ThreadStateTestCase(TestBase): target = self.dbg.GetSelectedTarget() process = target.GetProcess() - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + thread = lldbutil.get_stopped_thread( + process, lldb.eStopReasonBreakpoint) self.assertIsNotNone(thread) - # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change. + # Continue, the inferior will go into an infinite loop waiting for + # 'g_test' to change. self.dbg.SetAsync(True) self.runCmd("continue") self.wait_for_running_event(process) # Check the thread state. It should be running. - self.assertFalse(thread.IsStopped(), "Thread state is \'stopped\' when it should be running.") - self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' when it should be running.") + self.assertFalse( + thread.IsStopped(), + "Thread state is \'stopped\' when it should be running.") + self.assertFalse( + thread.IsSuspended(), + "Thread state is \'suspended\' when it should be running.") # Go back to synchronous interactions self.dbg.SetAsync(False) @@ -135,8 +168,10 @@ class ThreadStateTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1) - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_1, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_2, num_expected_locations=1) # Run the program. self.runCmd("run", RUN_SUCCEEDED) @@ -145,27 +180,32 @@ class ThreadStateTestCase(TestBase): target = self.dbg.GetSelectedTarget() process = target.GetProcess() - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + thread = lldbutil.get_stopped_thread( + process, lldb.eStopReasonBreakpoint) self.assertIsNotNone(thread) # Get the inferior out of its loop self.runCmd("expression g_test = 1") # Check the thread state - self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' after expression evaluation.") - self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' after expression evaluation.") + self.assertTrue( + thread.IsStopped(), + "Thread state isn't \'stopped\' after expression evaluation.") + self.assertFalse( + thread.IsSuspended(), + "Thread state is \'suspended\' after expression evaluation.") # Let the process run to completion self.runCmd("process continue") - def process_interrupt_test(self): """Test process interrupt and continue.""" exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_1, num_expected_locations=1) # Run the program. self.runCmd("run", RUN_SUCCEEDED) @@ -174,10 +214,12 @@ class ThreadStateTestCase(TestBase): target = self.dbg.GetSelectedTarget() process = target.GetProcess() - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + thread = lldbutil.get_stopped_thread( + process, lldb.eStopReasonBreakpoint) self.assertIsNotNone(thread) - # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change. + # Continue, the inferior will go into an infinite loop waiting for + # 'g_test' to change. self.dbg.SetAsync(True) self.runCmd("continue") self.wait_for_running_event(process) @@ -202,8 +244,10 @@ class ThreadStateTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1) - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_1, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_2, num_expected_locations=1) # Run the program. self.runCmd("run", RUN_SUCCEEDED) @@ -211,21 +255,30 @@ class ThreadStateTestCase(TestBase): # Get the target process target = self.dbg.GetSelectedTarget() process = target.GetProcess() - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + thread = lldbutil.get_stopped_thread( + process, lldb.eStopReasonBreakpoint) self.assertIsNotNone(thread) # Make sure the thread is in the stopped state. - self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 1.") - self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' during breakpoint 1.") - - # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change. + self.assertTrue( + thread.IsStopped(), + "Thread state isn't \'stopped\' during breakpoint 1.") + self.assertFalse(thread.IsSuspended(), + "Thread state is \'suspended\' during breakpoint 1.") + + # Continue, the inferior will go into an infinite loop waiting for + # 'g_test' to change. self.dbg.SetAsync(True) self.runCmd("continue") self.wait_for_running_event(process) # Check the thread state. It should be running. - self.assertFalse(thread.IsStopped(), "Thread state is \'stopped\' when it should be running.") - self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' when it should be running.") + self.assertFalse( + thread.IsStopped(), + "Thread state is \'stopped\' when it should be running.") + self.assertFalse( + thread.IsSuspended(), + "Thread state is \'suspended\' when it should be running.") # Go back to synchronous interactions self.dbg.SetAsync(False) @@ -236,15 +289,22 @@ class ThreadStateTestCase(TestBase): self.assertEqual(thread.GetState(), lldb.eStopReasonSignal) # Check the thread state - self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' after process stop.") - self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' after process stop.") + self.assertTrue( + thread.IsStopped(), + "Thread state isn't \'stopped\' after process stop.") + self.assertFalse(thread.IsSuspended(), + "Thread state is \'suspended\' after process stop.") # Get the inferior out of its loop self.runCmd("expression g_test = 1") # Check the thread state - self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' after expression evaluation.") - self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' after expression evaluation.") + self.assertTrue( + thread.IsStopped(), + "Thread state isn't \'stopped\' after expression evaluation.") + self.assertFalse( + thread.IsSuspended(), + "Thread state is \'suspended\' after expression evaluation.") self.assertEqual(thread.GetState(), lldb.eStopReasonSignal) @@ -254,8 +314,11 @@ class ThreadStateTestCase(TestBase): self.assertEqual(thread.GetState(), lldb.eStopReasonBreakpoint) # Make sure both threads are stopped - self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 2.") - self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' during breakpoint 2.") + self.assertTrue( + thread.IsStopped(), + "Thread state isn't \'stopped\' during breakpoint 2.") + self.assertFalse(thread.IsSuspended(), + "Thread state is \'suspended\' during breakpoint 2.") # Run to completion self.runCmd("continue") diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py b/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py index 735ee80d624e..f043013b90ce 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py @@ -5,38 +5,54 @@ Test stepping out from a function in a multi-threaded program. from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class ThreadStepOutTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIfLinux # Test occasionally times out on the Linux build bot - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18066 inferior does not exit") + # Test occasionally times out on the Linux build bot + @skipIfLinux + @expectedFailureAll( + oslist=["linux"], + bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot") + @expectedFailureAll( + oslist=["freebsd"], + bugnumber="llvm.org/pr18066 inferior does not exit") @expectedFailureAll(oslist=["windows"]) def test_step_single_thread(self): """Test thread step out on one thread via command interpreter. """ self.build(dictionary=self.getBuildFlags()) self.step_out_test(self.step_out_single_thread_with_cmd) - @skipIfLinux # Test occasionally times out on the Linux build bot - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint") + # Test occasionally times out on the Linux build bot + @skipIfLinux + @expectedFailureAll( + oslist=["linux"], + bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot") + @expectedFailureAll( + oslist=["freebsd"], + bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint") @expectedFailureAll(oslist=["windows"]) def test_step_all_threads(self): """Test thread step out on all threads via command interpreter. """ self.build(dictionary=self.getBuildFlags()) self.step_out_test(self.step_out_all_threads_with_cmd) - @skipIfLinux # Test occasionally times out on the Linux build bot - @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot") - @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint") + # Test occasionally times out on the Linux build bot + @skipIfLinux + @expectedFailureAll( + oslist=["linux"], + bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot") + @expectedFailureAll( + oslist=["freebsd"], + bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint") @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24681") def test_python(self): """Test thread step out on one thread via Python API (dwarf).""" @@ -48,43 +64,63 @@ class ThreadStepOutTestCase(TestBase): TestBase.setUp(self) # Find the line number for our breakpoint. self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - if "gcc" in self.getCompiler() or self.isIntelCompiler(): - self.step_out_destination = line_number('main.cpp', '// Expect to stop here after step-out (icc and gcc)') + if "gcc" in self.getCompiler() or self.isIntelCompiler(): + self.step_out_destination = line_number( + 'main.cpp', '// Expect to stop here after step-out (icc and gcc)') else: - self.step_out_destination = line_number('main.cpp', '// Expect to stop here after step-out (clang)') + self.step_out_destination = line_number( + 'main.cpp', '// Expect to stop here after step-out (clang)') def step_out_single_thread_with_cmd(self): self.step_out_with_cmd("this-thread") - self.expect("thread backtrace all", "Thread location after step out is correct", - substrs = ["main.cpp:%d" % self.step_out_destination, - "main.cpp:%d" % self.breakpoint]) + self.expect( + "thread backtrace all", + "Thread location after step out is correct", + substrs=[ + "main.cpp:%d" % + self.step_out_destination, + "main.cpp:%d" % + self.breakpoint]) def step_out_all_threads_with_cmd(self): self.step_out_with_cmd("all-threads") - self.expect("thread backtrace all", "Thread location after step out is correct", - substrs = ["main.cpp:%d" % self.step_out_destination]) + self.expect( + "thread backtrace all", + "Thread location after step out is correct", + substrs=[ + "main.cpp:%d" % + self.step_out_destination]) def step_out_with_cmd(self, run_mode): self.runCmd("thread select %d" % self.step_out_thread.GetIndexID()) self.runCmd("thread step-out -m %s" % run_mode) self.expect("process status", "Expected stop reason to be step-out", - substrs = ["stop reason = step out"]) + substrs=["stop reason = step out"]) - self.expect("thread list", "Selected thread did not change during step-out", - substrs = ["* thread #%d" % self.step_out_thread.GetIndexID()]) + self.expect( + "thread list", + "Selected thread did not change during step-out", + substrs=[ + "* thread #%d" % + self.step_out_thread.GetIndexID()]) def step_out_with_python(self): self.step_out_thread.StepOut() reason = self.step_out_thread.GetStopReason() - self.assertEqual(lldb.eStopReasonPlanComplete, reason, - "Expected thread stop reason 'plancomplete', but got '%s'" % lldbutil.stop_reason_to_str(reason)) + self.assertEqual( + lldb.eStopReasonPlanComplete, + reason, + "Expected thread stop reason 'plancomplete', but got '%s'" % + lldbutil.stop_reason_to_str(reason)) # Verify location after stepping out frame = self.step_out_thread.GetFrameAtIndex(0) desc = lldbutil.get_description(frame.GetLineEntry()) expect = "main.cpp:%d" % self.step_out_destination - self.assertTrue(expect in desc, "Expected %s but thread stopped at %s" % (expect, desc)) + self.assertTrue( + expect in desc, "Expected %s but thread stopped at %s" % + (expect, desc)) def step_out_test(self, step_out_func): """Test single thread step out of a function.""" @@ -92,11 +128,16 @@ class ThreadStepOutTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint in the main thread. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.breakpoint, num_expected_locations=1) # The breakpoint list should show 1 location. - self.expect("breakpoint list -f", "Breakpoint location shown correctly", - substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.breakpoint]) + self.expect( + "breakpoint list -f", + "Breakpoint location shown correctly", + substrs=[ + "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % + self.breakpoint]) # Run the program. self.runCmd("run", RUN_SUCCEEDED) @@ -107,7 +148,10 @@ class ThreadStepOutTestCase(TestBase): # Get the number of threads, ensure we see all three. num_threads = self.inferior_process.GetNumThreads() - self.assertEqual(num_threads, 3, 'Number of expected threads and actual threads do not match.') + self.assertEqual( + num_threads, + 3, + 'Number of expected threads and actual threads do not match.') (breakpoint_threads, other_threads) = ([], []) lldbutil.sort_stopped_threads(self.inferior_process, @@ -115,10 +159,12 @@ class ThreadStepOutTestCase(TestBase): other_threads=other_threads) while len(breakpoint_threads) < 2: - self.runCmd("thread continue %s" % " ".join([str(x.GetIndexID()) for x in other_threads])) - lldbutil.sort_stopped_threads(self.inferior_process, - breakpoint_threads=breakpoint_threads, - other_threads=other_threads) + self.runCmd("thread continue %s" % + " ".join([str(x.GetIndexID()) for x in other_threads])) + lldbutil.sort_stopped_threads( + self.inferior_process, + breakpoint_threads=breakpoint_threads, + other_threads=other_threads) self.step_out_thread = breakpoint_threads[0] @@ -129,4 +175,5 @@ class ThreadStepOutTestCase(TestBase): self.runCmd("continue") # At this point, the inferior process should have exited. - self.assertTrue(self.inferior_process.GetState() == lldb.eStateExited, PROCESS_EXITED) + self.assertTrue(self.inferior_process.GetState() == + lldb.eStateExited, PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/step_until/Makefile new file mode 100644 index 000000000000..b09a579159d4 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/step_until/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +C_SOURCES := main.c + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py b/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py new file mode 100644 index 000000000000..ec34c9985d3e --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py @@ -0,0 +1,92 @@ +"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" + +from __future__ import print_function + + +import os +import time +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestCStepping(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def getCategories(self): + return ['basic_process'] + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + # Find the line numbers that we will step to in main: + self.main_source = "main.c" + self.less_than_two = line_number('main.c', 'Less than 2') + self.greater_than_two = line_number('main.c', 'Greater than or equal to 2.') + self.back_out_in_main = line_number('main.c', 'Back out in main') + + def do_until (self, args, until_lines, expected_linenum): + self.build() + exe = os.path.join(os.getcwd(), "a.out") + + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + main_source_spec = lldb.SBFileSpec(self.main_source) + break_before = target.BreakpointCreateBySourceRegex( + 'At the start', + main_source_spec) + self.assertTrue(break_before, VALID_BREAKPOINT) + + # Now launch the process, and do not stop at entry point. + process = target.LaunchSimple( + args, None, self.get_process_working_directory()) + + self.assertTrue(process, PROCESS_IS_VALID) + + # The stop reason of the thread should be breakpoint. + threads = lldbutil.get_threads_stopped_at_breakpoint( + process, break_before) + + if len(threads) != 1: + self.fail("Failed to stop at first breakpoint in main.") + + thread = threads[0] + return thread + + thread = self.common_setup(None) + + cmd_interp = self.dbg.GetCommandInterpreter() + ret_obj = lldb.SBCommandReturnObject() + + cmd_line = "thread until" + for line_num in until_lines: + cmd_line += " %d"%(line_num) + + cmd_interp.HandleCommand(cmd_line, ret_obj) + self.assertTrue(ret_obj.Succeeded(), "'%s' failed: %s."%(cmd_line, ret_obj.GetError())) + + frame = thread.frames[0] + line = frame.GetLineEntry().GetLine() + self.assertEqual(line, expected_linenum, 'Did not get the expected stop line number') + + def test_hitting_one (self): + """Test thread step until - targeting one line and hitting it.""" + self.do_until(None, [self.less_than_two], self.less_than_two) + + def test_targetting_two_hitting_first (self): + """Test thread step until - targeting two lines and hitting one.""" + self.do_until(["foo", "bar", "baz"], [self.less_than_two, self.greater_than_two], self.greater_than_two) + + def test_targetting_two_hitting_second (self): + """Test thread step until - targeting two lines and hitting the other one.""" + self.do_until(None, [self.less_than_two, self.greater_than_two], self.less_than_two) + + def test_missing_one (self): + """Test thread step until - targeting one line and missing it.""" + self.do_until(["foo", "bar", "baz"], [self.less_than_two], self.back_out_in_main) + + + diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/main.c b/packages/Python/lldbsuite/test/functionalities/thread/step_until/main.c new file mode 100644 index 000000000000..e0b4d8ab951e --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/thread/step_until/main.c @@ -0,0 +1,20 @@ +#include <stdio.h> + +void call_me(int argc) +{ + printf ("At the start, argc: %d.\n", argc); + + if (argc < 2) + printf("Less than 2.\n"); + else + printf("Greater than or equal to 2.\n"); +} + +int +main(int argc, char **argv) +{ + call_me(argc); + printf("Back out in main.\n"); + + return 0; +} diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py b/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py index 2ba6f2e57f2b..deedc4b7507a 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py @@ -5,12 +5,13 @@ Test number of threads. from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil + class ThreadExitTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -31,17 +32,28 @@ class ThreadExitTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # This should create a breakpoint with 1 location. - bp1_id = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1) - bp2_id = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1) - bp3_id = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_3, num_expected_locations=1) - bp4_id = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_4, num_expected_locations=1) + bp1_id = lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_1, num_expected_locations=1) + bp2_id = lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_2, num_expected_locations=1) + bp3_id = lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_3, num_expected_locations=1) + bp4_id = lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.break_4, num_expected_locations=1) # The breakpoint list should show 1 locations. - self.expect("breakpoint list -f", "Breakpoint location shown correctly", - substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.break_1, - "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.break_2, - "3: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.break_3, - "4: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.break_4]) + self.expect( + "breakpoint list -f", + "Breakpoint location shown correctly", + substrs=[ + "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % + self.break_1, + "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % + self.break_2, + "3: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % + self.break_3, + "4: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % + self.break_4]) # Run the program. self.runCmd("run", RUN_SUCCEEDED) @@ -49,39 +61,59 @@ class ThreadExitTestCase(TestBase): target = self.dbg.GetSelectedTarget() process = target.GetProcess() - stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(process, bp1_id) - self.assertIsNotNone(stopped_thread, "Process is not stopped at breakpoint 1") + stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id( + process, bp1_id) + self.assertIsNotNone(stopped_thread, + "Process is not stopped at breakpoint 1") # Get the number of threads num_threads = process.GetNumThreads() - self.assertGreaterEqual(num_threads, 2, 'Number of expected threads and actual threads do not match at breakpoint 1.') + self.assertGreaterEqual( + num_threads, + 2, + 'Number of expected threads and actual threads do not match at breakpoint 1.') # Run to the second breakpoint self.runCmd("continue") - stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(process, bp2_id) - self.assertIsNotNone(stopped_thread, "Process is not stopped at breakpoint 2") + stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id( + process, bp2_id) + self.assertIsNotNone(stopped_thread, + "Process is not stopped at breakpoint 2") # Update the number of threads new_num_threads = process.GetNumThreads() - self.assertEqual(new_num_threads, num_threads+1, 'Number of expected threads did not increase by 1 at bp 2.') + self.assertEqual( + new_num_threads, + num_threads + 1, + 'Number of expected threads did not increase by 1 at bp 2.') # Run to the third breakpoint self.runCmd("continue") - stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(process, bp3_id) - self.assertIsNotNone(stopped_thread, "Process is not stopped at breakpoint 3") + stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id( + process, bp3_id) + self.assertIsNotNone(stopped_thread, + "Process is not stopped at breakpoint 3") # Update the number of threads new_num_threads = process.GetNumThreads() - self.assertEqual(new_num_threads, num_threads, 'Number of expected threads is not equal to original number of threads at bp 3.') + self.assertEqual( + new_num_threads, + num_threads, + 'Number of expected threads is not equal to original number of threads at bp 3.') # Run to the fourth breakpoint self.runCmd("continue") - stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(process, bp4_id) - self.assertIsNotNone(stopped_thread, "Process is not stopped at breakpoint 4") + stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id( + process, bp4_id) + self.assertIsNotNone(stopped_thread, + "Process is not stopped at breakpoint 4") # Update the number of threads new_num_threads = process.GetNumThreads() - self.assertEqual(new_num_threads, num_threads-1, 'Number of expected threads did not decrease by 1 at bp 4.') + self.assertEqual( + new_num_threads, + num_threads - 1, + 'Number of expected threads did not decrease by 1 at bp 4.') # Run to completion self.runCmd("continue") diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py index 12bacabd0d78..0377b0c0a80e 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py @@ -5,14 +5,15 @@ Test that we obey thread conditioned breakpoints. from __future__ import print_function - -import os, time +import os +import time import re import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class ThreadSpecificBreakTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -30,24 +31,42 @@ class ThreadSpecificBreakTestCase(TestBase): # This test works by setting a breakpoint in a function conditioned to stop only on # the main thread, and then calling this function on a secondary thread, joining, # and then calling again on the main thread. If the thread specific breakpoint works - # then it should not be hit on the secondary thread, only on the main thread. - - main_source_spec = lldb.SBFileSpec ("main.cpp") - - main_breakpoint = target.BreakpointCreateBySourceRegex("Set main breakpoint here", main_source_spec); - thread_breakpoint = target.BreakpointCreateBySourceRegex("Set thread-specific breakpoint here", main_source_spec) - - self.assertTrue(main_breakpoint.IsValid(), "Failed to set main breakpoint.") - self.assertGreater(main_breakpoint.GetNumLocations(), 0, "main breakpoint has no locations associated with it.") - self.assertTrue(thread_breakpoint.IsValid(), "Failed to set thread breakpoint.") - self.assertGreater(thread_breakpoint.GetNumLocations(), 0, "thread breakpoint has no locations associated with it.") - - process = target.LaunchSimple (None, None, self.get_process_working_directory()) + # then it should not be hit on the secondary thread, only on the main + # thread. + + main_source_spec = lldb.SBFileSpec("main.cpp") + + main_breakpoint = target.BreakpointCreateBySourceRegex( + "Set main breakpoint here", main_source_spec) + thread_breakpoint = target.BreakpointCreateBySourceRegex( + "Set thread-specific breakpoint here", main_source_spec) + + self.assertTrue( + main_breakpoint.IsValid(), + "Failed to set main breakpoint.") + self.assertGreater( + main_breakpoint.GetNumLocations(), + 0, + "main breakpoint has no locations associated with it.") + self.assertTrue( + thread_breakpoint.IsValid(), + "Failed to set thread breakpoint.") + self.assertGreater( + thread_breakpoint.GetNumLocations(), + 0, + "thread breakpoint has no locations associated with it.") + + process = target.LaunchSimple( + None, None, self.get_process_working_directory()) self.assertTrue(process, PROCESS_IS_VALID) - stopped_threads = lldbutil.get_threads_stopped_at_breakpoint(process, main_breakpoint) - self.assertEqual(len(stopped_threads), 1, "main breakpoint stopped at unexpected number of threads") + stopped_threads = lldbutil.get_threads_stopped_at_breakpoint( + process, main_breakpoint) + self.assertEqual( + len(stopped_threads), + 1, + "main breakpoint stopped at unexpected number of threads") main_thread = stopped_threads[0] main_thread_id = main_thread.GetThreadID() @@ -58,7 +77,17 @@ class ThreadSpecificBreakTestCase(TestBase): process.Continue() next_stop_state = process.GetState() - self.assertEqual(next_stop_state, lldb.eStateStopped, "We should have stopped at the thread breakpoint.") - stopped_threads = lldbutil.get_threads_stopped_at_breakpoint(process, thread_breakpoint) - self.assertEqual(len(stopped_threads), 1, "thread breakpoint stopped at unexpected number of threads") - self.assertEqual(stopped_threads[0].GetThreadID(), main_thread_id, "thread breakpoint stopped at the wrong thread") + self.assertEqual( + next_stop_state, + lldb.eStateStopped, + "We should have stopped at the thread breakpoint.") + stopped_threads = lldbutil.get_threads_stopped_at_breakpoint( + process, thread_breakpoint) + self.assertEqual( + len(stopped_threads), + 1, + "thread breakpoint stopped at unexpected number of threads") + self.assertEqual( + stopped_threads[0].GetThreadID(), + main_thread_id, + "thread breakpoint stopped at the wrong thread") diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py index ccb58c965b3f..da9ba59f9924 100644 --- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py +++ b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py @@ -6,20 +6,23 @@ conditioned breakpoints simultaneously from __future__ import print_function - -import os, time +import os +import time import re import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class ThreadSpecificBreakPlusConditionTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIfFreeBSD # test frequently times out or hangs - @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr18522') # hits break in another thread in testrun + # test frequently times out or hangs + @skipIf(oslist=['windows', 'freebsd']) + # hits break in another thread in testrun + @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr18522') @add_test_categories(['pyapi']) def test_python(self): """Test that we obey thread conditioned breakpoints.""" @@ -29,18 +32,24 @@ class ThreadSpecificBreakPlusConditionTestCase(TestBase): target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) - main_source_spec = lldb.SBFileSpec ("main.cpp") + main_source_spec = lldb.SBFileSpec("main.cpp") - # Set a breakpoint in the thread body, and make it active for only the first thread. - break_thread_body = target.BreakpointCreateBySourceRegex ("Break here in thread body.", main_source_spec) - self.assertTrue (break_thread_body.IsValid() and break_thread_body.GetNumLocations() > 0, "Failed to set thread body breakpoint.") + # Set a breakpoint in the thread body, and make it active for only the + # first thread. + break_thread_body = target.BreakpointCreateBySourceRegex( + "Break here in thread body.", main_source_spec) + self.assertTrue( + break_thread_body.IsValid() and break_thread_body.GetNumLocations() > 0, + "Failed to set thread body breakpoint.") - process = target.LaunchSimple (None, None, self.get_process_working_directory()) + process = target.LaunchSimple( + None, None, self.get_process_working_directory()) self.assertTrue(process, PROCESS_IS_VALID) - threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_thread_body) - + threads = lldbutil.get_threads_stopped_at_breakpoint( + process, break_thread_body) + victim_thread = threads[0] # Pick one of the threads, and change the breakpoint so it ONLY stops for this thread, @@ -51,14 +60,18 @@ class ThreadSpecificBreakPlusConditionTestCase(TestBase): frame = victim_thread.GetFrameAtIndex(0) value = frame.FindVariable("my_value").GetValueAsSigned(0) - self.assertTrue (value > 0 and value < 11, "Got a reasonable value for my_value.") + self.assertTrue( + value > 0 and value < 11, + "Got a reasonable value for my_value.") - cond_string = "my_value != %d"%(value) + cond_string = "my_value != %d" % (value) break_thread_body.SetThreadID(victim_thread.GetThreadID()) - break_thread_body.SetCondition (cond_string) + break_thread_body.SetCondition(cond_string) process.Continue() next_stop_state = process.GetState() - self.assertTrue (next_stop_state == lldb.eStateExited, "We should have not hit the breakpoint again.") + self.assertTrue( + next_stop_state == lldb.eStateExited, + "We should have not hit the breakpoint again.") |