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

Side by Side Diff: build/android/pylib/run_java_tests.py

Issue 11348202: Specify the test files to be used as an argument to the instrumentation tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Specify the test files to be used as an argument to the instrumentation tests - code review fixes Created 8 years, 1 month 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 """Runs the Java tests. See more information on run_instrumentation_tests.py.""" 5 """Runs the Java tests. See more information on run_instrumentation_tests.py."""
6 6
7 import fnmatch 7 import fnmatch
8 import logging 8 import logging
9 import os 9 import os
10 import re 10 import re
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 """ 111 """
112 BaseTestRunner.__init__( 112 BaseTestRunner.__init__(
113 self, device, options.tool, shard_index, options.build_type) 113 self, device, options.tool, shard_index, options.build_type)
114 114
115 if not apks: 115 if not apks:
116 apks = [apk_info.ApkInfo(options.test_apk_path, 116 apks = [apk_info.ApkInfo(options.test_apk_path,
117 options.test_apk_jar_path)] 117 options.test_apk_jar_path)]
118 118
119 self.build_type = options.build_type 119 self.build_type = options.build_type
120 self.install_apk = options.install_apk 120 self.install_apk = options.install_apk
121 self.test_data = options.test_data
121 self.save_perf_json = options.save_perf_json 122 self.save_perf_json = options.save_perf_json
122 self.screenshot_failures = options.screenshot_failures 123 self.screenshot_failures = options.screenshot_failures
123 self.wait_for_debugger = options.wait_for_debugger 124 self.wait_for_debugger = options.wait_for_debugger
124 self.disable_assertions = options.disable_assertions 125 self.disable_assertions = options.disable_assertions
125 126
126 self.tests_iter = tests_iter 127 self.tests_iter = tests_iter
127 self.coverage = coverage 128 self.coverage = coverage
128 self.apks = apks 129 self.apks = apks
129 self.test_apk = apks[0] 130 self.test_apk = apks[0]
130 self.instrumentation_class_path = self.test_apk.GetPackageName() 131 self.instrumentation_class_path = self.test_apk.GetPackageName()
(...skipping 24 matching lines...) Expand all
155 self.tests_iter = (BaseTestSharder.tests_container) 156 self.tests_iter = (BaseTestSharder.tests_container)
156 assert self.tests_iter 157 assert self.tests_iter
157 return self.tests_iter 158 return self.tests_iter
158 159
159 def CopyTestFilesOnce(self): 160 def CopyTestFilesOnce(self):
160 """Pushes the test data files to the device. Installs the apk if opted.""" 161 """Pushes the test data files to the device. Installs the apk if opted."""
161 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False): 162 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False):
162 logging.warning('Already copied test files to device %s, skipping.', 163 logging.warning('Already copied test files to device %s, skipping.',
163 self.device) 164 self.device)
164 return 165 return
165 host_test_files = [ 166 for dest_host_pair in self.test_data:
166 ('android_webview/test/data/device_files', 'webview'), 167 dst_src = dest_host_pair.split(':',1)
167 ('content/test/data/android/device_files', 'content'), 168 dst_layer = dst_src[0]
168 ('chrome/test/data/android/device_files', 'chrome') 169 host_src = dst_src[1]
169 ]
170 for (host_src, dst_layer) in host_test_files:
171 host_test_files_path = constants.CHROME_DIR + '/' + host_src 170 host_test_files_path = constants.CHROME_DIR + '/' + host_src
172 if os.path.exists(host_test_files_path): 171 if os.path.exists(host_test_files_path):
173 self.adb.PushIfNeeded(host_test_files_path, 172 self.adb.PushIfNeeded(host_test_files_path,
174 self.adb.GetExternalStorage() + '/' + 173 self.adb.GetExternalStorage() + '/' +
175 TestRunner._DEVICE_DATA_DIR + '/' + dst_layer) 174 TestRunner._DEVICE_DATA_DIR + '/' + dst_layer)
176 if self.install_apk: 175 if self.install_apk:
177 for apk in self.apks: 176 for apk in self.apks:
178 self.adb.ManagedInstall(apk.GetApkPath(), 177 self.adb.ManagedInstall(apk.GetApkPath(),
179 package_name=apk.GetPackageName()) 178 package_name=apk.GetPackageName())
180 self.tool.CopyFiles() 179 self.tool.CopyFiles()
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 573
575 logging.info('Will run: %s', str(tests)) 574 logging.info('Will run: %s', str(tests))
576 575
577 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger): 576 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger):
578 logging.warning('Coverage / debugger can not be sharded, ' 577 logging.warning('Coverage / debugger can not be sharded, '
579 'using first available device') 578 'using first available device')
580 attached_devices = attached_devices[:1] 579 attached_devices = attached_devices[:1]
581 sharder = TestSharder(attached_devices, options, tests, apks) 580 sharder = TestSharder(attached_devices, options, tests, apks)
582 test_results = sharder.RunShardedTests() 581 test_results = sharder.RunShardedTests()
583 return test_results 582 return test_results
OLDNEW
« no previous file with comments | « build/android/buildbot/buildbot_functions.sh ('k') | build/android/pylib/test_options_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698