diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 |
commit | 14f1b3e8826ce43b978db93a62d1166055db5394 (patch) | |
tree | 0a00ad8d3498783fe0193f3b656bca17c4c8697d /packages/Python/lldbsuite/test/api/multithreaded | |
parent | 4ee8c119c71a06dcad1e0fecc8c675e480e59337 (diff) |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/api/multithreaded')
-rw-r--r-- | packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py | 49 | ||||
-rw-r--r-- | packages/Python/lldbsuite/test/api/multithreaded/driver.cpp.template (renamed from packages/Python/lldbsuite/test/api/multithreaded/driver.cpp) | 12 | ||||
-rw-r--r-- | packages/Python/lldbsuite/test/api/multithreaded/listener_test.cpp.template (renamed from packages/Python/lldbsuite/test/api/multithreaded/listener_test.cpp) | 2 | ||||
-rw-r--r-- | packages/Python/lldbsuite/test/api/multithreaded/lldb-headers.h | 11 | ||||
-rw-r--r-- | packages/Python/lldbsuite/test/api/multithreaded/test_breakpoint_callback.cpp.template (renamed from packages/Python/lldbsuite/test/api/multithreaded/test_breakpoint_callback.cpp) | 2 | ||||
-rw-r--r-- | packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_description.cpp.template (renamed from packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_description.cpp) | 2 | ||||
-rw-r--r-- | packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp.template (renamed from packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp) | 7 | ||||
-rw-r--r-- | packages/Python/lldbsuite/test/api/multithreaded/test_listener_resume.cpp.template (renamed from packages/Python/lldbsuite/test/api/multithreaded/test_listener_resume.cpp) | 2 |
8 files changed, 54 insertions, 33 deletions
diff --git a/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py b/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py index 7959bb73de020..0d6a6002d5221 100644 --- a/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py +++ b/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py @@ -5,19 +5,31 @@ from __future__ import print_function # __package__ = "lldbsuite.test" -import os, re +import os +import re from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil import subprocess + class SBBreakpointCallbackCase(TestBase): + def setUp(self): + TestBase.setUp(self) + self.generateSource('driver.cpp') + self.generateSource('listener_test.cpp') + self.generateSource('test_breakpoint_callback.cpp') + self.generateSource('test_listener_event_description.cpp') + self.generateSource('test_listener_event_process_state.cpp') + self.generateSource('test_listener_resume.cpp') + mydir = TestBase.compute_mydir(__file__) @skipIfRemote @skipIfNoSBHeaders - @skipIfWindows # clang-cl does not support throw or catch (llvm.org/pr24538) + # clang-cl does not support throw or catch (llvm.org/pr24538) + @skipIfWindows 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', @@ -25,40 +37,44 @@ class SBBreakpointCallbackCase(TestBase): @skipIfRemote @skipIfNoSBHeaders - @skipIfWindows # clang-cl does not support throw or catch (llvm.org/pr24538) + # clang-cl does not support throw or catch (llvm.org/pr24538) + @skipIfWindows @expectedFlakeyFreeBSD 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') + 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) + # clang-cl does not support throw or catch (llvm.org/pr24538) + @skipIfWindows @expectedFlakeyFreeBSD - @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') + 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) + # clang-cl does not support throw or catch (llvm.org/pr24538) + @skipIfWindows @expectedFlakeyFreeBSD @expectedFailureAll(oslist=["linux"]) 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') + 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): + 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. @@ -66,7 +82,8 @@ class SBBreakpointCallbackCase(TestBase): # 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.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) @@ -79,7 +96,7 @@ class SBBreakpointCallbackCase(TestBase): self.signBinary(test_exe) exe = [test_exe, self.inferior] - env = {self.dylibPath : self.getLLDBLibraryEnvVal()} + env = {self.dylibPath: self.getLLDBLibraryEnvVal()} if self.TraceOn(): print("Running test %s" % " ".join(exe)) check_call(exe, env=env) diff --git a/packages/Python/lldbsuite/test/api/multithreaded/driver.cpp b/packages/Python/lldbsuite/test/api/multithreaded/driver.cpp.template index fa0c48e0ecfbe..f4bd021632cec 100644 --- a/packages/Python/lldbsuite/test/api/multithreaded/driver.cpp +++ b/packages/Python/lldbsuite/test/api/multithreaded/driver.cpp.template @@ -6,8 +6,11 @@ #include <iterator> #include <string> #include <vector> +#if !defined(_MSC_VER) + #include <signal.h> +#endif -#include "lldb-headers.h" +%include_SB_APIs% #include "common.h" @@ -17,6 +20,13 @@ using namespace lldb; void test(SBDebugger &dbg, std::vector<string> args); int main(int argc, char** argv) { + +// Ignore SIGPIPE. The lldb driver does this as well, +// because we seem to get spurious SIGPIPES on some +// Unixen that take the driver down. +#if !defined(_MSC_VER) + signal(SIGPIPE, SIG_IGN); +#endif int code = 0; SBDebugger::Initialize(); diff --git a/packages/Python/lldbsuite/test/api/multithreaded/listener_test.cpp b/packages/Python/lldbsuite/test/api/multithreaded/listener_test.cpp.template index b20868ff94f4a..e305d1af4893f 100644 --- a/packages/Python/lldbsuite/test/api/multithreaded/listener_test.cpp +++ b/packages/Python/lldbsuite/test/api/multithreaded/listener_test.cpp.template @@ -7,7 +7,7 @@ #include <thread> #include <vector> -#include "lldb-headers.h" +%include_SB_APIs% #include "common.h" using namespace lldb; diff --git a/packages/Python/lldbsuite/test/api/multithreaded/lldb-headers.h b/packages/Python/lldbsuite/test/api/multithreaded/lldb-headers.h deleted file mode 100644 index da0914b3b0716..0000000000000 --- a/packages/Python/lldbsuite/test/api/multithreaded/lldb-headers.h +++ /dev/null @@ -1,11 +0,0 @@ - -#ifndef LLDB_HEADERS_H -#define LLDB_HEADERS_H - -#ifdef __APPLE__ -#include <LLDB/LLDB.h> -#else -#include "lldb/API/LLDB.h" -#endif - -#endif // LLDB_HEADERS_H diff --git a/packages/Python/lldbsuite/test/api/multithreaded/test_breakpoint_callback.cpp b/packages/Python/lldbsuite/test/api/multithreaded/test_breakpoint_callback.cpp.template index def31f82b0c7a..4133025aa495a 100644 --- a/packages/Python/lldbsuite/test/api/multithreaded/test_breakpoint_callback.cpp +++ b/packages/Python/lldbsuite/test/api/multithreaded/test_breakpoint_callback.cpp.template @@ -7,7 +7,7 @@ #include <vector> #include <string> -#include "lldb-headers.h" +%include_SB_APIs% #include "common.h" diff --git a/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_description.cpp b/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_description.cpp.template index 0d7844dce6d09..63e3f3631e5d2 100644 --- a/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_description.cpp +++ b/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_description.cpp.template @@ -8,7 +8,7 @@ #include <string> #include <thread> -#include "lldb-headers.h" +%include_SB_APIs% #include "common.h" diff --git a/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp b/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp.template index a79c5cb2a08bc..2926ece4d8d92 100644 --- a/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp +++ b/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp.template @@ -8,7 +8,7 @@ #include <string> #include <thread> -#include "lldb-headers.h" +%include_SB_APIs% #include "common.h" @@ -31,6 +31,11 @@ void listener_func() { throw Exception("event is not valid in listener thread"); // send process description SBProcess process = SBProcess::GetProcessFromEvent(event); + if (!process.IsValid()) + throw Exception("process is not valid"); + if (SBProcess::GetStateFromEvent(event) != lldb::eStateStopped || SBProcess::GetRestartedFromEvent(event)) + continue; // Only interested in "stopped" events. + SBStream description; for (int i = 0; i < process.GetNumThreads(); ++i) { diff --git a/packages/Python/lldbsuite/test/api/multithreaded/test_listener_resume.cpp b/packages/Python/lldbsuite/test/api/multithreaded/test_listener_resume.cpp.template index 8cf786b116033..4adc9b3388793 100644 --- a/packages/Python/lldbsuite/test/api/multithreaded/test_listener_resume.cpp +++ b/packages/Python/lldbsuite/test/api/multithreaded/test_listener_resume.cpp.template @@ -8,7 +8,7 @@ #include <string> #include <thread> -#include "lldb-headers.h" +%include_SB_APIs% #include "common.h" |