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

Unified Diff: build/android/pylib/run_java_tests.py

Issue 11148018: Upstream the android python scripts changes that enable the new Forwarder2 to be used in our test f… (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/ports.py ('k') | build/android/run_instrumentation_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/run_java_tests.py
diff --git a/build/android/pylib/run_java_tests.py b/build/android/pylib/run_java_tests.py
index bf51bad943b928c03d309a37b975697f3285cddc..85256bf405b010a95907143cc22396010675aca2 100644
--- a/build/android/pylib/run_java_tests.py
+++ b/build/android/pylib/run_java_tests.py
@@ -130,8 +130,7 @@ class TestRunner(BaseTestRunner):
self.ports_to_forward = ports_to_forward
self.test_results = TestResults()
- # List of forwarders created by this instance of TestRunner.
- self.forwarders = []
+ self.forwarder = None
if self.coverage:
if os.path.exists(TestRunner._COVERAGE_MERGED_FILENAME):
@@ -270,26 +269,23 @@ class TestRunner(BaseTestRunner):
# We give different default value to launch HTTP server based on shard index
# because it may have race condition when multiple processes are trying to
# launch lighttpd with same port at same time.
- # This line *must* come before the forwarding below, as it nukes all
- # the other forwarders. A more comprehensive fix might be to pull the
- # forwarder-killing line up to here, but that might violate assumptions
- # implicit in other places.
- self.LaunchTestHttpServer(os.path.join(constants.CHROME_DIR),
- (constants.LIGHTTPD_RANDOM_PORT_FIRST +
- self.shard_index))
-
+ http_server_ports = self.LaunchTestHttpServer(
+ os.path.join(constants.CHROME_DIR),
+ (constants.LIGHTTPD_RANDOM_PORT_FIRST + self.shard_index))
if self.ports_to_forward:
- for port in self.ports_to_forward:
- self.forwarders.append(Forwarder(
- self.adb, [(port, port)], self.tool, '127.0.0.1', self.build_type))
+ port_pairs = [(port, port) for port in self.ports_to_forward]
+ # We need to remember which ports the HTTP server is using, since the
+ # forwarder will stomp on them otherwise.
+ port_pairs.append(http_server_ports)
+ self.forwarder = Forwarder(
+ self.adb, port_pairs, self.tool, '127.0.0.1', self.build_type)
self.CopyTestFilesOnce()
self.flags.AddFlags(['--enable-test-intents'])
def TearDown(self):
"""Cleans up the test harness and saves outstanding data from test run."""
- if self.forwarders:
- for forwarder in self.forwarders:
- forwarder.Close()
+ if self.forwarder:
+ self.forwarder.Close()
self.GenerateCoverageReportIfNeeded()
super(TestRunner, self).TearDown()
« no previous file with comments | « build/android/pylib/ports.py ('k') | build/android/run_instrumentation_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698