| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Runs tests on VMs in parallel.""" | 6 """Runs tests on VMs in parallel.""" |
| 7 | 7 |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import subprocess | 10 import subprocess |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 entries: | 63 entries: |
| 64 'test': the test name; | 64 'test': the test name; |
| 65 'proc': the Popen process instance for this test run. | 65 'proc': the Popen process instance for this test run. |
| 66 """ | 66 """ |
| 67 ssh_port = self._base_ssh_port | 67 ssh_port = self._base_ssh_port |
| 68 spawned_tests = [] | 68 spawned_tests = [] |
| 69 for test in self._tests: | 69 for test in self._tests: |
| 70 args = [ os.path.join(os.path.dirname(__file__), 'cros_run_vm_test'), | 70 args = [ os.path.join(os.path.dirname(__file__), 'cros_run_vm_test'), |
| 71 '--snapshot', # The image is shared so don't modify it. | 71 '--snapshot', # The image is shared so don't modify it. |
| 72 '--no_graphics', | 72 '--no_graphics', |
| 73 '--ssh_port=%d' % ssh_port, | 73 '--ssh_port=%d' % ssh_port ] |
| 74 '--test_case=%s' % test ] | |
| 75 if self._board: args.append('--board=%s' % self._board) | 74 if self._board: args.append('--board=%s' % self._board) |
| 76 if self._image_path: args.append('--image_path=%s' % self._image_path) | 75 if self._image_path: args.append('--image_path=%s' % self._image_path) |
| 77 if self._results_dir_root: | 76 if self._results_dir_root: |
| 78 args.append('--results_dir_root=%s/%s.%d' % | 77 args.append('--results_dir_root=%s/%s.%d' % |
| 79 (self._results_dir_root, test, ssh_port)) | 78 (self._results_dir_root, test, ssh_port)) |
| 80 if self._use_emerged: args.append('--use_emerged') | 79 if self._use_emerged: args.append('--use_emerged') |
| 80 args.append(test) |
| 81 Info('Running %r...' % args) | 81 Info('Running %r...' % args) |
| 82 output = None | 82 output = None |
| 83 if self._order_output: | 83 if self._order_output: |
| 84 output = tempfile.NamedTemporaryFile(prefix='parallel_vm_test_') | 84 output = tempfile.NamedTemporaryFile(prefix='parallel_vm_test_') |
| 85 Info('Piping output to %s.' % output.name) | 85 Info('Piping output to %s.' % output.name) |
| 86 proc = subprocess.Popen(args, stdout=output, stderr=output) | 86 proc = subprocess.Popen(args, stdout=output, stderr=output) |
| 87 test_info = { 'test': test, | 87 test_info = { 'test': test, |
| 88 'proc': proc, | 88 'proc': proc, |
| 89 'output': output } | 89 'output': output } |
| 90 spawned_tests.append(test_info) | 90 spawned_tests.append(test_info) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 Die('no tests provided') | 154 Die('no tests provided') |
| 155 | 155 |
| 156 runner = ParallelTestRunner(args, options.base_ssh_port, options.board, | 156 runner = ParallelTestRunner(args, options.base_ssh_port, options.board, |
| 157 options.image_path, options.order_output, | 157 options.image_path, options.order_output, |
| 158 options.results_dir_root, options.use_emerged) | 158 options.results_dir_root, options.use_emerged) |
| 159 runner.Run() | 159 runner.Run() |
| 160 | 160 |
| 161 | 161 |
| 162 if __name__ == '__main__': | 162 if __name__ == '__main__': |
| 163 main() | 163 main() |
| OLD | NEW |