OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 """Generates test runner factory and tests for GTests.""" | 5 """Generates test runner factory and tests for GTests.""" |
6 | 6 |
7 import fnmatch | 7 import fnmatch |
8 import glob | 8 import glob |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 def Setup(test_options, devices): | 271 def Setup(test_options, devices): |
272 """Create the test runner factory and tests. | 272 """Create the test runner factory and tests. |
273 | 273 |
274 Args: | 274 Args: |
275 test_options: A GTestOptions object. | 275 test_options: A GTestOptions object. |
276 devices: A list of attached devices. | 276 devices: A list of attached devices. |
277 | 277 |
278 Returns: | 278 Returns: |
279 A tuple of (TestRunnerFactory, tests). | 279 A tuple of (TestRunnerFactory, tests). |
280 """ | 280 """ |
281 | |
282 if not ports.ResetTestServerPortAllocation(): | |
283 raise Exception('Failed to reset test server port.') | |
284 | |
285 test_package = test_package_apk.TestPackageApk(test_options.suite_name) | 281 test_package = test_package_apk.TestPackageApk(test_options.suite_name) |
286 if not os.path.exists(test_package.suite_path): | 282 if not os.path.exists(test_package.suite_path): |
287 test_package = test_package_exe.TestPackageExecutable( | 283 test_package = test_package_exe.TestPackageExecutable( |
288 test_options.suite_name) | 284 test_options.suite_name) |
289 if not os.path.exists(test_package.suite_path): | 285 if not os.path.exists(test_package.suite_path): |
290 raise Exception( | 286 raise Exception( |
291 'Did not find %s target. Ensure it has been built.' | 287 'Did not find %s target. Ensure it has been built.' |
292 % test_options.suite_name) | 288 % test_options.suite_name) |
293 logging.warning('Found target %s', test_package.suite_path) | 289 logging.warning('Found target %s', test_package.suite_path) |
294 | 290 |
(...skipping 17 matching lines...) Expand all Loading... |
312 if test_options.gtest_filter: | 308 if test_options.gtest_filter: |
313 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) | 309 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) |
314 | 310 |
315 # Coalesce unit tests into a single test per device | 311 # Coalesce unit tests into a single test per device |
316 if test_options.suite_name != 'content_browsertests': | 312 if test_options.suite_name != 'content_browsertests': |
317 num_devices = len(devices) | 313 num_devices = len(devices) |
318 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] | 314 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] |
319 tests = [t for t in tests if t] | 315 tests = [t for t in tests if t] |
320 | 316 |
321 return (TestRunnerFactory, tests) | 317 return (TestRunnerFactory, tests) |
OLD | NEW |