summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-10-28 17:43:26 +0000
committerZachary Turner <zturner@google.com>2015-10-28 17:43:26 +0000
commitc432c8f856e0bd84de980a9d9bb2d31b06fa95b1 (patch)
tree4efa528e074a6e2df782345e4cd97f5d85d038c4 /lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
parenta8a3bd210086b50242903ed95048fe5e53897878 (diff)
downloadbcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.tar.gz
bcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.zip
Move lldb/test to lldb/packages/Python/lldbsuite/test.
This is the conclusion of an effort to get LLDB's Python code structured into a bona-fide Python package. This has a number of benefits, but most notably the ability to more easily share Python code between different but related pieces of LLDB's Python infrastructure (for example, `scripts` can now share code with `test`). llvm-svn: 251532
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py92
1 files changed, 92 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py b/lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
new file mode 100644
index 00000000000..7edaf1a9623
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
@@ -0,0 +1,92 @@
+"""Test the lldb public C++ api breakpoint callbacks."""
+
+from __future__ import print_function
+
+import use_lldb_suite
+
+import os, re
+from lldbtest import *
+import lldbutil
+import subprocess
+
+class SBBreakpointCallbackCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipIfRemote
+ @skipIfNoSBHeaders
+ @skipIfWindows # clang-cl does not support throw or catch (llvm.org/pr24538)
+ @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.9"], archs=["x86_64"])
+ def test_breakpoint_callback(self):
+ """Test the that SBBreakpoint callback is invoked when a breakpoint is hit. """
+ self.build_and_test('driver.cpp test_breakpoint_callback.cpp',
+ 'test_breakpoint_callback')
+
+ @skipIfRemote
+ @skipIfNoSBHeaders
+ @skipIfWindows # clang-cl does not support throw or catch (llvm.org/pr24538)
+ @expectedFlakeyFreeBSD
+ @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.9"], archs=["x86_64"])
+ def test_sb_api_listener_event_description(self):
+ """ Test the description of an SBListener breakpoint event is valid."""
+ self.build_and_test('driver.cpp listener_test.cpp test_listener_event_description.cpp',
+ 'test_listener_event_description')
+ pass
+
+ @skipIfRemote
+ @skipIfNoSBHeaders
+ @skipIfWindows # clang-cl does not support throw or catch (llvm.org/pr24538)
+ @expectedFlakeyFreeBSD
+ @expectedFlakeyLinux # Driver occasionally returns '1' as exit status
+ @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.9"], archs=["x86_64"])
+ def test_sb_api_listener_event_process_state(self):
+ """ Test that a registered SBListener receives events when a process
+ changes state.
+ """
+ self.build_and_test('driver.cpp listener_test.cpp test_listener_event_process_state.cpp',
+ 'test_listener_event_process_state')
+ pass
+
+
+ @skipIfRemote
+ @skipIfNoSBHeaders
+ @skipIfWindows # clang-cl does not support throw or catch (llvm.org/pr24538)
+ @expectedFlakeyFreeBSD
+ @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.8"], archs=["x86_64"])
+ def test_sb_api_listener_resume(self):
+ """ Test that a process can be resumed from a non-main thread. """
+ self.build_and_test('driver.cpp listener_test.cpp test_listener_resume.cpp',
+ 'test_listener_resume')
+ pass
+
+ def build_and_test(self, sources, test_name, args = None):
+ """ Build LLDB test from sources, and run expecting 0 exit code """
+
+ # These tests link against host lldb API.
+ # Compiler's target triple must match liblldb triple
+ # because remote is disabled, we can assume that the os is the same
+ # still need to check architecture
+ if self.getLldbArchitecture() != self.getArchitecture():
+ self.skipTest("This test is only run if the target arch is the same as the lldb binary arch")
+
+ self.inferior = 'inferior_program'
+ self.buildProgram('inferior.cpp', self.inferior)
+ self.addTearDownHook(lambda: os.remove(self.inferior))
+
+ self.buildDriver(sources, test_name)
+ self.addTearDownHook(lambda: os.remove(test_name))
+
+ test_exe = os.path.join(os.getcwd(), test_name)
+ self.signBinary(test_exe)
+ exe = [test_exe, self.inferior]
+
+ env = {self.dylibPath : self.getLLDBLibraryEnvVal()}
+ if self.TraceOn():
+ print("Running test %s" % " ".join(exe))
+ check_call(exe, env=env)
+ else:
+ with open(os.devnull, 'w') as fnull:
+ check_call(exe, env=env, stdout=fnull, stderr=fnull)
+
+ def build_program(self, sources, program):
+ return self.buildDriver(sources, program)
OpenPOWER on IntegriCloud