Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1475)

Side by Side Diff: build/android/pylib/instrumentation/test_runner.py

Issue 294113003: [Android] Convert to DeviceUtils versions of WaitUntilFullyBooted and GetExternalStoragePath. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/gtest/test_runner.py ('k') | build/android/pylib/screenshot.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 # TODO(frankf): Implement a general approach for copying/installing 97 # TODO(frankf): Implement a general approach for copying/installing
98 # once across test runners. 98 # once across test runners.
99 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False): 99 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False):
100 logging.warning('Already copied test files to device %s, skipping.', 100 logging.warning('Already copied test files to device %s, skipping.',
101 self.device.old_interface.GetDevice()) 101 self.device.old_interface.GetDevice())
102 return 102 return
103 103
104 test_data = _GetDataFilesForTestSuite(self.test_pkg.GetApkName()) 104 test_data = _GetDataFilesForTestSuite(self.test_pkg.GetApkName())
105 if test_data: 105 if test_data:
106 # Make sure SD card is ready. 106 # Make sure SD card is ready.
107 self.device.old_interface.WaitForSdCardReady(20) 107 self.device.WaitUntilFullyBooted(timeout=20)
108 for p in test_data: 108 for p in test_data:
109 self.device.old_interface.PushIfNeeded( 109 self.device.old_interface.PushIfNeeded(
110 os.path.join(constants.DIR_SOURCE_ROOT, p), 110 os.path.join(constants.DIR_SOURCE_ROOT, p),
111 os.path.join(self.device.old_interface.GetExternalStorage(), p)) 111 os.path.join(self.device.GetExternalStoragePath(), p))
112 112
113 # TODO(frankf): Specify test data in this file as opposed to passing 113 # TODO(frankf): Specify test data in this file as opposed to passing
114 # as command-line. 114 # as command-line.
115 for dest_host_pair in self.options.test_data: 115 for dest_host_pair in self.options.test_data:
116 dst_src = dest_host_pair.split(':', 1) 116 dst_src = dest_host_pair.split(':', 1)
117 dst_layer = dst_src[0] 117 dst_layer = dst_src[0]
118 host_src = dst_src[1] 118 host_src = dst_src[1]
119 host_test_files_path = '%s/%s' % (constants.DIR_SOURCE_ROOT, host_src) 119 host_test_files_path = '%s/%s' % (constants.DIR_SOURCE_ROOT, host_src)
120 if os.path.exists(host_test_files_path): 120 if os.path.exists(host_test_files_path):
121 self.device.old_interface.PushIfNeeded( 121 self.device.old_interface.PushIfNeeded(
122 host_test_files_path, 122 host_test_files_path,
123 '%s/%s/%s' % ( 123 '%s/%s/%s' % (
124 self.device.old_interface.GetExternalStorage(), 124 self.device.GetExternalStoragePath(),
125 TestRunner._DEVICE_DATA_DIR, 125 TestRunner._DEVICE_DATA_DIR,
126 dst_layer)) 126 dst_layer))
127 self.tool.CopyFiles() 127 self.tool.CopyFiles()
128 TestRunner._DEVICE_HAS_TEST_FILES[ 128 TestRunner._DEVICE_HAS_TEST_FILES[
129 self.device.old_interface.GetDevice()] = True 129 self.device.old_interface.GetDevice()] = True
130 130
131 def _GetInstrumentationArgs(self): 131 def _GetInstrumentationArgs(self):
132 ret = {} 132 ret = {}
133 if self.options.wait_for_debugger: 133 if self.options.wait_for_debugger:
134 ret['debug'] = 'true' 134 ret['debug'] = 'true'
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 self.SetupPerfMonitoringIfNeeded(test) 177 self.SetupPerfMonitoringIfNeeded(test)
178 self._SetupIndividualTestTimeoutScale(test) 178 self._SetupIndividualTestTimeoutScale(test)
179 self.tool.SetupEnvironment() 179 self.tool.SetupEnvironment()
180 180
181 # Make sure the forwarder is still running. 181 # Make sure the forwarder is still running.
182 self._RestartHttpServerForwarderIfNecessary() 182 self._RestartHttpServerForwarderIfNecessary()
183 183
184 if self.coverage_dir: 184 if self.coverage_dir:
185 coverage_basename = '%s.ec' % test 185 coverage_basename = '%s.ec' % test
186 self.coverage_device_file = '%s/%s/%s' % ( 186 self.coverage_device_file = '%s/%s/%s' % (
187 self.device.old_interface.GetExternalStorage(), 187 self.device.GetExternalStoragePath(),
188 TestRunner._DEVICE_COVERAGE_DIR, coverage_basename) 188 TestRunner._DEVICE_COVERAGE_DIR, coverage_basename)
189 self.coverage_host_file = os.path.join( 189 self.coverage_host_file = os.path.join(
190 self.coverage_dir, coverage_basename) 190 self.coverage_dir, coverage_basename)
191 191
192 def _IsPerfTest(self, test): 192 def _IsPerfTest(self, test):
193 """Determines whether a test is a performance test. 193 """Determines whether a test is a performance test.
194 194
195 Args: 195 Args:
196 test: The name of the test to be checked. 196 test: The name of the test to be checked.
197 197
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 duration_ms = 0 383 duration_ms = 0
384 message = str(e) 384 message = str(e)
385 if not message: 385 if not message:
386 message = 'No information.' 386 message = 'No information.'
387 results.AddResult(test_result.InstrumentationTestResult( 387 results.AddResult(test_result.InstrumentationTestResult(
388 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, 388 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms,
389 log=message)) 389 log=message))
390 raw_result = None 390 raw_result = None
391 self.TestTeardown(test, raw_result) 391 self.TestTeardown(test, raw_result)
392 return (results, None if results.DidRunPass() else test) 392 return (results, None if results.DidRunPass() else test)
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/test_runner.py ('k') | build/android/pylib/screenshot.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698