summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/driver
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/driver
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/driver')
-rw-r--r--lldb/packages/Python/lldbsuite/test/driver/batch_mode/TestBatchMode.py106
1 files changed, 62 insertions, 44 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/driver/batch_mode/TestBatchMode.py b/lldb/packages/Python/lldbsuite/test/driver/batch_mode/TestBatchMode.py
index 6713a5a764e..8699b31f992 100644
--- a/lldb/packages/Python/lldbsuite/test/driver/batch_mode/TestBatchMode.py
+++ b/lldb/packages/Python/lldbsuite/test/driver/batch_mode/TestBatchMode.py
@@ -5,13 +5,14 @@ Test that the lldb driver's batch mode works correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DriverBatchModeTest (TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,21 +24,23 @@ class DriverBatchModeTest (TestBase):
self.source = 'main.c'
self.victim = None
- def expect_string (self, string):
+ def expect_string(self, string):
import pexpect
"""This expects for "string", with timeout & EOF being test fails."""
try:
self.child.expect_exact(string)
except pexpect.EOF:
- self.fail ("Got EOF waiting for '%s'"%(string))
+ self.fail("Got EOF waiting for '%s'" % (string))
except pexpect.TIMEOUT:
- self.fail ("Timed out waiting for '%s'"%(string))
+ self.fail("Timed out waiting for '%s'" % (string))
- @skipIfRemote # test not remote-ready llvm.org/pr24813
+ @skipIfRemote # test not remote-ready llvm.org/pr24813
@expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
@expectedFlakeyLinux("llvm.org/pr25172")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- def test_batch_mode_run_crash (self):
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ def test_batch_mode_run_crash(self):
"""Test that the lldb driver's batch mode works correctly."""
self.build()
self.setTearDownCleanup()
@@ -48,33 +51,36 @@ class DriverBatchModeTest (TestBase):
# Pass CRASH so the process will crash and stop in batch mode.
run_commands = ' -b -o "break set -n main" -o "run" -o "continue" -k "frame var touch_me_not"'
- self.child = pexpect.spawn('%s %s %s %s -- CRASH' % (lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
+ self.child = pexpect.spawn(
+ '%s %s %s %s -- CRASH' %
+ (lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
child = self.child
# Turn on logging for what the child sends back.
if self.TraceOn():
child.logfile_read = sys.stdout
# We should see the "run":
- self.expect_string ("run")
+ self.expect_string("run")
# We should have hit the breakpoint & continued:
- self.expect_string ("continue")
+ self.expect_string("continue")
# The App should have crashed:
self.expect_string("About to crash")
# The -k option should have printed the frame variable once:
- self.expect_string ('(char *) touch_me_not')
+ self.expect_string('(char *) touch_me_not')
# Then we should have a live prompt:
- self.expect_string (prompt)
+ self.expect_string(prompt)
self.child.sendline("frame variable touch_me_not")
- self.expect_string ('(char *) touch_me_not')
-
- self.deletePexpectChild()
+ self.expect_string('(char *) touch_me_not')
+ self.deletePexpectChild()
- @skipIfRemote # test not remote-ready llvm.org/pr24813
+ @skipIfRemote # test not remote-ready llvm.org/pr24813
@expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
@expectedFlakeyLinux("llvm.org/pr25172")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- def test_batch_mode_run_exit (self):
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ def test_batch_mode_run_exit(self):
"""Test that the lldb driver's batch mode works correctly."""
self.build()
self.setTearDownCleanup()
@@ -85,66 +91,78 @@ class DriverBatchModeTest (TestBase):
# Now do it again, and make sure if we don't crash, we quit:
run_commands = ' -b -o "break set -n main" -o "run" -o "continue" '
- self.child = pexpect.spawn('%s %s %s %s -- NOCRASH' % (lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
+ self.child = pexpect.spawn(
+ '%s %s %s %s -- NOCRASH' %
+ (lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
child = self.child
# Turn on logging for what the child sends back.
if self.TraceOn():
child.logfile_read = sys.stdout
# We should see the "run":
- self.expect_string ("run")
+ self.expect_string("run")
# We should have hit the breakpoint & continued:
- self.expect_string ("continue")
+ self.expect_string("continue")
# The App should have not have crashed:
self.expect_string("Got there on time and it did not crash.")
# Then we should have a live prompt:
- self.expect_string ("exited")
+ self.expect_string("exited")
index = self.child.expect([pexpect.EOF, pexpect.TIMEOUT])
- self.assertTrue(index == 0, "lldb didn't close on successful batch completion.")
+ self.assertTrue(
+ index == 0,
+ "lldb didn't close on successful batch completion.")
def closeVictim(self):
- if self.victim != None:
+ if self.victim is not None:
self.victim.close()
self.victim = None
- @skipIfRemote # test not remote-ready llvm.org/pr24813
+ @skipIfRemote # test not remote-ready llvm.org/pr24813
@expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
@expectedFlakeyLinux("llvm.org/pr25172")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- def test_batch_mode_attach_exit (self):
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ def test_batch_mode_attach_exit(self):
"""Test that the lldb driver's batch mode works correctly."""
self.build()
self.setTearDownCleanup()
-
+
import pexpect
exe = os.path.join(os.getcwd(), "a.out")
prompt = "(lldb) "
# Finally, start up the process by hand, attach to it, and wait for its completion.
- # Attach is funny, since it looks like it stops with a signal on most Unixen so
+ # Attach is funny, since it looks like it stops with a signal on most Unixen so
# care must be taken not to treat that as a reason to exit batch mode.
-
+
# Start up the process by hand and wait for it to get to the wait loop.
- self.victim = pexpect.spawn('%s WAIT' %(exe))
- if self.victim == None:
+ self.victim = pexpect.spawn('%s WAIT' % (exe))
+ if self.victim is None:
self.fail("Could not spawn ", exe, ".")
- self.addTearDownHook (self.closeVictim)
+ self.addTearDownHook(self.closeVictim)
if self.TraceOn():
self.victim.logfile_read = sys.stdout
self.victim.expect("PID: ([0-9]+) END")
- if self.victim.match == None:
+ if self.victim.match is None:
self.fail("Couldn't get the target PID.")
victim_pid = int(self.victim.match.group(1))
-
+
self.victim.expect("Waiting")
- run_commands = ' -b -o "process attach -p %d" -o "breakpoint set --file %s -p \'Stop here to unset keep_waiting\' -N keep_waiting" -o "continue" -o "break delete keep_waiting" -o "expr keep_waiting = 0" -o "continue" ' % (victim_pid, self.source)
- self.child = pexpect.spawn('%s %s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
+ run_commands = ' -b -o "process attach -p %d" -o "breakpoint set --file %s -p \'Stop here to unset keep_waiting\' -N keep_waiting" -o "continue" -o "break delete keep_waiting" -o "expr keep_waiting = 0" -o "continue" ' % (
+ victim_pid, self.source)
+ self.child = pexpect.spawn(
+ '%s %s %s %s' %
+ (lldbtest_config.lldbExec,
+ self.lldbOption,
+ run_commands,
+ exe))
child = self.child
# Turn on logging for what the child sends back.
@@ -152,19 +170,19 @@ class DriverBatchModeTest (TestBase):
child.logfile_read = sys.stdout
# We should see the "run":
- self.expect_string ("attach")
+ self.expect_string("attach")
self.expect_string(prompt + "continue")
self.expect_string(prompt + "continue")
# Then we should see the process exit:
- self.expect_string ("Process %d exited with status"%(victim_pid))
-
+ self.expect_string("Process %d exited with status" % (victim_pid))
+
victim_index = self.victim.expect([pexpect.EOF, pexpect.TIMEOUT])
self.assertTrue(victim_index == 0, "Victim didn't really exit.")
index = self.child.expect([pexpect.EOF, pexpect.TIMEOUT])
- self.assertTrue(index == 0, "lldb didn't close on successful batch completion.")
-
-
+ self.assertTrue(
+ index == 0,
+ "lldb didn't close on successful batch completion.")
OpenPOWER on IntegriCloud