diff options
author | Zachary Turner <zturner@google.com> | 2015-10-22 20:06:20 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-10-22 20:06:20 +0000 |
commit | 77db4a855239049488e09f28c6665fdb3b51ef90 (patch) | |
tree | 11f22a87f27e28b3a71914ee3d80a039a79d2c9a /lldb/test/functionalities/thread | |
parent | bd832d513156cea8645f1c3da1296f791edfbbab (diff) | |
download | bcm5719-llvm-77db4a855239049488e09f28c6665fdb3b51ef90.tar.gz bcm5719-llvm-77db4a855239049488e09f28c6665fdb3b51ef90.zip |
Update every test to import `lldb_shared`.
This is necessary in order to allow third party modules to be
located under lldb/third_party rather than under the test
folder directly.
Since we're already touching every test file anyway, we also
go ahead and delete the unittest2 import and main block wherever
possible. The ability to run a test as a standalone file has
already been broken for some time, and if we decide we want this
back, we should use unittest instead of unittest2.
A few places could not have the import of unittest2 removed,because
they depend on the unittest2.expectedFailure or skip decorators.
Removing all those was orthogonal in spirit to the purpose of this
CL, so the import of unittest2 remains in those files that were
using it for its test decorators. Those can be addressed
separately.
llvm-svn: 251055
Diffstat (limited to 'lldb/test/functionalities/thread')
14 files changed, 30 insertions, 102 deletions
diff --git a/lldb/test/functionalities/thread/TestNumThreads.py b/lldb/test/functionalities/thread/TestNumThreads.py index 65ca699332f..8a2ad59e258 100644 --- a/lldb/test/functionalities/thread/TestNumThreads.py +++ b/lldb/test/functionalities/thread/TestNumThreads.py @@ -2,8 +2,9 @@ Test number of threads. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -48,9 +49,3 @@ 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.') - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py b/lldb/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py index e149f361ea0..462314b735d 100644 --- a/lldb/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py +++ b/lldb/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py @@ -2,8 +2,9 @@ Test number of threads. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -72,9 +73,3 @@ class BreakpointAfterJoinTestCase(TestBase): # At this point, the inferior process should have exited. self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py b/lldb/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py index 149d6a22bc8..3fa1b4968bc 100644 --- a/lldb/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py +++ b/lldb/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py @@ -10,8 +10,10 @@ until exit or a crash takes place, and the number of events seen by LLDB is verified to match the expected number of events. """ -import os, time +import lldb_shared + import unittest2 +import os, time import lldb from lldbtest import * import lldbutil @@ -484,10 +486,3 @@ class ConcurrentEventsTestCase(TestBase): 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)) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py b/lldb/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py index e196fa29429..89eccfdccf7 100644 --- a/lldb/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py +++ b/lldb/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py @@ -2,8 +2,9 @@ Test that step-inst over a crash behaves correctly. """ +import lldb_shared + import os -import unittest2 import lldb from lldbtest import * import lldbutil @@ -47,10 +48,3 @@ class CreateDuringStepTestCase(TestBase): self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) self.assertTrue(lldbutil.is_thread_crashed(self, thread), "Thread has crashed") process.Kill() - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py b/lldb/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py index 51bc26f9d0e..d91f8d5d4eb 100644 --- a/lldb/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py +++ b/lldb/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py @@ -2,8 +2,9 @@ Test thread creation after process attach. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -115,10 +116,3 @@ class CreateAfterAttachTestCase(TestBase): # At this point, the inferior process should have exited. self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/create_during_step/TestCreateDuringStep.py b/lldb/test/functionalities/thread/create_during_step/TestCreateDuringStep.py index 76fbc1559ba..a5ceae3dacd 100644 --- a/lldb/test/functionalities/thread/create_during_step/TestCreateDuringStep.py +++ b/lldb/test/functionalities/thread/create_during_step/TestCreateDuringStep.py @@ -2,8 +2,9 @@ Test number of threads. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -122,9 +123,3 @@ class CreateDuringStepTestCase(TestBase): # At this point, the inferior process should have exited. self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py b/lldb/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py index cecc5d91f78..dc1d4dca9b0 100644 --- a/lldb/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py +++ b/lldb/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py @@ -2,8 +2,9 @@ Test number of threads. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -76,9 +77,3 @@ class ExitDuringBreakpointTestCase(TestBase): # At this point, the inferior process should have exited. self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/exit_during_step/TestExitDuringStep.py b/lldb/test/functionalities/thread/exit_during_step/TestExitDuringStep.py index a69bb7f2a76..30ca8fe9025 100644 --- a/lldb/test/functionalities/thread/exit_during_step/TestExitDuringStep.py +++ b/lldb/test/functionalities/thread/exit_during_step/TestExitDuringStep.py @@ -2,8 +2,9 @@ Test number of threads. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -138,9 +139,3 @@ class ExitDuringStepTestCase(TestBase): # At this point, the inferior process should have exited. self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/jump/TestThreadJump.py b/lldb/test/functionalities/thread/jump/TestThreadJump.py index 3919a242127..a9b06863a72 100644 --- a/lldb/test/functionalities/thread/jump/TestThreadJump.py +++ b/lldb/test/functionalities/thread/jump/TestThreadJump.py @@ -2,8 +2,9 @@ Test jumping to different places. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -55,9 +56,3 @@ class ThreadJumpTestCase(TestBase): 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 - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py b/lldb/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py index cf6cda62a30..3afd6a22475 100644 --- a/lldb/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py +++ b/lldb/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py @@ -2,8 +2,9 @@ Test number of threads. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -72,9 +73,3 @@ class MultipleBreakpointTestCase(TestBase): # At this point, the inferior process should have exited. self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/state/TestThreadStates.py b/lldb/test/functionalities/thread/state/TestThreadStates.py index e1f29a40b05..06225f1eefc 100644 --- a/lldb/test/functionalities/thread/state/TestThreadStates.py +++ b/lldb/test/functionalities/thread/state/TestThreadStates.py @@ -2,8 +2,10 @@ Test thread states. """ -import os, time +import lldb_shared + import unittest2 +import os, time import lldb from lldbtest import * import lldbutil @@ -340,9 +342,3 @@ class ThreadStateTestCase(TestBase): # At this point, the inferior process should have exited. self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/step_out/TestThreadStepOut.py b/lldb/test/functionalities/thread/step_out/TestThreadStepOut.py index 96a62e3ddca..3100b361d16 100644 --- a/lldb/test/functionalities/thread/step_out/TestThreadStepOut.py +++ b/lldb/test/functionalities/thread/step_out/TestThreadStepOut.py @@ -2,8 +2,9 @@ Test stepping out from a function in a multi-threaded program. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -126,9 +127,3 @@ class ThreadStepOutTestCase(TestBase): # At this point, the inferior process should have exited. self.assertTrue(self.inferior_process.GetState() == lldb.eStateExited, PROCESS_EXITED) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/thread_exit/TestThreadExit.py b/lldb/test/functionalities/thread/thread_exit/TestThreadExit.py index 99f7ac63b20..39797651e79 100644 --- a/lldb/test/functionalities/thread/thread_exit/TestThreadExit.py +++ b/lldb/test/functionalities/thread/thread_exit/TestThreadExit.py @@ -2,8 +2,9 @@ Test number of threads. """ +import lldb_shared + import os, time -import unittest2 import lldb from lldbtest import * import lldbutil @@ -112,9 +113,3 @@ class ThreadExitTestCase(TestBase): # At this point, the inferior process should have exited. self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() diff --git a/lldb/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py b/lldb/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py index 1c22ae858a0..0c2c884cf6c 100644 --- a/lldb/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py +++ b/lldb/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py @@ -2,9 +2,10 @@ Test that we obey thread conditioned breakpoints. """ +import lldb_shared + import os, time import re -import unittest2 import lldb, lldbutil from lldbtest import * @@ -59,10 +60,3 @@ class ThreadSpecificBreakTestCase(TestBase): next_stop_state = process.GetState() self.assertTrue (next_stop_state == lldb.eStateExited, "We should have not hit the breakpoint again.") - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() |