OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Class for running instrumentation tests on a single device.""" | 5 """Class for running instrumentation tests on a single device.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import re | 9 import re |
10 import sys | 10 import sys |
(...skipping 30 matching lines...) Expand all Loading... |
41 additional_flags=None): | 41 additional_flags=None): |
42 """Create a new TestRunner. | 42 """Create a new TestRunner. |
43 | 43 |
44 Args: | 44 Args: |
45 test_options: An InstrumentationOptions object. | 45 test_options: An InstrumentationOptions object. |
46 device: Attached android device. | 46 device: Attached android device. |
47 shard_index: Shard index. | 47 shard_index: Shard index. |
48 test_pkg: A TestPackage object. | 48 test_pkg: A TestPackage object. |
49 additional_flags: A list of additional flags to add to the command line. | 49 additional_flags: A list of additional flags to add to the command line. |
50 """ | 50 """ |
51 super(TestRunner, self).__init__(device, test_options.tool) | 51 super(TestRunner, self).__init__(device, test_options.tool, |
| 52 test_options.cleanup_test_files) |
52 self._lighttp_port = constants.LIGHTTPD_RANDOM_PORT_FIRST + shard_index | 53 self._lighttp_port = constants.LIGHTTPD_RANDOM_PORT_FIRST + shard_index |
53 self._logcat_monitor = None | 54 self._logcat_monitor = None |
54 | 55 |
55 self.coverage_device_file = None | 56 self.coverage_device_file = None |
56 self.coverage_dir = test_options.coverage_dir | 57 self.coverage_dir = test_options.coverage_dir |
57 self.coverage_host_file = None | 58 self.coverage_host_file = None |
58 self.options = test_options | 59 self.options = test_options |
59 self.test_pkg = test_pkg | 60 self.test_pkg = test_pkg |
60 # Use the correct command line file for the package under test. | 61 # Use the correct command line file for the package under test. |
61 cmdline_file = [a.cmdline_file for a in constants.PACKAGE_INFO.itervalues() | 62 cmdline_file = [a.cmdline_file for a in constants.PACKAGE_INFO.itervalues() |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 except device_errors.CommandTimeoutError as e: | 363 except device_errors.CommandTimeoutError as e: |
363 results.AddResult(test_result.InstrumentationTestResult( | 364 results.AddResult(test_result.InstrumentationTestResult( |
364 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, | 365 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, |
365 log=str(e) or 'No information')) | 366 log=str(e) or 'No information')) |
366 except device_errors.DeviceUnreachableError as e: | 367 except device_errors.DeviceUnreachableError as e: |
367 results.AddResult(test_result.InstrumentationTestResult( | 368 results.AddResult(test_result.InstrumentationTestResult( |
368 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, | 369 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, |
369 log=str(e) or 'No information')) | 370 log=str(e) or 'No information')) |
370 self.TestTeardown(test, results) | 371 self.TestTeardown(test, results) |
371 return (results, None if results.DidRunPass() else test) | 372 return (results, None if results.DidRunPass() else test) |
OLD | NEW |