summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorjbudorick <jbudorick@chromium.org>2015-09-18 12:00:15 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-18 19:00:52 +0000
commit7ee0f6500b822ffad9586e033c2c4b07bd202089 (patch)
tree360409a5053f6e8ab5356542635de17df3e6977f /build
parent605b8939b63975fc3cf960bec96d58a3578543a6 (diff)
downloadchromium_src-7ee0f6500b822ffad9586e033c2c4b07bd202089.zip
chromium_src-7ee0f6500b822ffad9586e033c2c4b07bd202089.tar.gz
chromium_src-7ee0f6500b822ffad9586e033c2c4b07bd202089.tar.bz2
Revert of [Android] Switch gtests to platform mode. (patchset #6 id:100001 of https://codereview.chromium.org/1315953007/ )
Reason for revert: problems with how this handles single-device failures :( Original issue's description: > [Android] Switch gtests to platform mode. > > BUG=428729 > > Committed: https://crrev.com/b9b0adaf3fad94a9a85ad9d41eec2fa41141319a > Cr-Commit-Position: refs/heads/master@{#349526} TBR=mikecase@chromium.org,rnephew@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=428729 Review URL: https://codereview.chromium.org/1355883002 Cr-Commit-Position: refs/heads/master@{#349729}
Diffstat (limited to 'build')
-rw-r--r--build/android/pylib/base/test_run_factory.py2
-rw-r--r--build/android/pylib/gtest/gtest_test_instance.py6
-rw-r--r--build/android/pylib/gtest/local_device_gtest_run.py (renamed from build/android/pylib/local/device/local_device_gtest_run.py)22
-rw-r--r--build/android/pylib/gtest/test_package_apk.py6
-rwxr-xr-xbuild/android/test_runner.py17
5 files changed, 25 insertions, 28 deletions
diff --git a/build/android/pylib/base/test_run_factory.py b/build/android/pylib/base/test_run_factory.py
index 72b22bc..8c71ebb 100644
--- a/build/android/pylib/base/test_run_factory.py
+++ b/build/android/pylib/base/test_run_factory.py
@@ -3,9 +3,9 @@
# found in the LICENSE file.
from pylib.gtest import gtest_test_instance
+from pylib.gtest import local_device_gtest_run
from pylib.instrumentation import instrumentation_test_instance
from pylib.local.device import local_device_environment
-from pylib.local.device import local_device_gtest_run
from pylib.local.device import local_device_instrumentation_test_run
from pylib.remote.device import remote_device_environment
from pylib.remote.device import remote_device_gtest_run
diff --git a/build/android/pylib/gtest/gtest_test_instance.py b/build/android/pylib/gtest/gtest_test_instance.py
index 95e1065..e7f254f 100644
--- a/build/android/pylib/gtest/gtest_test_instance.py
+++ b/build/android/pylib/gtest/gtest_test_instance.py
@@ -23,8 +23,6 @@ BROWSER_TEST_SUITES = [
'content_browsertests',
]
-RUN_IN_SUB_THREAD_TEST_SUITES = ['net_unittests']
-
_DEFAULT_ISOLATE_FILE_PATHS = {
'base_unittests': 'base/base_unittests.isolate',
@@ -75,8 +73,6 @@ _DEPS_EXCLUSION_LIST = [
_EXTRA_NATIVE_TEST_ACTIVITY = (
'org.chromium.native_test.NativeTestInstrumentationTestRunner.'
'NativeTestActivity')
-_EXTRA_RUN_IN_SUB_THREAD = (
- 'org.chromium.native_test.NativeTestActivity.RunInSubThread')
_EXTRA_SHARD_SIZE_LIMIT = (
'org.chromium.native_test.NativeTestInstrumentationTestRunner.'
'ShardSizeLimit')
@@ -152,8 +148,6 @@ class GtestTestInstance(test_instance.TestInstance):
self._extras = {
_EXTRA_NATIVE_TEST_ACTIVITY: self._activity,
}
- if self._suite in RUN_IN_SUB_THREAD_TEST_SUITES:
- self._extras[_EXTRA_RUN_IN_SUB_THREAD] = 1
if self._suite in BROWSER_TEST_SUITES:
self._extras[_EXTRA_SHARD_SIZE_LIMIT] = 1
diff --git a/build/android/pylib/local/device/local_device_gtest_run.py b/build/android/pylib/gtest/local_device_gtest_run.py
index fda3c55..6960b4f 100644
--- a/build/android/pylib/local/device/local_device_gtest_run.py
+++ b/build/android/pylib/gtest/local_device_gtest_run.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import itertools
+import logging
import os
import posixpath
@@ -107,13 +108,10 @@ class _ExeDelegate(object):
device.PushChangedFiles(host_device_tuples)
def Run(self, test, device, flags=None, **kwargs):
- tool = self._test_run.GetTool(device).GetTestWrapper()
- if tool:
- cmd = [tool]
- else:
- cmd = []
- cmd.append(self._exe_device_path)
-
+ cmd = [
+ self._test_run.GetTool(device).GetTestWrapper(),
+ self._exe_device_path,
+ ]
if test:
cmd.append('--gtest_filter=%s' % ':'.join(test))
if flags:
@@ -132,8 +130,14 @@ class _ExeDelegate(object):
except (device_errors.CommandFailedError, KeyError):
pass
- output = device.RunShellCommand(
- cmd, cwd=cwd, env=env, check_return=True, large_output=True, **kwargs)
+ # TODO(jbudorick): Switch to just RunShellCommand once perezju@'s CL
+ # for long shell commands lands.
+ with device_temp_file.DeviceTempFile(device.adb) as script_file:
+ script_contents = ' '.join(cmd)
+ logging.info('script contents: %r', script_contents)
+ device.WriteFile(script_file.name, script_contents)
+ output = device.RunShellCommand(['sh', script_file.name], cwd=cwd,
+ env=env, **kwargs)
return output
def PullAppFiles(self, device, files, directory):
diff --git a/build/android/pylib/gtest/test_package_apk.py b/build/android/pylib/gtest/test_package_apk.py
index c7fa54f..1a65be5 100644
--- a/build/android/pylib/gtest/test_package_apk.py
+++ b/build/android/pylib/gtest/test_package_apk.py
@@ -16,8 +16,8 @@ from devil.android.sdk import intent
from pylib import constants
from pylib import pexpect
from pylib.gtest import gtest_test_instance
+from pylib.gtest import local_device_gtest_run
from pylib.gtest.test_package import TestPackage
-from pylib.local.device import local_device_gtest_run
class TestPackageApk(TestPackage):
@@ -40,9 +40,7 @@ class TestPackageApk(TestPackage):
self._package_info = constants.PACKAGE_INFO['gtest']
if suite_name == 'net_unittests':
- self._extras = {
- 'org.chromium.native_test.NativeTestActivity.RunInSubThread': None
- }
+ self._extras = {'RunInSubThread': None}
else:
self._extras = []
diff --git a/build/android/test_runner.py b/build/android/test_runner.py
index 8088ad2..235d45b 100755
--- a/build/android/test_runner.py
+++ b/build/android/test_runner.py
@@ -32,6 +32,8 @@ from pylib.base import test_dispatcher
from pylib.base import test_instance_factory
from pylib.base import test_run_factory
from pylib.gtest import gtest_config
+# TODO(jbudorick): Remove this once we stop selectively enabling platform mode.
+from pylib.gtest import gtest_test_instance
from pylib.gtest import setup as gtest_setup
from pylib.gtest import test_options as gtest_test_options
from pylib.linker import setup as linker_setup
@@ -942,7 +944,9 @@ def RunTestsCommand(args, parser): # pylint: disable=too-many-return-statements
raise Exception('Failed to reset test server port.')
if command == 'gtest':
- return RunTestsInPlatformMode(args, parser)
+ if args.suite_name[0] in gtest_test_instance.BROWSER_TEST_SUITES:
+ return RunTestsInPlatformMode(args, parser)
+ return _RunGTests(args, devices)
elif command == 'linker':
return _RunLinkerTests(args, devices)
elif command == 'instrumentation':
@@ -971,16 +975,13 @@ _SUPPORTED_IN_PLATFORM_MODE = [
def RunTestsInPlatformMode(args, parser):
- def infra_error(message):
- parser.exit(status=constants.INFRA_EXIT_CODE, message=message)
-
if args.command not in _SUPPORTED_IN_PLATFORM_MODE:
- infra_error('%s is not yet supported in platform mode' % args.command)
+ parser.error('%s is not yet supported in platform mode' % args.command)
- with environment_factory.CreateEnvironment(args, infra_error) as env:
- with test_instance_factory.CreateTestInstance(args, infra_error) as test:
+ with environment_factory.CreateEnvironment(args, parser.error) as env:
+ with test_instance_factory.CreateTestInstance(args, parser.error) as test:
with test_run_factory.CreateTestRun(
- args, env, test, infra_error) as test_run:
+ args, env, test, parser.error) as test_run:
results = test_run.RunTests()
if args.environment == 'remote_device' and args.trigger: