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 3d0d1d6d90ea126c010d35610e1ef817be30f178..4da16c73227603c90d1e6eddb1b8e580e620fa15 100755 |
--- a/bin/cros_run_parallel_vm_tests.py |
+++ b/bin/cros_run_parallel_vm_tests.py |
@@ -27,8 +27,8 @@ class ParallelTestRunner(object): |
""" |
def __init__(self, tests, base_ssh_port=_DEFAULT_BASE_SSH_PORT, board=None, |
- image_path=None, order_output=False, results_dir_root=None, |
- use_emerged=False): |
+ image_path=None, order_output=False, quiet=False, |
+ results_dir_root=None, use_emerged=False): |
"""Constructs and initializes the test runner class. |
Args: |
@@ -44,12 +44,14 @@ class ParallelTestRunner(object): |
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. |
+ use_emerged: Force use of emerged autotest packages. |
""" |
self._tests = tests |
self._base_ssh_port = base_ssh_port |
self._board = board |
self._image_path = image_path |
self._order_output = order_output |
+ self._quiet = quiet |
petkov
2011/03/02 23:08:34
document quiet too?
Chris Masone
2011/03/02 23:27:28
Done.
|
self._results_dir_root = results_dir_root |
self._use_emerged = use_emerged |
@@ -73,9 +75,9 @@ class ParallelTestRunner(object): |
'--ssh_port=%d' % ssh_port ] |
if self._board: args.append('--board=%s' % self._board) |
if self._image_path: args.append('--image_path=%s' % self._image_path) |
+ results_dir = '%s/%s.%d' % (self._results_dir_root, test, ssh_port) |
petkov
2011/03/02 23:08:34
subtle... it took me a while to think through the
Chris Masone
2011/03/02 23:27:28
Done.
|
if self._results_dir_root: |
- args.append('--results_dir_root=%s/%s.%d' % |
- (self._results_dir_root, test, ssh_port)) |
+ args.append('--results_dir_root=%s' % results_dir) |
if self._use_emerged: args.append('--use_emerged') |
args.append(test) |
Info('Running %r...' % args) |
@@ -83,6 +85,9 @@ class ParallelTestRunner(object): |
if self._order_output: |
output = tempfile.NamedTemporaryFile(prefix='parallel_vm_test_') |
Info('Piping output to %s.' % output.name) |
+ if self._quiet: |
petkov
2011/03/02 23:08:34
can you move this up and do "elif self._order_outp
Chris Masone
2011/03/02 23:27:28
Done.
|
+ output = open('/dev/null', mode='w') |
+ Info('Output is in %s' % results_dir) |
petkov
2011/03/02 23:08:34
You mean the log files are there?
Chris Masone
2011/03/02 23:27:28
Yes.
|
proc = subprocess.Popen(args, stdout=output, stderr=output) |
test_info = { 'test': test, |
'proc': proc, |
@@ -108,7 +113,7 @@ class ParallelTestRunner(object): |
proc.wait() |
if proc.returncode: failed_tests.append(test_info['test']) |
output = test_info['output'] |
- if output: |
+ if output and not self._quiet: |
test = test_info['test'] |
Info('------ START %s:%s ------' % (test, output.name)) |
output.seek(0) |
@@ -142,6 +147,9 @@ def main(): |
help='Rather than emitting interleaved progress output ' |
'from the individual VMs, accumulate the outputs in ' |
'temporary files and dump them at the end.') |
+ parser.add_option('--quiet', action='store_true', default=False, |
+ help='Emits no output from the VMs. Forces --order_output' |
+ 'to be false, and requires specifying --results_dir_root') |
parser.add_option('--results_dir_root', |
help='Root results directory. If none specified, each test ' |
'will store its results in a separate /tmp directory.') |
@@ -153,9 +161,14 @@ def main(): |
parser.print_help() |
Die('no tests provided') |
+ if options.quiet: |
+ options.order_output = False |
+ if not options.results_dir_root: |
+ Die('--quiet requires --results_dir_root') |
runner = ParallelTestRunner(args, options.base_ssh_port, options.board, |
options.image_path, options.order_output, |
- options.results_dir_root, options.use_emerged) |
+ options.quiet, options.results_dir_root, |
+ options.use_emerged) |
runner.Run() |