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

Unified Diff: build/android/pylib/results/json_results.py

Issue 1376483002: [Android] Add --repeat for gtests and instrumentation tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « build/android/pylib/base/test_dispatcher.py ('k') | build/android/pylib/results/json_results_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/results/json_results.py
diff --git a/build/android/pylib/results/json_results.py b/build/android/pylib/results/json_results.py
index 0056c4a665a6e1e9c721762785833fdb128fe144..1a60f648c833c5a6e93f3969b543dbebe8a9eefa 100644
--- a/build/android/pylib/results/json_results.py
+++ b/build/android/pylib/results/json_results.py
@@ -7,10 +7,10 @@ import json
from pylib.base import base_test_result
-def GenerateResultsDict(test_run_result):
- """Create a results dict from |test_run_result| suitable for writing to JSON.
+def GenerateResultsDict(test_run_results):
+ """Create a results dict from |test_run_results| suitable for writing to JSON.
Args:
- test_run_result: a base_test_result.TestRunResults object.
+ test_run_results: a list of base_test_result.TestRunResults objects.
Returns:
A results dict that mirrors the one generated by
base/test/launcher/test_results_tracker.cc:SaveSummaryAsJSON.
@@ -44,11 +44,30 @@ def GenerateResultsDict(test_run_result):
# },
# ],
# },
+ # {
+ # "test1": [
+ # {
+ # "status": "SUCCESS",
+ # "elapsed_time_ms": 1,
+ # "output_snippet": "",
+ # "output_snippet_base64": "",
+ # "losless_snippet": "",
+ # },
+ # ],
+ # "test2": [
+ # {
+ # "status": "FAILURE",
+ # "elapsed_time_ms": 12,
+ # "output_snippet": "",
+ # "output_snippet_base64": "",
+ # "losless_snippet": "",
+ # },
+ # ],
+ # },
+ # ...
# ],
# }
- assert isinstance(test_run_result, base_test_result.TestRunResults)
-
def status_as_string(s):
if s == base_test_result.ResultType.PASS:
return 'SUCCESS'
@@ -63,29 +82,28 @@ def GenerateResultsDict(test_run_result):
elif s == base_test_result.ResultType.UNKNOWN:
return 'UNKNOWN'
- def generate_iteration_data(t):
- return {
- t.GetName(): [
- {
- 'status': status_as_string(t.GetType()),
- 'elapsed_time_ms': t.GetDuration(),
- 'output_snippet': '',
- 'losless_snippet': '',
- 'output_snippet_base64:': '',
- }
- ]
+ all_tests = set()
+ per_iteration_data = []
+ for test_run_result in test_run_results:
+ iteration_data = {
+ t.GetName(): [{
+ 'status': status_as_string(t.GetType()),
+ 'elapsed_time_ms': t.GetDuration(),
+ 'output_snippet': '',
+ 'losless_snippet': '',
+ 'output_snippet_base64:': '',
+ }]
+ for t in test_run_result.GetAll()
}
-
- all_tests_tuple, per_iteration_data_tuple = zip(
- *[(t.GetName(), generate_iteration_data(t))
- for t in test_run_result.GetAll()])
+ all_tests = all_tests.union(set(iteration_data.iterkeys()))
+ per_iteration_data.append(iteration_data)
return {
'global_tags': [],
- 'all_tests': list(all_tests_tuple),
+ 'all_tests': sorted(list(all_tests)),
# TODO(jbudorick): Add support for disabled tests within base_test_result.
'disabled_tests': [],
- 'per_iteration_data': list(per_iteration_data_tuple),
+ 'per_iteration_data': per_iteration_data,
}
« no previous file with comments | « build/android/pylib/base/test_dispatcher.py ('k') | build/android/pylib/results/json_results_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698