Commit b71170d0 authored by jbudorick's avatar jbudorick Committed by Commit bot

[Android] Switch instrumentation tests to platform mode. (RELAND 2)

This is a reland of https://codereview.chromium.org/1836883002/

BUG=428729
TBR=yfriedman@chromium.org

Review URL: https://codereview.chromium.org/1839083003

Cr-Commit-Position: refs/heads/master@{#383896}
parent 66736a77
...@@ -29,7 +29,6 @@ public class CommandLineInitUtilTest extends InstrumentationTestCase { ...@@ -29,7 +29,6 @@ public class CommandLineInitUtilTest extends InstrumentationTestCase {
assertTrue("CommandLine not initialized after startup", CommandLine.isInitialized()); assertTrue("CommandLine not initialized after startup", CommandLine.isInitialized());
final CommandLine commandLine = CommandLine.getInstance(); final CommandLine commandLine = CommandLine.getInstance();
assertTrue(commandLine.hasSwitch("disable-fre"));
assertTrue(commandLine.hasSwitch("enable-test-intents")); assertTrue(commandLine.hasSwitch("enable-test-intents"));
} }
} }
...@@ -230,16 +230,17 @@ class InstrumentationTestInstance(test_instance.TestInstance): ...@@ -230,16 +230,17 @@ class InstrumentationTestInstance(test_instance.TestInstance):
self._initializeTestControlAttributes(args) self._initializeTestControlAttributes(args)
def _initializeApkAttributes(self, args, error_func): def _initializeApkAttributes(self, args, error_func):
apk_under_test_path = args.apk_under_test if args.apk_under_test:
if not args.apk_under_test.endswith('.apk'): apk_under_test_path = args.apk_under_test
apk_under_test_path = os.path.join( if not args.apk_under_test.endswith('.apk'):
constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, apk_under_test_path = os.path.join(
'%s.apk' % args.apk_under_test) constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR,
'%s.apk' % args.apk_under_test)
if not os.path.exists(apk_under_test_path): if not os.path.exists(apk_under_test_path):
error_func('Unable to find APK under test: %s' % apk_under_test_path) error_func('Unable to find APK under test: %s' % apk_under_test_path)
self._apk_under_test = apk_helper.ToHelper(apk_under_test_path) self._apk_under_test = apk_helper.ToHelper(apk_under_test_path)
if args.test_apk.endswith('.apk'): if args.test_apk.endswith('.apk'):
self._suite = os.path.splitext(os.path.basename(args.test_apk))[0] self._suite = os.path.splitext(os.path.basename(args.test_apk))[0]
...@@ -290,7 +291,11 @@ class InstrumentationTestInstance(test_instance.TestInstance): ...@@ -290,7 +291,11 @@ class InstrumentationTestInstance(test_instance.TestInstance):
def _initializeDataDependencyAttributes(self, args, isolate_delegate): def _initializeDataDependencyAttributes(self, args, isolate_delegate):
self._data_deps = [] self._data_deps = []
if args.isolate_file_path: if args.isolate_file_path:
self._isolate_abs_path = os.path.abspath(args.isolate_file_path) if os.path.isabs(args.isolate_file_path):
self._isolate_abs_path = args.isolate_file_path
else:
self._isolate_abs_path = os.path.join(
constants.DIR_SOURCE_ROOT, args.isolate_file_path)
self._isolate_delegate = isolate_delegate self._isolate_delegate = isolate_delegate
self._isolated_abs_path = os.path.join( self._isolated_abs_path = os.path.join(
constants.GetOutDirectory(), '%s.isolated' % self._test_package) constants.GetOutDirectory(), '%s.isolated' % self._test_package)
...@@ -309,7 +314,8 @@ class InstrumentationTestInstance(test_instance.TestInstance): ...@@ -309,7 +314,8 @@ class InstrumentationTestInstance(test_instance.TestInstance):
logging.warning('No data dependencies will be pushed.') logging.warning('No data dependencies will be pushed.')
def _initializeTestFilterAttributes(self, args): def _initializeTestFilterAttributes(self, args):
self._test_filter = args.test_filter if args.test_filter:
self._test_filter = args.test_filter.replace('#', '.')
def annotation_dict_element(a): def annotation_dict_element(a):
a = a.split('=') a = a.split('=')
...@@ -340,7 +346,7 @@ class InstrumentationTestInstance(test_instance.TestInstance): ...@@ -340,7 +346,7 @@ class InstrumentationTestInstance(test_instance.TestInstance):
}) })
def _initializeFlagAttributes(self, args): def _initializeFlagAttributes(self, args):
self._flags = ['--disable-fre', '--enable-test-intents'] self._flags = ['--enable-test-intents']
# TODO(jbudorick): Transition "--device-flags" to "--device-flags-file" # TODO(jbudorick): Transition "--device-flags" to "--device-flags-file"
if hasattr(args, 'device_flags') and args.device_flags: if hasattr(args, 'device_flags') and args.device_flags:
with open(args.device_flags) as device_flags_file: with open(args.device_flags) as device_flags_file:
......
...@@ -54,7 +54,7 @@ class LocalDeviceInstrumentationTestRun( ...@@ -54,7 +54,7 @@ class LocalDeviceInstrumentationTestRun(
self._flag_changers = {} self._flag_changers = {}
def TestPackage(self): def TestPackage(self):
return None return self._test_instance.suite
def SetUp(self): def SetUp(self):
def substitute_external_storage(d, external_storage): def substitute_external_storage(d, external_storage):
...@@ -69,15 +69,16 @@ class LocalDeviceInstrumentationTestRun( ...@@ -69,15 +69,16 @@ class LocalDeviceInstrumentationTestRun(
self._env.BlacklistDevice) self._env.BlacklistDevice)
def individual_device_set_up(dev, host_device_tuples): def individual_device_set_up(dev, host_device_tuples):
def install_apk(): def install_apk():
if self._test_instance.apk_under_test_incremental_install_script: if self._test_instance.apk_under_test:
local_device_test_run.IncrementalInstall( if self._test_instance.apk_under_test_incremental_install_script:
dev, local_device_test_run.IncrementalInstall(
self._test_instance.apk_under_test, dev,
self._test_instance.apk_under_test_incremental_install_script) self._test_instance.apk_under_test,
else: self._test_instance.apk_under_test_incremental_install_script)
permissions = self._test_instance.apk_under_test.GetPermissions() else:
dev.Install(self._test_instance.apk_under_test, permissions = self._test_instance.apk_under_test.GetPermissions()
permissions=permissions) dev.Install(self._test_instance.apk_under_test,
permissions=permissions)
if self._test_instance.test_apk_incremental_install_script: if self._test_instance.test_apk_incremental_install_script:
local_device_test_run.IncrementalInstall( local_device_test_run.IncrementalInstall(
......
...@@ -977,7 +977,7 @@ def RunTestsCommand(args): # pylint: disable=too-many-return-statements ...@@ -977,7 +977,7 @@ def RunTestsCommand(args): # pylint: disable=too-many-return-statements
ProcessCommonOptions(args) ProcessCommonOptions(args)
logging.info('command: %s', ' '.join(sys.argv)) logging.info('command: %s', ' '.join(sys.argv))
if args.enable_platform_mode: if args.enable_platform_mode or command in ('gtest', 'instrumentation'):
return RunTestsInPlatformMode(args) return RunTestsInPlatformMode(args)
forwarder.Forwarder.RemoveHostLog() forwarder.Forwarder.RemoveHostLog()
...@@ -988,12 +988,8 @@ def RunTestsCommand(args): # pylint: disable=too-many-return-statements ...@@ -988,12 +988,8 @@ def RunTestsCommand(args): # pylint: disable=too-many-return-statements
return _GetAttachedDevices(args.blacklist_file, args.test_device, return _GetAttachedDevices(args.blacklist_file, args.test_device,
args.enable_device_cache) args.enable_device_cache)
if command == 'gtest': if command == 'linker':
return RunTestsInPlatformMode(args)
elif command == 'linker':
return _RunLinkerTests(args, get_devices()) return _RunLinkerTests(args, get_devices())
elif command == 'instrumentation':
return _RunInstrumentationTests(args, get_devices())
elif command == 'junit': elif command == 'junit':
return _RunJUnitTests(args) return _RunJUnitTests(args)
elif command == 'monkey': elif command == 'monkey':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment