summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/python_api/event
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/packages/Python/lldbsuite/test/python_api/event
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadbcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/event')
-rw-r--r--lldb/packages/Python/lldbsuite/test/python_api/event/TestEvents.py111
1 files changed, 65 insertions, 46 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/event/TestEvents.py b/lldb/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
index 1c23f50e9d4..e9ea0bd0087 100644
--- a/lldb/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
+++ b/lldb/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
@@ -5,14 +5,15 @@ Test lldb Python event APIs.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipIfLinux # llvm.org/pr25924, sometimes generating SIGSEGV
class EventAPITestCase(TestBase):
@@ -22,10 +23,13 @@ class EventAPITestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to of function 'c'.
- self.line = line_number('main.c', '// Find the line number of function "c" here.')
+ self.line = line_number(
+ 'main.c', '// Find the line number of function "c" here.')
@add_test_categories(['pyapi'])
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr23730 Flaky, fails ~1/10 cases")
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr23730 Flaky, fails ~1/10 cases")
def test_listen_for_and_print_event(self):
"""Exercise SBEvent API."""
self.build()
@@ -44,18 +48,20 @@ class EventAPITestCase(TestBase):
# Now launch the process, and do not stop at the entry point.
error = lldb.SBError()
- process = target.Launch (listener,
- None, # argv
- None, # envp
- None, # stdin_path
- None, # stdout_path
- None, # stderr_path
- None, # working directory
- 0, # launch flags
- False, # Stop at entry
- error) # error
-
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+ process = target.Launch(listener,
+ None, # argv
+ None, # envp
+ None, # stdin_path
+ None, # stdout_path
+ None, # stderr_path
+ None, # working directory
+ 0, # launch flags
+ False, # Stop at entry
+ error) # error
+
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
# Create an empty event object.
event = lldb.SBEvent()
@@ -66,7 +72,9 @@ class EventAPITestCase(TestBase):
# Create MyListeningThread class to wait for any kind of event.
import threading
+
class MyListeningThread(threading.Thread):
+
def run(self):
count = 0
# Let's only try at most 4 times to retrieve any kind of event.
@@ -79,7 +87,10 @@ class EventAPITestCase(TestBase):
desc = lldbutil.get_description(event)
print("Event description:", desc)
print("Event data flavor:", event.GetDataFlavor())
- print("Process state:", lldbutil.state_type_to_str(process.GetState()))
+ print(
+ "Process state:",
+ lldbutil.state_type_to_str(
+ process.GetState()))
print()
else:
if traceOn:
@@ -106,7 +117,7 @@ class EventAPITestCase(TestBase):
# Shouldn't we be testing against some kind of expectation here?
@add_test_categories(['pyapi'])
- @expectedFlakeyLinux("llvm.org/pr23730") # Flaky, fails ~1/100 cases
+ @expectedFlakeyLinux("llvm.org/pr23730") # Flaky, fails ~1/100 cases
@expectedFlakeyOS(oslist=["windows"])
def test_wait_for_event(self):
"""Exercise SBListener.WaitForEvent() API."""
@@ -131,16 +142,16 @@ class EventAPITestCase(TestBase):
# Now launch the process, and do not stop at entry point.
error = lldb.SBError()
- process = target.Launch (listener,
- None, # argv
- None, # envp
- None, # stdin_path
- None, # stdout_path
- None, # stderr_path
- None, # working directory
- 0, # launch flags
- False, # Stop at entry
- error) # error
+ process = target.Launch(listener,
+ None, # argv
+ None, # envp
+ None, # stdin_path
+ None, # stdout_path
+ None, # stderr_path
+ None, # working directory
+ 0, # launch flags
+ False, # Stop at entry
+ error) # error
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
# Create an empty event object.
@@ -149,7 +160,9 @@ class EventAPITestCase(TestBase):
# Create MyListeningThread to wait for any kind of event.
import threading
+
class MyListeningThread(threading.Thread):
+
def run(self):
count = 0
# Let's only try at most 3 times to retrieve any kind of event.
@@ -179,9 +192,11 @@ class EventAPITestCase(TestBase):
self.assertTrue(event,
"My listening thread successfully received an event")
- @skipIfFreeBSD # llvm.org/pr21325
+ @skipIfFreeBSD # llvm.org/pr21325
@add_test_categories(['pyapi'])
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr23617 Flaky, fails ~1/10 cases")
+ @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."""
@@ -205,22 +220,21 @@ class EventAPITestCase(TestBase):
# Now launch the process, and do not stop at the entry point.
error = lldb.SBError()
- process = target.Launch (listener,
- None, # argv
- None, # envp
- None, # stdin_path
- None, # stdout_path
- None, # stderr_path
- None, # working directory
- 0, # launch flags
- False, # Stop at entry
- error) # error
+ process = target.Launch(listener,
+ None, # argv
+ None, # envp
+ None, # stdin_path
+ None, # stdout_path
+ None, # stderr_path
+ None, # working directory
+ 0, # launch flags
+ False, # Stop at entry
+ error) # error
# Create an empty event object.
event = lldb.SBEvent()
self.assertFalse(event, "Event should not be valid initially")
-
# The finite state machine for our custom listening thread, with an
# initial state of None, which means no event has been received.
# It changes to 'connected' after 'connected' event is received (for remote platforms)
@@ -231,9 +245,12 @@ class EventAPITestCase(TestBase):
self.state = None
# Create MyListeningThread to wait for state changed events.
- # By design, a "running" event is expected following by a "stopped" event.
+ # By design, a "running" event is expected following by a "stopped"
+ # event.
import threading
+
class MyListeningThread(threading.Thread):
+
def run(self):
#print("Running MyListeningThread:", self)
@@ -248,19 +265,21 @@ class EventAPITestCase(TestBase):
#print("Event description:", desc)
match = pattern.search(desc)
if not match:
- break;
+ break
if match.group(1) == 'connected':
# When debugging remote targets with lldb-server, we
# first get the 'connected' event.
- self.context.assertTrue(self.context.state == None)
+ self.context.assertTrue(self.context.state is None)
self.context.state = 'connected'
continue
elif match.group(1) == 'running':
- self.context.assertTrue(self.context.state == None or self.context.state == 'connected')
+ self.context.assertTrue(
+ self.context.state is None or self.context.state == 'connected')
self.context.state = 'running'
continue
elif match.group(1) == 'stopped':
- self.context.assertTrue(self.context.state == 'running')
+ self.context.assertTrue(
+ self.context.state == 'running')
# Whoopee, both events have been received!
self.context.state = 'stopped'
break
OpenPOWER on IntegriCloud