OLD | NEW |
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 # because it may have race condition when multiple processes are trying to | 269 # because it may have race condition when multiple processes are trying to |
270 # launch lighttpd with same port at same time. | 270 # launch lighttpd with same port at same time. |
271 http_server_ports = self.LaunchTestHttpServer( | 271 http_server_ports = self.LaunchTestHttpServer( |
272 os.path.join(constants.CHROME_DIR), | 272 os.path.join(constants.CHROME_DIR), |
273 (constants.LIGHTTPD_RANDOM_PORT_FIRST + self.shard_index)) | 273 (constants.LIGHTTPD_RANDOM_PORT_FIRST + self.shard_index)) |
274 if self.ports_to_forward: | 274 if self.ports_to_forward: |
275 port_pairs = [(port, port) for port in self.ports_to_forward] | 275 port_pairs = [(port, port) for port in self.ports_to_forward] |
276 # We need to remember which ports the HTTP server is using, since the | 276 # We need to remember which ports the HTTP server is using, since the |
277 # forwarder will stomp on them otherwise. | 277 # forwarder will stomp on them otherwise. |
278 port_pairs.append(http_server_ports) | 278 port_pairs.append(http_server_ports) |
279 self.forwarder = Forwarder( | 279 self.forwarder = Forwarder(self.adb, self.build_type) |
280 self.adb, port_pairs, self.tool, '127.0.0.1', self.build_type) | 280 self.forwarder.Run(port_pairs, self.tool, '127.0.0.1') |
281 self.CopyTestFilesOnce() | 281 self.CopyTestFilesOnce() |
282 self.flags.AddFlags(['--enable-test-intents']) | 282 self.flags.AddFlags(['--enable-test-intents']) |
283 | 283 |
284 def TearDown(self): | 284 def TearDown(self): |
285 """Cleans up the test harness and saves outstanding data from test run.""" | 285 """Cleans up the test harness and saves outstanding data from test run.""" |
286 if self.forwarder: | 286 if self.forwarder: |
287 self.forwarder.Close() | 287 self.forwarder.Close() |
288 self.GenerateCoverageReportIfNeeded() | 288 self.GenerateCoverageReportIfNeeded() |
289 super(TestRunner, self).TearDown() | 289 super(TestRunner, self).TearDown() |
290 | 290 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 message)] | 491 message)] |
492 test_result = None | 492 test_result = None |
493 self.TestTeardown(test, test_result) | 493 self.TestTeardown(test, test_result) |
494 return self.test_results | 494 return self.test_results |
495 | 495 |
496 | 496 |
497 class TestSharder(BaseTestSharder): | 497 class TestSharder(BaseTestSharder): |
498 """Responsible for sharding the tests on the connected devices.""" | 498 """Responsible for sharding the tests on the connected devices.""" |
499 | 499 |
500 def __init__(self, attached_devices, options, tests, apks): | 500 def __init__(self, attached_devices, options, tests, apks): |
501 BaseTestSharder.__init__(self, attached_devices) | 501 BaseTestSharder.__init__(self, attached_devices, options.build_type) |
502 self.options = options | 502 self.options = options |
503 self.tests = tests | 503 self.tests = tests |
504 self.apks = apks | 504 self.apks = apks |
505 | 505 |
506 def SetupSharding(self, tests): | 506 def SetupSharding(self, tests): |
507 """Called before starting the shards.""" | 507 """Called before starting the shards.""" |
508 SetTestsContainer(sharded_tests_queue.ShardedTestsQueue( | 508 SetTestsContainer(sharded_tests_queue.ShardedTestsQueue( |
509 len(self.attached_devices), tests)) | 509 len(self.attached_devices), tests)) |
510 | 510 |
511 def CreateShardedTestRunner(self, device, index): | 511 def CreateShardedTestRunner(self, device, index): |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 582 |
583 logging.info('Will run: %s', str(tests)) | 583 logging.info('Will run: %s', str(tests)) |
584 | 584 |
585 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger): | 585 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger): |
586 logging.warning('Coverage / debugger can not be sharded, ' | 586 logging.warning('Coverage / debugger can not be sharded, ' |
587 'using first available device') | 587 'using first available device') |
588 attached_devices = attached_devices[:1] | 588 attached_devices = attached_devices[:1] |
589 sharder = TestSharder(attached_devices, options, tests, apks) | 589 sharder = TestSharder(attached_devices, options, tests, apks) |
590 test_results = sharder.RunShardedTests() | 590 test_results = sharder.RunShardedTests() |
591 return test_results | 591 return test_results |
OLD | NEW |