Chromium Code Reviews| Index: build/android/pylib/gtest/test_runner.py |
| diff --git a/build/android/pylib/gtest/test_runner.py b/build/android/pylib/gtest/test_runner.py |
| index 9a429dc2b7e58bf529d65b8067345c408f04016f..a040e564d80b859c9522e93f1ef8d50871d2fab4 100644 |
| --- a/build/android/pylib/gtest/test_runner.py |
| +++ b/build/android/pylib/gtest/test_runner.py |
| @@ -5,8 +5,10 @@ |
| import glob |
| import logging |
| import os |
| +import sys |
| from pylib import android_commands |
| +from pylib import cmd_helper |
| from pylib import constants |
| from pylib import perf_tests_helper |
| from pylib.android_commands import errors |
| @@ -17,24 +19,62 @@ from pylib.utils import run_tests_helper |
| import test_package_apk |
| import test_package_executable |
| +sys.path.insert( |
| + 0, os.path.join(constants.DIR_SOURCE_ROOT, 'tools', 'swarm_client')) |
| +import run_isolated |
| -def _GetDataFilesForTestSuite(test_suite_basename): |
| + |
| +_ISOLATE_FILE_PATHS = { |
| + 'base_unittests': 'base/base_unittests.isolate', |
| + #'net_unittests': 'net/net_unittests.isolate', |
| + #'unit_tests': 'chrome/unit_tests.isolate', |
| + #'content_browsertests': 'content/content_browsertests.isolate', |
| + #'content_unittests': 'content/content_unittests.isolate', |
| + } |
| +_ISOLATE_SCRIPT = os.path.join( |
| + constants.DIR_SOURCE_ROOT, 'tools', 'swarm_client', 'isolate.py') |
| + |
| + |
| +def _GetDataFilesForTestSuite(product_dir, test_suite_basename): |
| """Returns a list of data files/dirs needed by the test suite. |
| Args: |
| - test_suite_basename: The test suite basename for which to return file paths. |
| + product_dir: Absolute path to product directory (e.g. /../out/Debug). |
| + test_suite_basename: The test suite basename (e.g. base_unittests). |
| Returns: |
| A list of test file and directory paths. |
| """ |
| + # TODO(frankf): *.isolated should be generated by gyp using foo_tests_run |
| + # targets. This is a stop-gap solution as currently there are no such |
| + # targets for content_unittests and content_browsertests. |
| + isolate_rel_path = _ISOLATE_FILE_PATHS.get(test_suite_basename) |
| + if isolate_rel_path: |
| + isolate_abs_path = os.path.join(constants.DIR_SOURCE_ROOT, isolate_rel_path) |
| + isolated_abs_path = os.path.join( |
| + product_dir, '%s.isolated' % test_suite_basename) |
| + assert os.path.exists(isolate_abs_path) |
| + isolate_cmd = [ |
| + 'python', _ISOLATE_SCRIPT, |
| + 'check', |
| + '--isolate=%s' % isolate_abs_path, |
|
csharp
2013/06/28 13:12:17
I don't think you need to specify the .isolate fil
frankf
2013/06/28 18:32:46
There's no isolated file at this point, that's wha
csharp
2013/06/28 19:01:05
Ah, right. I thought you were performing an action
|
| + '--isolated=%s' % isolated_abs_path, |
| + '-V', 'PRODUCT_DIR=%s' % product_dir, |
| + '-V', 'OS=android', |
| + '--outdir=%s' % product_dir, |
| + ] |
| + assert not cmd_helper.RunCmd(isolate_cmd) |
| + with open(isolated_abs_path) as f: |
| + isolated_content = run_isolated.load_isolated(f.read(), |
| + os_flavor='android') |
| + assert isolated_content['os'] == 'android' |
| + return isolated_content['files'].keys() |
| + |
| + logging.info('Did not find an isolate file for the test suite.') |
| # Ideally, we'd just push all test data. However, it has >100MB, and a lot |
| # of the files are not relevant (some are used for browser_tests, others for |
| # features not supported, etc..). |
| - if test_suite_basename == 'base_unittests': |
| - return [ |
| - 'base/test/data/', |
| - ] |
| - elif test_suite_basename == 'unit_tests': |
| + if test_suite_basename == 'unit_tests': |
| test_files = [ |
| 'base/test/data/', |
| 'chrome/test/data/download-test1.lib', |
| @@ -265,7 +305,8 @@ class TestRunner(base_test_runner.BaseTestRunner): |
| def PushDataDeps(self): |
| self.test_package.PushDataAndPakFiles() |
| self.tool.CopyFiles() |
| - test_data = _GetDataFilesForTestSuite(self.test_package.test_suite_basename) |
| + test_data = _GetDataFilesForTestSuite(self.test_package.test_suite_dirname, |
| + self.test_package.test_suite_basename) |
| if test_data: |
| # Make sure SD card is ready. |
| self.adb.WaitForSdCardReady(20) |