diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/packages/Python/lldbsuite/test/test_runner | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | bcm5719-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/test_runner')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/test_runner/process_control.py | 10 | ||||
-rwxr-xr-x | lldb/packages/Python/lldbsuite/test/test_runner/test/test_process_control.py | 13 |
2 files changed, 17 insertions, 6 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py b/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py index a7e639e4b8b..e8bc69b7f62 100644 --- a/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py +++ b/lldb/packages/Python/lldbsuite/test/test_runner/process_control.py @@ -23,6 +23,7 @@ import threading class CommunicatorThread(threading.Thread): """Provides a thread class that communicates with a subprocess.""" + def __init__(self, process, event, output_file): super(CommunicatorThread, self).__init__() # Don't let this thread prevent shutdown. @@ -100,6 +101,7 @@ class ProcessHelper(object): @see ProcessHelper.process_helper() """ + def __init__(self): super(ProcessHelper, self).__init__() @@ -281,6 +283,7 @@ class UnixProcessHelper(ProcessHelper): This implementation supports anything that looks Posix-y (e.g. Darwin, Linux, *BSD, etc.) """ + def __init__(self): super(UnixProcessHelper, self).__init__() @@ -302,7 +305,7 @@ class UnixProcessHelper(ProcessHelper): stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - universal_newlines=True, # Elicits automatic byte -> string decoding in Py3 + universal_newlines=True, # Elicits automatic byte -> string decoding in Py3 close_fds=True, preexec_fn=preexec_func) @@ -412,8 +415,10 @@ class UnixProcessHelper(ProcessHelper): signal_name = signal_names_by_number.get(signo, "") return (signo, signal_name) + class WindowsProcessHelper(ProcessHelper): """Provides a Windows implementation of the ProcessHelper class.""" + def __init__(self): super(WindowsProcessHelper, self).__init__() @@ -429,7 +434,7 @@ class WindowsProcessHelper(ProcessHelper): stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - universal_newlines=True, # Elicits automatic byte -> string decoding in Py3 + universal_newlines=True, # Elicits automatic byte -> string decoding in Py3 creationflags=creation_flags) def was_hard_terminate(self, returncode): @@ -447,6 +452,7 @@ class ProcessDriver(object): way. The on_process_exited method is informed if the exit was natural or if it was due to a timeout. """ + def __init__(self, soft_terminate_timeout=10.0): super(ProcessDriver, self).__init__() self.process_helper = ProcessHelper.process_helper() diff --git a/lldb/packages/Python/lldbsuite/test/test_runner/test/test_process_control.py b/lldb/packages/Python/lldbsuite/test/test_runner/test/test_process_control.py index 817c83c4fb5..88ad961be2b 100755 --- a/lldb/packages/Python/lldbsuite/test/test_runner/test/test_process_control.py +++ b/lldb/packages/Python/lldbsuite/test/test_runner/test/test_process_control.py @@ -27,6 +27,7 @@ from test_runner import process_control class TestInferiorDriver(process_control.ProcessDriver): + def __init__(self, soft_terminate_timeout=None): super(TestInferiorDriver, self).__init__( soft_terminate_timeout=soft_terminate_timeout) @@ -58,6 +59,7 @@ class TestInferiorDriver(process_control.ProcessDriver): class ProcessControlTests(unittest.TestCase): + @classmethod def _suppress_soft_terminate(cls, command): # Do the right thing for your platform here. @@ -79,7 +81,8 @@ class ProcessControlTests(unittest.TestCase): # Base command. script_name = "{}/inferior.py".format(os.path.dirname(__file__)) if not os.path.exists(script_name): - raise Exception("test inferior python script not found: {}".format(script_name)) + raise Exception( + "test inferior python script not found: {}".format(script_name)) command = ([sys.executable, script_name]) if ignore_soft_terminate: @@ -97,6 +100,7 @@ class ProcessControlTests(unittest.TestCase): class ProcessControlNoTimeoutTests(ProcessControlTests): """Tests the process_control module.""" + def test_run_completes(self): """Test that running completes and gets expected stdout/stderr.""" driver = TestInferiorDriver() @@ -115,6 +119,7 @@ class ProcessControlNoTimeoutTests(ProcessControlTests): class ProcessControlTimeoutTests(ProcessControlTests): + def test_run_completes(self): """Test that running completes and gets expected return code.""" driver = TestInferiorDriver() @@ -124,7 +129,7 @@ class ProcessControlTimeoutTests(ProcessControlTests): "{}s".format(timeout_seconds), False) self.assertTrue( - driver.completed_event.wait(2*timeout_seconds), + driver.completed_event.wait(2 * timeout_seconds), "process failed to complete") self.assertEqual(driver.returncode, 0) @@ -141,13 +146,13 @@ class ProcessControlTimeoutTests(ProcessControlTests): # Sleep twice as long as the timeout interval. This # should force a timeout. self.inferior_command( - options="--sleep {}".format(timeout_seconds*2)), + options="--sleep {}".format(timeout_seconds * 2)), "{}s".format(timeout_seconds), with_core) # We should complete, albeit with a timeout. self.assertTrue( - driver.completed_event.wait(2*timeout_seconds), + driver.completed_event.wait(2 * timeout_seconds), "process failed to complete") # Ensure we received a timeout. |