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

Unified Diff: build/android/pylib/gtest/test_runner.py

Issue 18233018: [Android] Use isolate remap instead of check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: webkit_unit_tests depend on third_party/hyphen/hyph_en_US.dic Created 7 years, 5 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/gtest/test_package.py ('k') | build/android/pylib/instrumentation/test_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4e989ba4382f3b020e4bbd81539000275036e85f..4efb9ae33a46345bc60e8492a1c4dc01534918a6 100644
--- a/build/android/pylib/gtest/test_runner.py
+++ b/build/android/pylib/gtest/test_runner.py
@@ -2,15 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-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
from pylib.base import base_test_result
from pylib.base import base_test_runner
@@ -19,109 +15,22 @@ 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
-
-_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):
+# We're moving to using isolate files instead of harcoding
+# dependencies here. Look at the TODO in dispatch.py.
+def _GetDataFilesForTestSuite(test_suite_basename):
"""Returns a list of data files/dirs needed by the test suite.
Args:
- 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,
- '--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':
- test_files = [
- 'base/test/data/',
- 'chrome/test/data/download-test1.lib',
- 'chrome/test/data/extensions/bad_magic.crx',
- 'chrome/test/data/extensions/good.crx',
- 'chrome/test/data/extensions/icon1.png',
- 'chrome/test/data/extensions/icon2.png',
- 'chrome/test/data/extensions/icon3.png',
- 'chrome/test/data/extensions/allow_silent_upgrade/',
- 'chrome/test/data/extensions/app/',
- 'chrome/test/data/extensions/bad/',
- 'chrome/test/data/extensions/effective_host_permissions/',
- 'chrome/test/data/extensions/empty_manifest/',
- 'chrome/test/data/extensions/good/Extensions/',
- 'chrome/test/data/extensions/manifest_tests/',
- 'chrome/test/data/extensions/page_action/',
- 'chrome/test/data/extensions/permissions/',
- 'chrome/test/data/extensions/script_and_capture/',
- 'chrome/test/data/extensions/unpacker/',
- 'chrome/test/data/bookmarks/',
- 'chrome/test/data/components/',
- 'chrome/test/data/extensions/json_schema_test.js',
- 'chrome/test/data/History/',
- 'chrome/test/data/json_schema_validator/',
- 'chrome/test/data/pref_service/',
- 'chrome/test/data/simple_open_search.xml',
- 'chrome/test/data/top_sites/',
- 'chrome/test/data/web_app_info/',
- 'chrome/test/data/webui/',
- 'chrome/third_party/mock4js/',
- 'components/test/data/web_database',
- 'net/data/ssl/certificates',
- 'third_party/accessibility-developer-tools/gen/axs_testing.js',
- 'third_party/zlib/google/test/data',
- ]
- # The following are spell check data. Now only list the data under
- # third_party/hunspell_dictionaries which are used by unit tests.
- old_cwd = os.getcwd()
- os.chdir(constants.DIR_SOURCE_ROOT)
- test_files += glob.glob('third_party/hunspell_dictionaries/*.bdic')
- os.chdir(old_cwd)
- return test_files
- elif test_suite_basename == 'media_unittests':
+ if test_suite_basename == 'media_unittests':
return [
'media/test/data',
]
@@ -257,17 +166,19 @@ class TestRunner(base_test_runner.BaseTestRunner):
test_apk_package_name: Apk package name for tests running in APKs.
test_activity_name: Test activity to invoke for APK tests.
command_line_file: Filename to use to pass arguments to tests.
+ deps_dir: The path to the dependency dir on the host to push to the device.
"""
def __init__(self, device, test_suite, test_arguments, timeout,
cleanup_test_files, tool_name, build_type,
in_webkit_checkout, push_deps, test_apk_package_name=None,
- test_activity_name=None, command_line_file=None):
+ test_activity_name=None, command_line_file=None, deps_dir=None):
super(TestRunner, self).__init__(device, tool_name, build_type, push_deps)
self._running_on_emulator = self.device.startswith('emulator')
self._test_arguments = test_arguments
self.in_webkit_checkout = in_webkit_checkout
self._cleanup_test_files = cleanup_test_files
+ self._deps_dir = deps_dir
logging.warning('Test suite: ' + test_suite)
if os.path.splitext(test_suite)[1] == '.apk':
@@ -301,16 +212,25 @@ class TestRunner(base_test_runner.BaseTestRunner):
#override
def PushDataDeps(self):
+ self.adb.WaitForSdCardReady(20)
self.test_package.PushDataAndPakFiles()
self.tool.CopyFiles()
- 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)
- self.CopyTestData(test_data, self.adb.GetExternalStorage())
if self.test_package.test_suite_basename == 'webkit_unit_tests':
self.PushWebKitUnitTestsData()
+ return
+
+ if not self._deps_dir:
+ logging.info('Did not find an isolate file for the test suite.')
+ for p in _GetDataFilesForTestSuite(self.test_package.test_suite_basename):
+ self.adb.PushIfNeeded(
+ os.path.join(constants.DIR_SOURCE_ROOT, p),
+ os.path.join(self.adb.GetExternalStorage(), p))
+ return
+
+ for p in os.listdir(self._deps_dir):
+ self.adb.PushIfNeeded(
+ os.path.join(self._deps_dir, p),
+ os.path.join(self.adb.GetExternalStorage(), p))
def PushWebKitUnitTestsData(self):
"""Pushes the webkit_unit_tests data files to the device.
@@ -328,6 +248,11 @@ class TestRunner(base_test_runner.BaseTestRunner):
os.path.join(
self.adb.GetExternalStorage(),
'third_party/WebKit/Source/WebKit/chromium/tests/data'))
+ self.adb.PushIfNeeded(
+ os.path.join(constants.DIR_SOURCE_ROOT,
+ 'third_party/hyphen/hyph_en_US.dic'),
+ os.path.join(self.adb.GetExternalStorage(),
+ 'third_party/hyphen/hyph_en_US.dic'))
# TODO(craigdh): There is no reason for this to be part of TestRunner.
def GetDisabledTests(self):
« no previous file with comments | « build/android/pylib/gtest/test_package.py ('k') | build/android/pylib/instrumentation/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698