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

Unified Diff: scripts/slave/recipe_modules/swarming/tests/collect_gtest_task_test.py

Issue 2375663003: Add json test results format support for SwarmingIsolatedScriptTest (Closed)
Patch Set: Created 4 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
Index: scripts/slave/recipe_modules/swarming/tests/collect_gtest_task_test.py
diff --git a/scripts/slave/recipe_modules/swarming/tests/collect_gtest_task_test.py b/scripts/slave/recipe_modules/swarming/tests/collect_gtest_task_test.py
index 4df50baf01e6c62b066d0ce921c495c6c8e436d3..65abaf03abfbf139bdbad472cbd1055130e14a3c 100755
--- a/scripts/slave/recipe_modules/swarming/tests/collect_gtest_task_test.py
+++ b/scripts/slave/recipe_modules/swarming/tests/collect_gtest_task_test.py
@@ -149,6 +149,88 @@ GOOD_GTEST_JSON_MERGED = {
},
}
+GOOD_JSON_TEST_RESULT_0 = {
+ 'tests': {
+ 'car': {
+ 'honda': {
+ 'expected': 'PASS',
+ 'actual': 'PASS'
+ },
+ 'toyota': {
+ 'expected': 'FAIL',
+ 'actual': 'FAIL'
+ }
+ },
+ 'computer': {
+ 'dell': {
+ 'expected': 'PASS',
+ 'actual': 'PASS'
+ }
+ },
+ },
+ 'interrupted': False,
+ 'path_delimiter': '.',
+ 'version': 3,
+ 'seconds_since_epoch': 1406662289.76,
+ 'num_failures_by_type': {
+ 'FAIL': 0,
+ 'PASS': 2
+ }
+}
+
+GOOD_JSON_TEST_RESULT_1 = {
+ 'tests': {
+ 'car': {
+ 'tesla': {
+ 'expected': 'pass',
+ 'actual': 'pass'
+ },
+ },
+ 'burger': {
+ 'mcdonald': {
+ 'expected': 'pass',
+ 'actual': 'pass'
+ }
+ },
+ },
+ 'interrupted': False,
+ 'path_delimiter': '.',
+ 'version': 3,
+ 'seconds_since_epoch': 1406662283.11,
+ 'num_failures_by_type': {
+ 'fail': 0,
+ 'pass': 2
+ }
+}
+
+GOOD_JSON_TEST_RESULT_2 = {
+ 'tests': {
+ 'car': {
+ 'mercedes': {
+ 'expected': 'pass',
+ 'actual': 'fail'
+ },
+ },
+ 'burger': {
+ 'in n out': {
+ 'expected': 'pass',
+ 'actual': 'pass'
+ }
+ },
+ },
+ 'interrupted': True,
+ 'path_delimiter': '.',
+ 'version': 3,
+ 'seconds_since_epoch': 1406662200.01,
+ 'num_failures_by_type': {
+ 'fail': 1,
+ 'pass': 1
+ }
+}
+
+GOOD_JSON_TEST_RESULT_MERGED = {
+}
Ken Russell (switch to Gerrit) 2016/09/30 23:37:53 Sorry, I don't understand: why is this empty?
nednguyen 2016/10/04 00:10:11 Sorry, I wasn't quite sure how to test this. Pleas
+
# Only shard #1 finished. UNRELIABLE_RESULTS is set.
BAD_GTEST_JSON_ONLY_1_SHARD = {
@@ -341,6 +423,25 @@ class MergeShardResultsTest(auto_stub.TestCase):
self.assertEqual(GOOD_GTEST_JSON_MERGED, merged)
self.assertEqual('', stdout)
+ def test_merged_json_result_ok(self):
+ self.stage({
+ 'summary.json': {'shards': [{'dummy': 0}, {'dummy': 0}, {'dummy': 0}]},
+ '0/output.json': GOOD_JSON_TEST_RESULT_0,
+ '1/output.json': GOOD_JSON_TEST_RESULT_1,
+ '2/output.json': GOOD_JSON_TEST_RESULT_2,
+ })
+ merged, stdout = self.call()
+ merged['swarming_summary'] = {
+ 'shards': [{
+ 'outputs_ref': {
+ 'view_url': 'blah',
+ },
+ }],
+ }
+ self.assertEqual(GOOD_JSON_TEST_RESULT_MERGED, merged)
+ self.assertEqual('', stdout)
+
+
def test_missing_summary_json(self):
# summary.json is missing, should return None and emit warning.
merged, output = self.call()
« scripts/slave/recipe_modules/swarming/api.py ('K') | « scripts/slave/recipe_modules/swarming/api.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698