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

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

Issue 10957052: Adapt python scripts to use the new Forwarder2 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
« no previous file with comments | « build/android/pylib/forwarder.py ('k') | tools/android/forwarder2/host_controller.cc » ('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 """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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 self.wait_for_debugger = options.wait_for_debugger 123 self.wait_for_debugger = options.wait_for_debugger
124 124
125 self.tests_iter = tests_iter 125 self.tests_iter = tests_iter
126 self.coverage = coverage 126 self.coverage = coverage
127 self.apks = apks 127 self.apks = apks
128 self.test_apk = apks[0] 128 self.test_apk = apks[0]
129 self.instrumentation_class_path = self.test_apk.GetPackageName() 129 self.instrumentation_class_path = self.test_apk.GetPackageName()
130 self.ports_to_forward = ports_to_forward 130 self.ports_to_forward = ports_to_forward
131 131
132 self.test_results = TestResults() 132 self.test_results = TestResults()
133 # List of forwarders created by this instance of TestRunner. 133 self.forwarder = None
134 self.forwarders = []
135 134
136 if self.coverage: 135 if self.coverage:
137 if os.path.exists(TestRunner._COVERAGE_MERGED_FILENAME): 136 if os.path.exists(TestRunner._COVERAGE_MERGED_FILENAME):
138 os.remove(TestRunner._COVERAGE_MERGED_FILENAME) 137 os.remove(TestRunner._COVERAGE_MERGED_FILENAME)
139 if not os.path.exists(TestRunner._COVERAGE_META_INFO_PATH): 138 if not os.path.exists(TestRunner._COVERAGE_META_INFO_PATH):
140 raise FatalTestException('FATAL ERROR in ' + sys.argv[0] + 139 raise FatalTestException('FATAL ERROR in ' + sys.argv[0] +
141 ' : Coverage meta info [' + 140 ' : Coverage meta info [' +
142 TestRunner._COVERAGE_META_INFO_PATH + 141 TestRunner._COVERAGE_META_INFO_PATH +
143 '] does not exist.') 142 '] does not exist.')
144 if (not TestRunner._COVERAGE_WEB_ROOT_DIR or 143 if (not TestRunner._COVERAGE_WEB_ROOT_DIR or
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 # We give different default value to launch HTTP server based on shard index 269 # We give different default value to launch HTTP server based on shard index
271 # because it may have race condition when multiple processes are trying to 270 # because it may have race condition when multiple processes are trying to
272 # launch lighttpd with same port at same time. 271 # launch lighttpd with same port at same time.
273 # This line *must* come before the forwarding below, as it nukes all 272 # This line *must* come before the forwarding below, as it nukes all
274 # the other forwarders. A more comprehensive fix might be to pull the 273 # the other forwarders. A more comprehensive fix might be to pull the
275 # forwarder-killing line up to here, but that might violate assumptions 274 # forwarder-killing line up to here, but that might violate assumptions
276 # implicit in other places. 275 # implicit in other places.
277 self.LaunchTestHttpServer(os.path.join(constants.CHROME_DIR), 276 self.LaunchTestHttpServer(os.path.join(constants.CHROME_DIR),
278 (constants.LIGHTTPD_RANDOM_PORT_FIRST + 277 (constants.LIGHTTPD_RANDOM_PORT_FIRST +
279 self.shard_index)) 278 self.shard_index))
280
281 if self.ports_to_forward: 279 if self.ports_to_forward:
282 for port in self.ports_to_forward: 280 port_pairs = [(port, port) for port in self.ports_to_forward]
283 self.forwarders.append(Forwarder( 281 self.forwarder = Forwarder(
284 self.adb, [(port, port)], self.tool, '127.0.0.1', self.build_type)) 282 self.adb, port_pairs, self.tool, '127.0.0.1', self.build_type)
285 self.CopyTestFilesOnce() 283 self.CopyTestFilesOnce()
286 self.flags.AddFlags(['--enable-test-intents']) 284 self.flags.AddFlags(['--enable-test-intents'])
287 285
288 def TearDown(self): 286 def TearDown(self):
289 """Cleans up the test harness and saves outstanding data from test run.""" 287 """Cleans up the test harness and saves outstanding data from test run."""
290 if self.forwarders: 288 if self.forwarder:
291 for forwarder in self.forwarders: 289 self.forwarder.Close()
292 forwarder.Close()
293 self.GenerateCoverageReportIfNeeded() 290 self.GenerateCoverageReportIfNeeded()
294 super(TestRunner, self).TearDown() 291 super(TestRunner, self).TearDown()
295 292
296 def TestSetup(self, test): 293 def TestSetup(self, test):
297 """Sets up the test harness for running a particular test. 294 """Sets up the test harness for running a particular test.
298 295
299 Args: 296 Args:
300 test: The name of the test that will be run. 297 test: The name of the test that will be run.
301 """ 298 """
302 self.SetupPerfMonitoringIfNeeded(test) 299 self.SetupPerfMonitoringIfNeeded(test)
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 584
588 logging.info('Will run: %s', str(tests)) 585 logging.info('Will run: %s', str(tests))
589 586
590 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger): 587 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger):
591 logging.warning('Coverage / debugger can not be sharded, ' 588 logging.warning('Coverage / debugger can not be sharded, '
592 'using first available device') 589 'using first available device')
593 attached_devices = attached_devices[:1] 590 attached_devices = attached_devices[:1]
594 sharder = TestSharder(attached_devices, options, tests, apks) 591 sharder = TestSharder(attached_devices, options, tests, apks)
595 test_results = sharder.RunShardedTests() 592 test_results = sharder.RunShardedTests()
596 return test_results 593 return test_results
OLDNEW
« no previous file with comments | « build/android/pylib/forwarder.py ('k') | tools/android/forwarder2/host_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698