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

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

Issue 1987763002: [Android] Expose each try result in test results JSON. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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/results/json_results.py
diff --git a/build/android/pylib/results/json_results.py b/build/android/pylib/results/json_results.py
index 1a60f648c833c5a6e93f3969b543dbebe8a9eefa..b0b95928057ac79bf4b1d18aa0911489343b3851 100644
--- a/build/android/pylib/results/json_results.py
+++ b/build/android/pylib/results/json_results.py
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import collections
+import itertools
import json
from pylib.base import base_test_result
@@ -33,6 +35,7 @@ def GenerateResultsDict(test_run_results):
# "output_snippet_base64": "",
# "losless_snippet": "",
# },
+ # ...
# ],
# "test2": [
# {
@@ -42,6 +45,7 @@ def GenerateResultsDict(test_run_results):
# "output_snippet_base64": "",
# "losless_snippet": "",
# },
+ # ...
# ],
# },
# {
@@ -85,16 +89,21 @@ def GenerateResultsDict(test_run_results):
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()
- }
+ iteration_data = collections.defaultdict(list)
+ if isinstance(test_run_result, list):
+ results_iterable = itertools.chain(*(t.GetAll() for t in test_run_result))
+ else:
+ results_iterable = test_run_result.GetAll()
+
+ for r in results_iterable:
+ iteration_data[r.GetName()].append({
+ 'status': status_as_string(r.GetType()),
+ 'elapsed_time_ms': r.GetDuration(),
+ 'output_snippet': '',
+ 'losless_snippet': '',
+ 'output_snippet_base64:': '',
+ })
+
all_tests = all_tests.union(set(iteration_data.iterkeys()))
per_iteration_data.append(iteration_data)
« no previous file with comments | « build/android/pylib/remote/device/remote_device_test_run.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