diff options
author | Tamas Berghammer <tberghammer@google.com> | 2016-04-05 14:08:18 +0000 |
---|---|---|
committer | Tamas Berghammer <tberghammer@google.com> | 2016-04-05 14:08:18 +0000 |
commit | 19fc1d4e3c19caa091b2fde161f54fa3b015b028 (patch) | |
tree | e1f82b192e7a24e1785aabd3fd801990f6b2ab7a /lldb/packages/Python/lldbsuite/test/functionalities/process_group | |
parent | d3fb38cae5227d9c23a2be5562b5f22c469c1b71 (diff) | |
download | bcm5719-llvm-19fc1d4e3c19caa091b2fde161f54fa3b015b028.tar.gz bcm5719-llvm-19fc1d4e3c19caa091b2fde161f54fa3b015b028.zip |
[NFC] Cleanup the code used to run shell commands from tests
Previously we had 3 different method to run shell commands on the
target and 4 copy of code waiting until a given file appears on the
target device (used for syncronization). This CL merges these methods
to 1 run_platform_command and 1 wait_for_file_on_target functions
located in some utility classes.
Differential revision: http://reviews.llvm.org/D18789
llvm-svn: 265398
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/process_group')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py index 5aa6e795491..c20d66aa3ab 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py @@ -36,23 +36,7 @@ class ChangeProcessGroupTestCase(TestBase): popen = self.spawnSubprocess(exe, [pid_file_path]) self.addTearDownHook(self.cleanupSubprocesses) - max_attempts = 5 - for i in range(max_attempts): - err, retcode, msg = self.run_platform_command("ls %s" % pid_file_path) - if err.Success() and retcode == 0: - break - else: - print(msg) - if i < max_attempts: - # Exponential backoff! - time.sleep(pow(2, i) * 0.30) - else: - self.fail("Child PID file %s not found even after %d attempts." % (pid_file_path, max_attempts)) - - err, retcode, pid = self.run_platform_command("cat %s" % (pid_file_path)) - - self.assertTrue(err.Success() and retcode == 0, - "Failed to read file %s: %s, retcode: %d" % (pid_file_path, err.GetCString(), retcode)) + pid = lldbutil.wait_for_file_on_target(self, pid_file_path) # make sure we cleanup the forked child also def cleanupChild(): @@ -100,9 +84,3 @@ class ChangeProcessGroupTestCase(TestBase): # run to completion process.Continue() self.assertEqual(process.GetState(), lldb.eStateExited) - - def run_platform_command(self, cmd): - platform = self.dbg.GetSelectedPlatform() - shell_command = lldb.SBPlatformShellCommand(cmd) - err = platform.Run(shell_command) - return (err, shell_command.GetStatus(), shell_command.GetOutput()) |