Commit d4d9c16f authored by erikchen's avatar erikchen Committed by Commit Bot

Fix status/string conversion for android json NOTRUN status.

Previously, the if/else block was missing the NOTRUN status. Since the statuses
are already represented by strings, this CL converts the strings to be expected
outputs. This allows us to remove the entire if/else block.

Bug: 895027
Change-Id: Ieb426eb268c30dd07a6642dcfd97122cdb07c926
Reviewed-on: https://chromium-review.googlesource.com/c/1305414Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603562}
parent 364edd2e
...@@ -10,13 +10,13 @@ import threading ...@@ -10,13 +10,13 @@ import threading
class ResultType(object): class ResultType(object):
"""Class enumerating test types.""" """Class enumerating test types."""
# The test passed. # The test passed.
PASS = 'PASS' PASS = 'SUCCESS'
# The test was intentionally skipped. # The test was intentionally skipped.
SKIP = 'SKIP' SKIP = 'SKIPPED'
# The test failed. # The test failed.
FAIL = 'FAIL' FAIL = 'FAILURE'
# The test caused the containing process to crash. # The test caused the containing process to crash.
CRASH = 'CRASH' CRASH = 'CRASH'
......
...@@ -72,20 +72,6 @@ def GenerateResultsDict(test_run_results, global_tags=None): ...@@ -72,20 +72,6 @@ def GenerateResultsDict(test_run_results, global_tags=None):
# ], # ],
# } # }
def status_as_string(s):
if s == base_test_result.ResultType.PASS:
return 'SUCCESS'
elif s == base_test_result.ResultType.SKIP:
return 'SKIPPED'
elif s == base_test_result.ResultType.FAIL:
return 'FAILURE'
elif s == base_test_result.ResultType.CRASH:
return 'CRASH'
elif s == base_test_result.ResultType.TIMEOUT:
return 'TIMEOUT'
elif s == base_test_result.ResultType.UNKNOWN:
return 'UNKNOWN'
all_tests = set() all_tests = set()
per_iteration_data = [] per_iteration_data = []
test_run_links = {} test_run_links = {}
...@@ -103,7 +89,7 @@ def GenerateResultsDict(test_run_results, global_tags=None): ...@@ -103,7 +89,7 @@ def GenerateResultsDict(test_run_results, global_tags=None):
for r in results_iterable: for r in results_iterable:
result_dict = { result_dict = {
'status': status_as_string(r.GetType()), 'status': r.GetType(),
'elapsed_time_ms': r.GetDuration(), 'elapsed_time_ms': r.GetDuration(),
'output_snippet': unicode(r.GetLog(), errors='replace'), 'output_snippet': unicode(r.GetLog(), errors='replace'),
'losless_snippet': True, 'losless_snippet': True,
...@@ -152,17 +138,8 @@ def ParseResultsFromJson(json_results): ...@@ -152,17 +138,8 @@ def ParseResultsFromJson(json_results):
""" """
def string_as_status(s): def string_as_status(s):
if s == 'SUCCESS': if s in base_test_result.ResultType.GetTypes():
return base_test_result.ResultType.PASS return s
elif s == 'SKIPPED':
return base_test_result.ResultType.SKIP
elif s == 'FAILURE':
return base_test_result.ResultType.FAIL
elif s == 'CRASH':
return base_test_result.ResultType.CRASH
elif s == 'TIMEOUT':
return base_test_result.ResultType.TIMEOUT
else:
return base_test_result.ResultType.UNKNOWN return base_test_result.ResultType.UNKNOWN
results_list = [] results_list = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment