OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """This module runs a suite of Auto Update tests. | 7 """This module runs a suite of Auto Update tests. |
8 | 8 |
9 The tests can be run on either a virtual machine or actual device depending | 9 The tests can be run on either a virtual machine or actual device depending |
10 on parameters given. Specific tests can be run by invoking --test_prefix. | 10 on parameters given. Specific tests can be run by invoking --test_prefix. |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 parser.add_option('--public_key', default=None, | 230 parser.add_option('--public_key', default=None, |
231 help='Public key to use on images and updates.') | 231 help='Public key to use on images and updates.') |
232 parser.add_option('--private_key', default=None, | 232 parser.add_option('--private_key', default=None, |
233 help='Private key to use on images and updates.') | 233 help='Private key to use on images and updates.') |
234 parser.add_option('-q', '--quick_test', default=False, action='store_true', | 234 parser.add_option('-q', '--quick_test', default=False, action='store_true', |
235 help='Use a basic test to verify image.') | 235 help='Use a basic test to verify image.') |
236 parser.add_option('-m', '--remote', | 236 parser.add_option('-m', '--remote', |
237 help='Remote address for real test.') | 237 help='Remote address for real test.') |
238 parser.add_option('-t', '--target_image', | 238 parser.add_option('-t', '--target_image', |
239 help='path to the target image.') | 239 help='path to the target image.') |
240 parser.add_option('--test_results_root', default=None, | |
241 help='Root directory to store test results. Should ' | |
242 'be defined relative to chroot root.') | |
240 parser.add_option('--test_prefix', default='test', | 243 parser.add_option('--test_prefix', default='test', |
241 help='Only runs tests with specific prefix i.e. ' | 244 help='Only runs tests with specific prefix i.e. ' |
242 'testFullUpdateWipeStateful.') | 245 'testFullUpdateWipeStateful.') |
243 parser.add_option('-p', '--type', default='vm', | 246 parser.add_option('-p', '--type', default='vm', |
244 help='type of test to run: [vm, real]. Default: vm.') | 247 help='type of test to run: [vm, real]. Default: vm.') |
245 parser.add_option('--verbose', default=True, action='store_true', | 248 parser.add_option('--verbose', default=True, action='store_true', |
246 help='Print out rather than capture output as much as ' | 249 help='Print out rather than capture output as much as ' |
247 'possible.') | 250 'possible.') |
248 (options, leftover_args) = parser.parse_args() | 251 (options, leftover_args) = parser.parse_args() |
249 | 252 |
250 if leftover_args: parser.error('Found unsupported flags: %s' % leftover_args) | 253 if leftover_args: parser.error('Found unsupported flags: % s' % leftover_args) |
dgarrett
2011/03/04 22:31:12
I think that space is put there by mistake, though
| |
251 | 254 |
252 assert options.target_image and os.path.exists(options.target_image), \ | 255 assert options.target_image and os.path.exists(options.target_image), \ |
253 'Target image path does not exist' | 256 'Target image path does not exist' |
254 if not options.base_image: | 257 if not options.base_image: |
255 cros_lib.Info('Base image not specified. Using target as base image.') | 258 cros_lib.Info('Base image not specified. Using target as base image.') |
256 options.base_image = options.target_image | 259 options.base_image = options.target_image |
257 | 260 |
258 # Sanity checks on keys and insert them onto the image. The caches must be | 261 # Sanity checks on keys and insert them onto the image. The caches must be |
259 # cleaned so we know that the vm images and payloads match the possibly new | 262 # cleaned so we know that the vm images and payloads match the possibly new |
260 # key. | 263 # key. |
261 if options.private_key or options.public_key: | 264 if options.private_key or options.public_key: |
262 error_msg = ('Could not find %s key. Both private and public keys must be ' | 265 error_msg = ('Could not find % s key. Both private and public keys must be ' |
dgarrett
2011/03/04 22:31:12
80 characters, the space looks like an error, and
| |
263 'specified if either is specified.') | 266 'specified if either is specified.') |
264 assert options.private_key and os.path.exists(options.private_key), \ | 267 assert options.private_key and os.path.exists(options.private_key), \ |
265 error_msg % 'private' | 268 error_msg % 'private' |
266 assert options.public_key and os.path.exists(options.public_key), \ | 269 assert options.public_key and os.path.exists(options.public_key), \ |
267 error_msg % 'public' | 270 error_msg % 'public' |
268 _InsertPublicKeyIntoImage(options.target_image, options.public_key) | 271 _InsertPublicKeyIntoImage(options.target_image, options.public_key) |
269 if options.target_image != options.base_image: | 272 if options.target_image != options.base_image: |
270 _InsertPublicKeyIntoImage(options.base_image, options.public_key) | 273 _InsertPublicKeyIntoImage(options.base_image, options.public_key) |
271 options.clean = True | 274 options.clean = True |
272 | 275 |
(...skipping 14 matching lines...) Expand all Loading... | |
287 # Can't run in parallel with only one remote device. | 290 # Can't run in parallel with only one remote device. |
288 test_suite = _PrepareTestSuite(options) | 291 test_suite = _PrepareTestSuite(options) |
289 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) | 292 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) |
290 if not test_result.wasSuccessful(): cros_lib.Die('Test harness failed.') | 293 if not test_result.wasSuccessful(): cros_lib.Die('Test harness failed.') |
291 finally: | 294 finally: |
292 my_server.Stop() | 295 my_server.Stop() |
293 | 296 |
294 | 297 |
295 if __name__ == '__main__': | 298 if __name__ == '__main__': |
296 main() | 299 main() |
OLD | NEW |