| 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 shutil | 10 import shutil |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 # once across test runners. | 97 # once across test runners. |
| 98 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False): | 98 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False): |
| 99 logging.warning('Already copied test files to device %s, skipping.', | 99 logging.warning('Already copied test files to device %s, skipping.', |
| 100 self.device) | 100 self.device) |
| 101 return | 101 return |
| 102 | 102 |
| 103 test_data = _GetDataFilesForTestSuite(self.test_pkg.GetApkName()) | 103 test_data = _GetDataFilesForTestSuite(self.test_pkg.GetApkName()) |
| 104 if test_data: | 104 if test_data: |
| 105 # Make sure SD card is ready. | 105 # Make sure SD card is ready. |
| 106 self.adb.WaitForSdCardReady(20) | 106 self.adb.WaitForSdCardReady(20) |
| 107 for data in test_data: | 107 for p in test_data: |
| 108 self.CopyTestData([data], self.adb.GetExternalStorage()) | 108 self.adb.PushIfNeeded( |
| 109 os.path.join(constants.DIR_SOURCE_ROOT, p), |
| 110 os.path.join(self.adb.GetExternalStorage(), p)) |
| 109 | 111 |
| 110 # TODO(frankf): Specify test data in this file as opposed to passing | 112 # TODO(frankf): Specify test data in this file as opposed to passing |
| 111 # as command-line. | 113 # as command-line. |
| 112 for dest_host_pair in self.test_data: | 114 for dest_host_pair in self.test_data: |
| 113 dst_src = dest_host_pair.split(':',1) | 115 dst_src = dest_host_pair.split(':',1) |
| 114 dst_layer = dst_src[0] | 116 dst_layer = dst_src[0] |
| 115 host_src = dst_src[1] | 117 host_src = dst_src[1] |
| 116 host_test_files_path = constants.DIR_SOURCE_ROOT + '/' + host_src | 118 host_test_files_path = constants.DIR_SOURCE_ROOT + '/' + host_src |
| 117 if os.path.exists(host_test_files_path): | 119 if os.path.exists(host_test_files_path): |
| 118 self.adb.PushIfNeeded(host_test_files_path, | 120 self.adb.PushIfNeeded(host_test_files_path, |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 duration_ms = 0 | 349 duration_ms = 0 |
| 348 message = str(e) | 350 message = str(e) |
| 349 if not message: | 351 if not message: |
| 350 message = 'No information.' | 352 message = 'No information.' |
| 351 results.AddResult(test_result.InstrumentationTestResult( | 353 results.AddResult(test_result.InstrumentationTestResult( |
| 352 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, | 354 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, |
| 353 log=message)) | 355 log=message)) |
| 354 raw_result = None | 356 raw_result = None |
| 355 self.TestTeardown(test, raw_result) | 357 self.TestTeardown(test, raw_result) |
| 356 return (results, None if results.DidRunPass() else test) | 358 return (results, None if results.DidRunPass() else test) |
| OLD | NEW |