Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2941)

Unified Diff: bin/cros_run_parallel_vm_tests.py

Issue 4297003: VM: Add --results_dir_root option to cros_run_parallel_vm_tests (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | run_remote_tests.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/cros_run_parallel_vm_tests.py
diff --git a/bin/cros_run_parallel_vm_tests.py b/bin/cros_run_parallel_vm_tests.py
index c035785b5b7b13548e2338793cc42b09694c5c31..f4d014f74cf031e704c29006333382e090788527 100755
--- a/bin/cros_run_parallel_vm_tests.py
+++ b/bin/cros_run_parallel_vm_tests.py
@@ -20,18 +20,28 @@ class ParallelTestRunner(object):
_DEFAULT_START_SSH_PORT = 9222
- def __init__(self, tests):
+ def __init__(self, tests, results_dir_root=None):
+ """Constructs and initializes the test runner class.
+
+ Args:
+ tests: A list of test names (see run_remote_tests.sh).
+ results_dir_root: The results directory root. If provided, the results
+ directory root for each test will be created under it with the SSH port
+ appended to the test name.
+ """
self._tests = tests
+ self._results_dir_root = results_dir_root
def _SpawnTests(self):
"""Spawns VMs and starts the test runs on them.
Runs all tests in |self._tests|. Each test is executed on a separate VM.
- Returns: A list of test process info objects containing the following
- dictionary entries:
- 'test': the test name;
- 'proc': the Popen process instance for this test run.
+ Returns:
+ A list of test process info objects containing the following dictionary
+ entries:
+ 'test': the test name;
+ 'proc': the Popen process instance for this test run.
"""
ssh_port = self._DEFAULT_START_SSH_PORT
spawned_tests = []
@@ -45,6 +55,9 @@ class ParallelTestRunner(object):
'--no_graphics',
'--ssh_port=%d' % ssh_port,
'--test_case=%s' % test ]
+ if self._results_dir_root:
+ args.append('--results_dir_root=%s/%s.%d' %
+ (self._results_dir_root, test, ssh_port))
Info('Running %r...' % args)
proc = subprocess.Popen(args, stdin=dev_null)
test_info = { 'test': test,
@@ -56,10 +69,11 @@ class ParallelTestRunner(object):
def _WaitForCompletion(self, spawned_tests):
"""Waits for tests to complete and returns a list of failed tests.
- Arguments:
+ Args:
spawned_tests: A list of test info objects (see _SpawnTests).
- Returns: A list of failed test names.
+ Returns:
+ A list of failed test names.
"""
failed_tests = []
for test_info in spawned_tests:
@@ -78,13 +92,14 @@ class ParallelTestRunner(object):
def main():
usage = 'Usage: %prog [options] tests...'
parser = optparse.OptionParser(usage=usage)
+ parser.add_option('--results_dir_root', help='Root results directory.')
(options, args) = parser.parse_args()
if not args:
parser.print_help()
Die('no tests provided')
- runner = ParallelTestRunner(args)
+ runner = ParallelTestRunner(args, options.results_dir_root)
runner.Run()
« no previous file with comments | « no previous file | run_remote_tests.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698