 Chromium Code Reviews
 Chromium Code Reviews Issue 1415533007:
  [Android] Add sharding for AMP instrumentation tests.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1415533007:
  [Android] Add sharding for AMP instrumentation tests.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: build/android/pylib/remote/device/remote_device_gtest_run.py | 
| diff --git a/build/android/pylib/remote/device/remote_device_gtest_run.py b/build/android/pylib/remote/device/remote_device_gtest_run.py | 
| index 0cfe717615bbd85a06c4481459b4f717f9094e62..b76bb5f21298630023cabeec2e75ee59448f9882 100644 | 
| --- a/build/android/pylib/remote/device/remote_device_gtest_run.py | 
| +++ b/build/android/pylib/remote/device/remote_device_gtest_run.py | 
| @@ -23,19 +23,27 @@ class RemoteDeviceGtestTestRun(remote_device_test_run.RemoteDeviceTestRun): | 
| DEFAULT_RUNNER_PACKAGE = ( | 
| 'org.chromium.native_test.NativeTestInstrumentationTestRunner') | 
| + _INSTRUMENTATION_STREAM_LEADER = 'INSTRUMENTATION_STATUS: stream=' | 
| #override | 
| def TestPackage(self): | 
| return self._test_instance.suite | 
| #override | 
| - def _TriggerSetUp(self): | 
| - """Set up the triggering of a test run.""" | 
| - logging.info('Triggering test run.') | 
| + def _GetAppPath(self): | 
| + return os.path.join( | 
| + constants.GetOutDirectory(), 'apks', 'remote_device_dummy.apk') | 
| + | 
| + #override | 
| + def _GetTestFramework(self): | 
| + if self._env.test_framework: | 
| + logging.warning('Ignoring configured test_framework "%s"', | 
| + self._env.test_framework) | 
| + return 'robotium' | 
| - if self._env.runner_type: | 
| - logging.warning('Ignoring configured runner_type "%s"', | 
| - self._env.runner_type) | 
| + # pylint: disable=protected-access | 
| 
jbudorick
2015/12/01 04:07:13
Why'd you move this up?
 | 
| + #override | 
| + def _SetupTestShards(self, num_shards): | 
| if not self._env.runner_package: | 
| runner_package = self.DEFAULT_RUNNER_PACKAGE | 
| @@ -44,10 +52,6 @@ class RemoteDeviceGtestTestRun(remote_device_test_run.RemoteDeviceTestRun): | 
| else: | 
| runner_package = self._env.runner_package | 
| - dummy_app_path = os.path.join( | 
| - constants.GetOutDirectory(), 'apks', 'remote_device_dummy.apk') | 
| - | 
| - # pylint: disable=protected-access | 
| with tempfile.NamedTemporaryFile(suffix='.flags.txt') as flag_file: | 
| env_vars = dict(self._test_instance.extras) | 
| if gtest_test_instance.EXTRA_SHARD_NANO_TIMEOUT not in env_vars: | 
| @@ -67,23 +71,36 @@ class RemoteDeviceGtestTestRun(remote_device_test_run.RemoteDeviceTestRun): | 
| flag_file.write('_ ' + ' '.join(flags)) | 
| flag_file.flush() | 
| env_vars[_EXTRA_COMMAND_LINE_FILE] = os.path.basename(flag_file.name) | 
| - self._test_instance._data_deps.append( | 
| - (os.path.abspath(flag_file.name), None)) | 
| - self._AmInstrumentTestSetup( | 
| - dummy_app_path, self._test_instance.apk, runner_package, | 
| - environment_variables=env_vars) | 
| - _INSTRUMENTATION_STREAM_LEADER = 'INSTRUMENTATION_STATUS: stream=' | 
| + with tempfile.NamedTemporaryFile(suffix='.zip') as test_package: | 
| 
jbudorick
2015/12/01 04:07:13
Why doesn't _PackageTest do this for us? i.e., cou
 | 
| + data_deps = (self._test_instance.GetDataDependencies() + | 
| + [(os.path.abspath(flag_file.name), None)]) | 
| + package_configs = self._PackageTest( | 
| + test_package.name, self._test_instance.apk, data_deps) | 
| + | 
| + framework_configs = { | 
| + 'runner': runner_package, | 
| + 'environment_vars': ','.join( | 
| + '%s=%s' % (k, v) for k, v in env_vars.iteritems()) | 
| + } | 
| + framework_configs.update(package_configs) | 
| + | 
| + test_id = self._UploadTestToDevice(test_package.name) | 
| + self._UploadTestConfigToDevice( | 
| + test_id, framework_configs, self._appurify_configs) | 
| + | 
| + return [test_id] | 
| #override | 
| - def _ParseTestResults(self): | 
| + def _ParseTestResults(self, test_output, results_zip): | 
| logging.info('Parsing results from stdout.') | 
| results = base_test_result.TestRunResults() | 
| - output = self._results['results']['output'].splitlines() | 
| + output = test_output['results']['output'].splitlines() | 
| output = (l[len(self._INSTRUMENTATION_STREAM_LEADER):] for l in output | 
| if l.startswith(self._INSTRUMENTATION_STREAM_LEADER)) | 
| results_list = self._test_instance.ParseGTestOutput(output) | 
| results.AddResults(results_list) | 
| - self._DetectPlatformErrors(results) | 
| + remote_device_test_run.DetectPlatformErrors( | 
| + results, test_output, results_zip) | 
| return results |