summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/python_api
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
commit94994d372d014ce4c8758b9605d63fae651bd8aa (patch)
tree51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /packages/Python/lldbsuite/test/python_api
parent39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff)
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/python_api')
-rw-r--r--packages/Python/lldbsuite/test/python_api/event/TestEvents.py2
-rw-r--r--packages/Python/lldbsuite/test/python_api/frame/TestFrames.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py41
-rw-r--r--packages/Python/lldbsuite/test/python_api/hello_world/main.c24
-rw-r--r--packages/Python/lldbsuite/test/python_api/name_lookup/main.cpp2
-rw-r--r--packages/Python/lldbsuite/test/python_api/sbvalue_persist/main.cpp2
-rw-r--r--packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py3
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py1
8 files changed, 38 insertions, 38 deletions
diff --git a/packages/Python/lldbsuite/test/python_api/event/TestEvents.py b/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
index 8a9e456f3458..f5d143fbd40b 100644
--- a/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
+++ b/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
@@ -119,7 +119,6 @@ class EventAPITestCase(TestBase):
@add_test_categories(['pyapi'])
@expectedFlakeyLinux("llvm.org/pr23730") # Flaky, fails ~1/100 cases
- @expectedFlakeyOS(oslist=["windows"])
def test_wait_for_event(self):
"""Exercise SBListener.WaitForEvent() API."""
self.build()
@@ -198,7 +197,6 @@ class EventAPITestCase(TestBase):
@expectedFailureAll(
oslist=["linux"],
bugnumber="llvm.org/pr23617 Flaky, fails ~1/10 cases")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
def test_add_listener_to_broadcaster(self):
"""Exercise some SBBroadcaster APIs."""
self.build()
diff --git a/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py b/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
index 85e915ad3a48..fc2f03f9e617 100644
--- a/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
+++ b/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
@@ -20,7 +20,6 @@ class FrameAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(['pyapi'])
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
def test_get_arg_vals_for_call_stack(self):
"""Exercise SBFrame.GetVariables() API to get argument vals."""
self.build()
diff --git a/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py b/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
index b0f09d2fa7b5..33f4a790aacf 100644
--- a/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
+++ b/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
@@ -10,8 +10,7 @@ import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
+import lldbsuite.test.lldbutil as lldbutil
class HelloWorldTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@@ -35,7 +34,7 @@ class HelloWorldTestCase(TestBase):
def test_with_process_launch_api(self):
"""Create target, breakpoint, launch a process, and then kill it."""
# Get the full path to our executable to be attached/debugged.
- exe = self.getBuildArtifact(self.testMethodName)
+ exe = '%s_%d'%(self.getBuildArtifact(self.testMethodName), os.getpid())
d = {'EXE': exe}
self.build(dictionary=d)
self.setTearDownCleanup(dictionary=d)
@@ -77,23 +76,22 @@ class HelloWorldTestCase(TestBase):
self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE)
@add_test_categories(['pyapi'])
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24600")
@skipIfiOSSimulator
- @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
def test_with_attach_to_process_with_id_api(self):
"""Create target, spawn a process, and attach to it with process id."""
- exe = self.getBuildArtifact(self.testMethodName)
+ exe = '%s_%d'%(self.getBuildArtifact(self.testMethodName), os.getpid())
d = {'EXE': exe}
self.build(dictionary=d)
self.setTearDownCleanup(dictionary=d)
target = self.dbg.CreateTarget(exe)
# Spawn a new process
- popen = self.spawnSubprocess(exe, ["abc", "xyz"])
+ token = exe+'.token'
+ if os.path.exists(token):
+ os.remove(token)
+ popen = self.spawnSubprocess(exe, [token])
self.addTearDownHook(self.cleanupSubprocesses)
-
- # Give the subprocess time to start and wait for user input
- time.sleep(0.25)
+ lldbutil.wait_for_file_on_target(self, token)
listener = lldb.SBListener("my.attach.listener")
error = lldb.SBError()
@@ -102,30 +100,29 @@ class HelloWorldTestCase(TestBase):
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
# Let's check the stack traces of the attached process.
- import lldbsuite.test.lldbutil as lldbutil
stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
self.expect(stacktraces, exe=False,
substrs=['main.c:%d' % self.line2,
- '(int)argc=3'])
+ '(int)argc=2'])
@add_test_categories(['pyapi'])
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24600")
@skipIfiOSSimulator
- @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
+ @skipIfSanitized # FIXME: Hangs indefinitely.
def test_with_attach_to_process_with_name_api(self):
"""Create target, spawn a process, and attach to it with process name."""
- exe = self.getBuildArtifact(self.testMethodName)
+ exe = '%s_%d'%(self.getBuildArtifact(self.testMethodName), os.getpid())
d = {'EXE': exe}
self.build(dictionary=d)
self.setTearDownCleanup(dictionary=d)
target = self.dbg.CreateTarget(exe)
- # Spawn a new process
- popen = self.spawnSubprocess(exe, ["abc", "xyz"])
+ # Spawn a new process.
+ token = exe+'.token'
+ if os.path.exists(token):
+ os.remove(token)
+ popen = self.spawnSubprocess(exe, [token])
self.addTearDownHook(self.cleanupSubprocesses)
-
- # Give the subprocess time to start and wait for user input
- time.sleep(0.25)
+ lldbutil.wait_for_file_on_target(self, token)
listener = lldb.SBListener("my.attach.listener")
error = lldb.SBError()
@@ -140,7 +137,6 @@ class HelloWorldTestCase(TestBase):
target.ConnectRemote(listener, None, None, error)
process = target.AttachToProcessWithName(listener, name, False, error)
-
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
# Verify that after attach, our selected target indeed matches name.
@@ -150,8 +146,7 @@ class HelloWorldTestCase(TestBase):
startstr=name)
# Let's check the stack traces of the attached process.
- import lldbsuite.test.lldbutil as lldbutil
stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
self.expect(stacktraces, exe=False,
substrs=['main.c:%d' % self.line2,
- '(int)argc=3'])
+ '(int)argc=2'])
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 32b0446517c5..c516f923614f 100644
--- a/packages/Python/lldbsuite/test/python_api/hello_world/main.c
+++ b/packages/Python/lldbsuite/test/python_api/hello_world/main.c
@@ -8,16 +8,22 @@
int main(int argc, char const *argv[])
{
- lldb_enable_attach();
+ lldb_enable_attach();
- printf("Hello world.\n"); // Set break point at this line.
- if (argc == 1)
- return 0;
+ printf("Hello world.\n"); // Set break point at this line.
+ if (argc == 1)
+ return 1;
- // Waiting to be attached by the debugger, otherwise.
- char line[100];
- while (1)
- sleep (1); // Waiting to be attached...
+ // Create the synchronization token.
+ FILE *f;
+ if (f = fopen(argv[1], "wx")) {
+ fputs("\n", f);
+ fflush(f);
+ fclose(f);
+ } else
+ return 1;
- printf("Exiting now\n");
+ // Waiting to be attached by the debugger, otherwise.
+ while (1)
+ sleep(1); // Waiting to be attached...
}
diff --git a/packages/Python/lldbsuite/test/python_api/name_lookup/main.cpp b/packages/Python/lldbsuite/test/python_api/name_lookup/main.cpp
index 79aa2d0452f4..b38208ce2a35 100644
--- a/packages/Python/lldbsuite/test/python_api/name_lookup/main.cpp
+++ b/packages/Python/lldbsuite/test/python_api/name_lookup/main.cpp
@@ -51,4 +51,4 @@ int main (int argc, char const *argv[])
g.unique_function_name();
g.unique_function_name(argc);
return 0;
-} \ No newline at end of file
+}
diff --git a/packages/Python/lldbsuite/test/python_api/sbvalue_persist/main.cpp b/packages/Python/lldbsuite/test/python_api/sbvalue_persist/main.cpp
index 650d87acd6e6..c54339f3bba6 100644
--- a/packages/Python/lldbsuite/test/python_api/sbvalue_persist/main.cpp
+++ b/packages/Python/lldbsuite/test/python_api/sbvalue_persist/main.cpp
@@ -11,4 +11,4 @@ int main() {
f(); // break here
f(); // break here
return 0;
-} \ No newline at end of file
+}
diff --git a/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py b/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
index 8a4af0cc2b94..2299f1f1432d 100644
--- a/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
@@ -153,6 +153,9 @@ class ValueAPITestCase(TestBase):
val_s = target.EvaluateExpression('s')
val_a = target.EvaluateExpression('a')
self.assertTrue(
+ val_s.GetChildMemberWithName('a').GetAddress().IsValid(),
+ VALID_VARIABLE)
+ self.assertTrue(
val_s.GetChildMemberWithName('a').AddressOf(),
VALID_VARIABLE)
self.assertTrue(
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
index d5862d274ceb..3c19c589b7a7 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
@@ -108,7 +108,6 @@ class TargetWatchAddressAPITestCase(TestBase):
# No size constraint on MIPS for watches
@skipIf(archs=['mips', 'mipsel', 'mips64', 'mips64el'])
@skipIf(archs=['s390x']) # Likewise on SystemZ
- @expectedFailureAll(oslist=["windows"])
def test_watch_address_with_invalid_watch_size(self):
"""Exercise SBTarget.WatchAddress() API but pass an invalid watch_size."""
self.build()