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

Side by Side Diff: bin/cros_run_parallel_vm_tests.py

Issue 4501001: VM: Use -serial none in no-graphics kvm mode... (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/cros_vm_lib.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 Runs all tests in |self._tests|. Each test is executed on a separate VM. 57 Runs all tests in |self._tests|. Each test is executed on a separate VM.
58 58
59 Returns: 59 Returns:
60 A list of test process info objects containing the following dictionary 60 A list of test process info objects containing the following dictionary
61 entries: 61 entries:
62 'test': the test name; 62 'test': the test name;
63 'proc': the Popen process instance for this test run. 63 'proc': the Popen process instance for this test run.
64 """ 64 """
65 ssh_port = self._base_ssh_port 65 ssh_port = self._base_ssh_port
66 spawned_tests = [] 66 spawned_tests = []
67 # Test runs shouldn't need anything from stdin. However, it seems that
68 # running with stdin leaves the terminal in a bad state so redirect from
69 # /dev/null.
70 dev_null = open('/dev/null')
71 for test in self._tests: 67 for test in self._tests:
72 args = [ os.path.join(os.path.dirname(__file__), 'cros_run_vm_test'), 68 args = [ os.path.join(os.path.dirname(__file__), 'cros_run_vm_test'),
73 '--snapshot', # The image is shared so don't modify it. 69 '--snapshot', # The image is shared so don't modify it.
74 '--no_graphics', 70 '--no_graphics',
75 '--ssh_port=%d' % ssh_port, 71 '--ssh_port=%d' % ssh_port,
76 '--test_case=%s' % test ] 72 '--test_case=%s' % test ]
77 if self._board: args.append('--board=%s' % self._board) 73 if self._board: args.append('--board=%s' % self._board)
78 if self._image_path: args.append('--image_path=%s' % self._image_path) 74 if self._image_path: args.append('--image_path=%s' % self._image_path)
79 if self._results_dir_root: 75 if self._results_dir_root:
80 args.append('--results_dir_root=%s/%s.%d' % 76 args.append('--results_dir_root=%s/%s.%d' %
81 (self._results_dir_root, test, ssh_port)) 77 (self._results_dir_root, test, ssh_port))
82 Info('Running %r...' % args) 78 Info('Running %r...' % args)
83 output = None 79 output = None
84 if self._order_output: 80 if self._order_output:
85 output = tempfile.NamedTemporaryFile(prefix='parallel_vm_test_') 81 output = tempfile.NamedTemporaryFile(prefix='parallel_vm_test_')
86 Info('Piping output to %s.' % output.name) 82 Info('Piping output to %s.' % output.name)
87 proc = subprocess.Popen(args, stdin=dev_null, stdout=output, 83 proc = subprocess.Popen(args, stdout=output, stderr=output)
88 stderr=output)
89 test_info = { 'test': test, 84 test_info = { 'test': test,
90 'proc': proc, 85 'proc': proc,
91 'output': output } 86 'output': output }
92 spawned_tests.append(test_info) 87 spawned_tests.append(test_info)
93 ssh_port = ssh_port + 1 88 ssh_port = ssh_port + 1
94 return spawned_tests 89 return spawned_tests
95 90
96 def _WaitForCompletion(self, spawned_tests): 91 def _WaitForCompletion(self, spawned_tests):
97 """Waits for tests to complete and returns a list of failed tests. 92 """Waits for tests to complete and returns a list of failed tests.
98 93
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 Die('no tests provided') 149 Die('no tests provided')
155 150
156 runner = ParallelTestRunner(args, options.base_ssh_port, options.board, 151 runner = ParallelTestRunner(args, options.base_ssh_port, options.board,
157 options.image_path, options.order_output, 152 options.image_path, options.order_output,
158 options.results_dir_root) 153 options.results_dir_root)
159 runner.Run() 154 runner.Run()
160 155
161 156
162 if __name__ == '__main__': 157 if __name__ == '__main__':
163 main() 158 main()
OLDNEW
« no previous file with comments | « no previous file | lib/cros_vm_lib.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698