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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 assert options.public_key and os.path.exists(options.public_key), \ | 268 assert options.public_key and os.path.exists(options.public_key), \ |
269 error_msg % 'public' | 269 error_msg % 'public' |
270 _InsertPublicKeyIntoImage(options.target_image, options.public_key) | 270 _InsertPublicKeyIntoImage(options.target_image, options.public_key) |
271 if options.target_image != options.base_image: | 271 if options.target_image != options.base_image: |
272 _InsertPublicKeyIntoImage(options.base_image, options.public_key) | 272 _InsertPublicKeyIntoImage(options.base_image, options.public_key) |
273 options.clean = True | 273 options.clean = True |
274 | 274 |
275 # Clean up previous work if requested. | 275 # Clean up previous work if requested. |
276 if options.clean: _CleanPreviousWork(options) | 276 if options.clean: _CleanPreviousWork(options) |
277 | 277 |
| 278 # Make sure we have a log directory. |
| 279 if not os.path.exists(options.test_results_root): |
| 280 os.makedirs(options.test_results_root) |
| 281 |
278 # Generate cache of updates to use during test harness. | 282 # Generate cache of updates to use during test harness. |
279 update_cache = _PregenerateUpdates(options) | 283 update_cache = _PregenerateUpdates(options) |
280 au_worker.AUWorker.SetUpdateCache(update_cache) | 284 au_worker.AUWorker.SetUpdateCache(update_cache) |
281 | 285 |
282 my_server = dev_server_wrapper.DevServerWrapper( | 286 my_server = dev_server_wrapper.DevServerWrapper( |
283 au_test.AUTest.test_results_root) | 287 au_test.AUTest.test_results_root) |
284 my_server.start() | 288 my_server.start() |
285 try: | 289 try: |
286 if options.type == 'vm': | 290 if options.type == 'vm': |
287 _RunTestsInParallel(options) | 291 _RunTestsInParallel(options) |
288 else: | 292 else: |
289 # TODO(sosa) - Take in a machine pool for a real test. | 293 # TODO(sosa) - Take in a machine pool for a real test. |
290 # Can't run in parallel with only one remote device. | 294 # Can't run in parallel with only one remote device. |
291 test_suite = _PrepareTestSuite(options) | 295 test_suite = _PrepareTestSuite(options) |
292 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) | 296 test_result = unittest.TextTestRunner(verbosity=2).run(test_suite) |
293 if not test_result.wasSuccessful(): cros_lib.Die('Test harness failed.') | 297 if not test_result.wasSuccessful(): cros_lib.Die('Test harness failed.') |
294 finally: | 298 finally: |
295 my_server.Stop() | 299 my_server.Stop() |
296 | 300 |
297 | 301 |
298 if __name__ == '__main__': | 302 if __name__ == '__main__': |
299 main() | 303 main() |
OLD | NEW |