summaryrefslogtreecommitdiffstats
path: root/packages/Python/lldbsuite/test/python_api
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/python_api')
-rw-r--r--packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py24
-rw-r--r--packages/Python/lldbsuite/test/python_api/event/TestEvents.py4
-rw-r--r--packages/Python/lldbsuite/test/python_api/hello_world/main.c23
-rw-r--r--packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py2
-rw-r--r--packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py2
6 files changed, 27 insertions, 29 deletions
diff --git a/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py b/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
index 20333ab..31ba449 100644
--- a/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
+++ b/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
@@ -21,11 +21,18 @@ class DisassembleRawDataTestCase(TestBase):
def test_disassemble_raw_data(self):
"""Test disassembling raw bytes with the API."""
# Create a target from the debugger.
- target = self.dbg.CreateTargetWithFileAndTargetTriple ("", "x86_64")
+ arch = self.getArchitecture()
+ if re.match("mips*el",arch):
+ target = self.dbg.CreateTargetWithFileAndTargetTriple ("", "mipsel")
+ raw_bytes = bytearray([0x21,0xf0, 0xa0, 0x03])
+ elif re.match("mips",arch):
+ target = self.dbg.CreateTargetWithFileAndTargetTriple ("", "mips")
+ raw_bytes = bytearray([0x03,0xa0, 0xf0, 0x21])
+ else:
+ target = self.dbg.CreateTargetWithFileAndTargetTriple ("", "x86_64")
+ raw_bytes = bytearray([0x48, 0x89, 0xe5])
+
self.assertTrue(target, VALID_TARGET)
-
- raw_bytes = bytearray([0x48, 0x89, 0xe5])
-
insts = target.GetInstructions(lldb.SBAddress(0, target), raw_bytes)
inst = insts.GetInstructionAtIndex(0)
@@ -34,6 +41,9 @@ class DisassembleRawDataTestCase(TestBase):
print()
print("Raw bytes: ", [hex(x) for x in raw_bytes])
print("Disassembled%s" % str(inst))
-
- self.assertTrue (inst.GetMnemonic(target) == "movq")
- self.assertTrue (inst.GetOperands(target) == '%' + "rsp, " + '%' + "rbp")
+ if re.match("mips",arch):
+ self.assertTrue (inst.GetMnemonic(target) == "move")
+ self.assertTrue (inst.GetOperands(target) == '$' + "fp, " + '$' + "sp")
+ else:
+ self.assertTrue (inst.GetMnemonic(target) == "movq")
+ self.assertTrue (inst.GetOperands(target) == '%' + "rsp, " + '%' + "rbp")
diff --git a/packages/Python/lldbsuite/test/python_api/event/TestEvents.py b/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
index 0a1a0df..51c924b 100644
--- a/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
+++ b/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
@@ -13,6 +13,7 @@ import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
@skipIfDarwin # llvm.org/pr25924, sometimes generating SIGSEGV
+@skipIfLinux # llvm.org/pr25924, sometimes generating SIGSEGV
class EventAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,7 +26,6 @@ class EventAPITestCase(TestBase):
@add_test_categories(['pyapi'])
@expectedFailureLinux("llvm.org/pr23730") # Flaky, fails ~1/10 cases
- @skipIfLinux # skip to avoid crashes
def test_listen_for_and_print_event(self):
"""Exercise SBEvent API."""
self.build()
@@ -176,7 +176,7 @@ class EventAPITestCase(TestBase):
@skipIfFreeBSD # llvm.org/pr21325
@add_test_categories(['pyapi'])
- @expectedFlakeyLinux("llvm.org/pr23617") # Flaky, fails ~1/10 cases
+ @expectedFailureLinux("llvm.org/pr23617") # Flaky, fails ~1/10 cases
@expectedFailureWindows("llvm.org/pr24778")
def test_add_listener_to_broadcaster(self):
"""Exercise some SBBroadcaster APIs."""
diff --git a/packages/Python/lldbsuite/test/python_api/hello_world/main.c b/packages/Python/lldbsuite/test/python_api/hello_world/main.c
index 31a041e..1b942d0 100644
--- a/packages/Python/lldbsuite/test/python_api/hello_world/main.c
+++ b/packages/Python/lldbsuite/test/python_api/hello_world/main.c
@@ -1,25 +1,8 @@
#include <stdio.h>
-#if defined(__linux__)
-#include <sys/prctl.h>
-#endif
-
-int main(int argc, char const *argv[]) {
-
-#if defined(__linux__)
- // Immediately enable any ptracer so that we can allow the stub attach
- // operation to succeed. Some Linux kernels are locked down so that
- // only an ancestor process can be a ptracer of a process. This disables that
- // restriction. Without it, attach-related stub tests will fail.
-#if defined(PR_SET_PTRACER) && defined(PR_SET_PTRACER_ANY)
- int prctl_result;
-
- // For now we execute on best effort basis. If this fails for
- // some reason, so be it.
- prctl_result = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0);
- (void) prctl_result;
-#endif
-#endif
+int main(int argc, char const *argv[])
+{
+ lldb_enable_attach();
printf("Hello world.\n"); // Set break point at this line.
if (argc == 1)
diff --git a/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py b/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
index bc97d43..2de026c 100644
--- a/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
+++ b/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
@@ -16,6 +16,8 @@ class ModuleAndSectionAPIsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ # Py3 asserts due to a bug in SWIG. A fix for this was upstreamed into SWIG 3.0.8.
+ @skipIf(py_version=['>=', (3,0)], swig_version=['<', (3,0,8)])
@add_test_categories(['pyapi'])
def test_module_and_section(self):
"""Test module and section APIs."""
diff --git a/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py b/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py
index 77aefe0..f8ad972 100644
--- a/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py
@@ -28,6 +28,7 @@ class ChangeValueAPITestCase(TestBase):
@expectedFailureWindows("llvm.org/pr24772")
@add_test_categories(['pyapi'])
+ @expectedFlakeyLinux("llvm.org/pr25652")
def test_change_value(self):
"""Exercise the SBValue::SetValueFromCString API."""
d = {'EXE': self.exe_name}
diff --git a/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py b/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py
index 22d7e7e..8b60be9 100644
--- a/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py
+++ b/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py
@@ -25,6 +25,8 @@ class ValueAsLinkedListTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', '// Break at this line')
+ # Py3 asserts due to a bug in SWIG. A fix for this was upstreamed into SWIG 3.0.8.
+ @skipIf(py_version=['>=', (3,0)], swig_version=['<', (3,0,8)])
@add_test_categories(['pyapi'])
def test(self):
"""Exercise SBValue API linked_list_iter."""
OpenPOWER on IntegriCloud