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

Unified Diff: scripts/slave/recipe_modules/chromium_tests/steps.py

Issue 2375663003: Add json test results format support for SwarmingIsolatedScriptTest (Closed)
Patch Set: Add no cover Created 4 years, 2 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 | « no previous file | scripts/slave/recipe_modules/swarming/api.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/recipe_modules/chromium_tests/steps.py
diff --git a/scripts/slave/recipe_modules/chromium_tests/steps.py b/scripts/slave/recipe_modules/chromium_tests/steps.py
index 1d7e734b4d886be26d179963eb92df5c527f350d..e981f992f12d911362f7ee75e170c24047367455 100644
--- a/scripts/slave/recipe_modules/chromium_tests/steps.py
+++ b/scripts/slave/recipe_modules/chromium_tests/steps.py
@@ -1083,20 +1083,34 @@ class SwarmingIsolatedScriptTest(SwarmingTest):
title=self._step_name(suffix), isolated_hash=isolated_hash,
shards=self._shards, idempotent=False, extra_args=args)
+ def validate_simplified_results(self, results):
+ return results['valid'], results['failures']
+
+ def validate_json_test_results(self, api, results):
+ test_results = api.test_utils.create_results_from_json(results)
+ tests = test_results.tests
+ failures = list(
+ t for t in tests
+ if all(res not in tests[t]['expected'].split()
+ for res in tests[t]['actual'].split()))
+ return True, failures
+
def validate_task_results(self, api, step_result):
results = getattr(step_result, 'isolated_script_results', None) or {}
-
+ valid = True
+ failures = []
try:
- failures = results['failures']
- valid = results['valid']
- if not failures and step_result.retcode != 0:
- failures = ['%s (entire test suite)' % self.name]
- valid = False
-
+ if results.get('version', 0) == 3:
+ valid, failures = self.validate_json_test_results(api, results)
+ else:
+ valid, failures = self.validate_simplified_results(results)
except (ValueError, KeyError) as e:
- step_result.presentation.logs['invalid_results_exc'] = [str(e)]
+ step_result.presentation.logs['invalid_results_exc'] = [repr(e)]
valid = False
failures = None
+ if not failures and step_result.retcode != 0:
+ failures = ['%s (entire test suite)' % self.name]
+ valid = False
if valid:
step_result.presentation.step_text += api.test_utils.format_step_text([
['failures:', failures]
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/swarming/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698