| 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,
|
| }
|
|
|
|
|
|
|