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