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

Unified Diff: build/android/pylib/instrumentation/instrumentation_test_instance.py

Issue 832493005: Add Instrumentation test support to remote device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
Index: build/android/pylib/instrumentation/instrumentation_test_instance.py
diff --git a/build/android/pylib/instrumentation/instrumentation_test_instance.py b/build/android/pylib/instrumentation/instrumentation_test_instance.py
index a87f81aeefbc75e9a0f99d6d049178de0758f52c..f7e8280dc805605125da3aa8ef09bae4a0824994 100644
--- a/build/android/pylib/instrumentation/instrumentation_test_instance.py
+++ b/build/android/pylib/instrumentation/instrumentation_test_instance.py
@@ -140,6 +140,33 @@ def GenerateTestResult(test_name, instr_statuses, start_ms, duration_ms):
test_name, result_type, start_ms, duration_ms, log=log)
+def GenerateMultiTestResult(errors, statuses):
jbudorick 2015/01/16 22:24:48 This implementation can just be in the test instan
rnephew (Wrong account) 2015/01/16 22:36:38 Done.
+ INSTR_STATUS_CODE_START = 1
+ results = []
+ skip_counter = 1
+ for status_code, bundle in statuses:
+ if status_code != INSTR_STATUS_CODE_START:
+ # TODO(rnephew): Make skipped tests still output test name. This is only
jbudorick 2015/01/16 22:24:48 What's preventing you from doing this now? Also,
rnephew (Wrong account) 2015/01/16 22:36:38 I was planning on doing that in its own CL, as to
jbudorick 2015/01/16 22:39:06 Fair enough.
+ # there to give skipped tests a unique name so they are counted
+ if 'test_skipped' in bundle:
+ test_name = "%s" % skip_counter
jbudorick 2015/01/16 22:24:48 should just be test_name = str(skip_counter)
rnephew (Wrong account) 2015/01/16 22:36:38 Done.
+ skip_counter += 1
+ else:
+ test_name = '%s#%s' % (
+ ''.join(bundle.get('class', [''])),
+ ''.join(bundle.get('test', [''])))
+
+ results.append(
+ GenerateTestResult(test_name, [(status_code, bundle)], 0, 0))
+
+ if len(errors) and errors.pop(0) == 'shortMsg=Native crash':
jbudorick 2015/01/16 22:24:48 I'm not crazy about attempting to match an exact s
rnephew (Wrong account) 2015/01/16 22:36:38 Either am I. But this and longMsg='long version of
jbudorick 2015/01/16 22:39:06 What if we just look for "Native crash" (maybe w/
rnephew (Wrong account) 2015/01/16 22:51:02 Done.
+ results.append(
+ base_test_result.BaseTestResult(
+ 'Crash detected', base_test_result.ResultType.CRASH))
+
+ return results
+
+
class InstrumentationTestInstance(test_instance.TestInstance):
def __init__(self, args, isolate_delegate, error_func):
@@ -270,6 +297,10 @@ class InstrumentationTestInstance(test_instance.TestInstance):
self._flags.extend([flag for flag in stripped_lines if flag])
@property
+ def suite(self):
+ return 'instrumentation'
+
+ @property
def apk_under_test(self):
return self._apk_under_test
@@ -463,6 +494,10 @@ class InstrumentationTestInstance(test_instance.TestInstance):
return ParseAmInstrumentRawOutput(raw_output)
@staticmethod
+ def GenerateMultiTestResult(errors, statuses):
+ return GenerateMultiTestResult(errors, statuses)
+
+ @staticmethod
def GenerateTestResult(test_name, instr_statuses, start_ms, duration_ms):
return GenerateTestResult(test_name, instr_statuses, start_ms, duration_ms)

Powered by Google App Engine
This is Rietveld 408576698