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

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

Issue 646523002: [Android] Add zip pushing and refine push mode selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 #override 93 #override
94 def PushDataDeps(self): 94 def PushDataDeps(self):
95 # TODO(frankf): Implement a general approach for copying/installing 95 # TODO(frankf): Implement a general approach for copying/installing
96 # once across test runners. 96 # once across test runners.
97 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False): 97 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False):
98 logging.warning('Already copied test files to device %s, skipping.', 98 logging.warning('Already copied test files to device %s, skipping.',
99 str(self.device)) 99 str(self.device))
100 return 100 return
101 101
102 host_device_file_tuples = []
102 test_data = _GetDataFilesForTestSuite(self.test_pkg.GetApkName()) 103 test_data = _GetDataFilesForTestSuite(self.test_pkg.GetApkName())
103 if test_data: 104 if test_data:
104 # Make sure SD card is ready. 105 # Make sure SD card is ready.
105 self.device.WaitUntilFullyBooted(timeout=20) 106 self.device.WaitUntilFullyBooted(timeout=20)
106 for p in test_data: 107 host_device_file_tuples += [
107 self.device.PushChangedFiles( 108 (os.path.join(constants.DIR_SOURCE_ROOT, p),
108 os.path.join(constants.DIR_SOURCE_ROOT, p), 109 os.path.join(self.device.GetExternalStoragePath(), p))
109 os.path.join(self.device.GetExternalStoragePath(), p)) 110 for p in test_data]
110 111
111 # 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
112 # as command-line. 113 # as command-line.
113 for dest_host_pair in self.options.test_data: 114 for dest_host_pair in self.options.test_data:
114 dst_src = dest_host_pair.split(':', 1) 115 dst_src = dest_host_pair.split(':', 1)
115 dst_layer = dst_src[0] 116 dst_layer = dst_src[0]
116 host_src = dst_src[1] 117 host_src = dst_src[1]
117 host_test_files_path = os.path.join(constants.DIR_SOURCE_ROOT, 118 host_test_files_path = os.path.join(constants.DIR_SOURCE_ROOT,
118 host_src) 119 host_src)
119 if os.path.exists(host_test_files_path): 120 if os.path.exists(host_test_files_path):
120 self.device.PushChangedFiles( 121 host_device_file_tuples += [(
121 host_test_files_path, 122 host_test_files_path,
122 '%s/%s/%s' % ( 123 '%s/%s/%s' % (
123 self.device.GetExternalStoragePath(), 124 self.device.GetExternalStoragePath(),
124 TestRunner._DEVICE_DATA_DIR, 125 TestRunner._DEVICE_DATA_DIR,
125 dst_layer)) 126 dst_layer))]
127 if host_device_file_tuples:
128 self.device.PushChangedFiles(host_device_file_tuples)
126 self.tool.CopyFiles() 129 self.tool.CopyFiles()
127 TestRunner._DEVICE_HAS_TEST_FILES[str(self.device)] = True 130 TestRunner._DEVICE_HAS_TEST_FILES[str(self.device)] = True
128 131
129 def _GetInstrumentationArgs(self): 132 def _GetInstrumentationArgs(self):
130 ret = {} 133 ret = {}
131 if self.options.wait_for_debugger: 134 if self.options.wait_for_debugger:
132 ret['debug'] = 'true' 135 ret['debug'] = 'true'
133 if self.coverage_dir: 136 if self.coverage_dir:
134 ret['coverage'] = 'true' 137 ret['coverage'] = 'true'
135 ret['coverageFile'] = self.coverage_device_file 138 ret['coverageFile'] = self.coverage_device_file
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 except device_errors.CommandTimeoutError as e: 505 except device_errors.CommandTimeoutError as e:
503 results.AddResult(test_result.InstrumentationTestResult( 506 results.AddResult(test_result.InstrumentationTestResult(
504 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms, 507 test, base_test_result.ResultType.TIMEOUT, start_ms, duration_ms,
505 log=str(e) or 'No information')) 508 log=str(e) or 'No information'))
506 except device_errors.DeviceUnreachableError as e: 509 except device_errors.DeviceUnreachableError as e:
507 results.AddResult(test_result.InstrumentationTestResult( 510 results.AddResult(test_result.InstrumentationTestResult(
508 test, base_test_result.ResultType.CRASH, start_ms, duration_ms, 511 test, base_test_result.ResultType.CRASH, start_ms, duration_ms,
509 log=str(e) or 'No information')) 512 log=str(e) or 'No information'))
510 self.TestTeardown(test, results) 513 self.TestTeardown(test, results)
511 return (results, None if results.DidRunPass() else test) 514 return (results, None if results.DidRunPass() else test)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698