Chromium Code Reviews| Index: build/android/pylib/local/device/local_device_instrumentation_test_run.py |
| diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py |
| index afae9abcc8acd6c3705a6438d2545c586ab73339..0e6f58effbdf8287833738807d17a39c4f068475 100644 |
| --- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py |
| +++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py |
| @@ -114,10 +114,20 @@ class LocalDeviceInstrumentationTestRun( |
| def _GetTestName(self, test): |
| return '%s#%s' % (test['class'], test['method']) |
| + def _GetFullTestName(self, test): |
|
jbudorick
2015/11/02 14:49:46
nit: I'd rather call this the display name or some
mnaganov (inactive)
2015/11/02 19:03:54
Done.
|
| + full_name = self._GetTestName(test) |
| + flags = test['flags'] |
| + if flags.add: |
| + full_name = '%s with {%s}' % (full_name, ' '.join(flags.add)) |
| + if flags.remove: |
| + full_name = '%s without {%s}' % (full_name, ' '.join(flags.remove)) |
| + return full_name |
| + |
| #override |
| def _RunTest(self, device, test): |
| extras = self._test_instance.GetHttpServerEnvironmentVars() |
| + flags = None |
| if isinstance(test, list): |
| if not self._test_instance.driver_apk: |
| raise Exception('driver_apk does not exist. ' |
| @@ -131,6 +141,7 @@ class LocalDeviceInstrumentationTestRun( |
| test_names, timeouts = zip(*(name_and_timeout(t) for t in test)) |
| test_name = ','.join(test_names) |
| + full_test_name = test_name |
| target = '%s/%s' % ( |
| self._test_instance.driver_package, |
| self._test_instance.driver_name) |
| @@ -140,12 +151,21 @@ class LocalDeviceInstrumentationTestRun( |
| timeout = sum(timeouts) |
| else: |
| test_name = self._GetTestName(test) |
| + full_test_name = test_name |
| target = '%s/%s' % ( |
| self._test_instance.test_package, self._test_instance.test_runner) |
| extras['class'] = test_name |
| - timeout = self._GetTimeoutFromAnnotations(test['annotations'], test_name) |
| + if 'flags' in test: |
| + flags = test['flags'] |
| + full_test_name = self._GetFullTestName(test) |
| + timeout = self._GetTimeoutFromAnnotations( |
| + test['annotations'], full_test_name) |
| + |
| + logging.info('preparing to run %s: %s', full_test_name, test) |
| - logging.info('preparing to run %s: %s', test_name, test) |
| + if flags: |
| + self._flag_changers[str(device)].PushFlags( |
|
jbudorick
2015/11/02 14:49:46
Note that this flag changer may not have been crea
mnaganov (inactive)
2015/11/02 19:03:54
Good catch, fixed!
|
| + add=flags.add, remove=flags.remove) |
| time_ms = lambda: int(time.time() * 1e3) |
| start_ms = time_ms() |
| @@ -153,9 +173,12 @@ class LocalDeviceInstrumentationTestRun( |
| target, raw=True, extras=extras, timeout=timeout, retries=0) |
| duration_ms = time_ms() - start_ms |
| + if flags: |
| + self._flag_changers[str(device)].Restore() |
|
jbudorick
2015/11/02 14:49:46
This should be done in a finally block s.t. it get
mnaganov (inactive)
2015/11/02 19:03:54
Done.
|
| + |
| # TODO(jbudorick): Make instrumentation tests output a JSON so this |
| # doesn't have to parse the output. |
| - logging.debug('output from %s:', test_name) |
| + logging.debug('output from %s:', full_test_name) |
| for l in output: |
| logging.debug(' %s', l) |
| @@ -163,6 +186,10 @@ class LocalDeviceInstrumentationTestRun( |
| self._test_instance.ParseAmInstrumentRawOutput(output)) |
| results = self._test_instance.GenerateTestResults( |
| result_code, result_bundle, statuses, start_ms, duration_ms) |
| + if flags: |
|
jbudorick
2015/11/02 14:49:46
This shouldn't have to be done, but I need to do s
mnaganov (inactive)
2015/11/02 19:03:54
Acknowledged.
|
| + for r in results: |
| + if r.GetName() == test_name: |
| + r.SetName(full_test_name) |
| if DidPackageCrashOnDevice(self._test_instance.test_package, device): |
| for r in results: |
| if r.GetType() == base_test_result.ResultType.UNKNOWN: |