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

Side by Side 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: Fix typos 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import cStringIO 6 import cStringIO
7 import json 7 import json
8 import logging 8 import logging
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 merged['swarming_summary'] = { 334 merged['swarming_summary'] = {
335 'shards': [{ 335 'shards': [{
336 'outputs_ref': { 336 'outputs_ref': {
337 'view_url': 'blah', 337 'view_url': 'blah',
338 }, 338 },
339 }], 339 }],
340 } 340 }
341 self.assertEqual(GOOD_GTEST_JSON_MERGED, merged) 341 self.assertEqual(GOOD_GTEST_JSON_MERGED, merged)
342 self.assertEqual('', stdout) 342 self.assertEqual('', stdout)
343 343
344 def test_merged_json_result_ok(self):
345 self.stage({
346 'summary.json': {'shards': [{'dummy': 0}, {'dummy': 0}, {'dummy': 0}]},
347 '0/output.json': GOOD_JSON_TEST_RESULT_0,
348 '1/output.json': GOOD_JSON_TEST_RESULT_1,
349 '2/output.json': GOOD_JSON_TEST_RESULT_2,
350 })
351 merged, stdout = self.call()
352 merged['swarming_summary'] = {
353 'shards': [{
354 'outputs_ref': {
355 'view_url': 'blah',
356 },
357 }],
358 }
359 self.assertEqual(GOOD_JSON_TEST_RESULT_MERGED, merged)
Ken Russell (switch to Gerrit) 2016/10/04 01:43:43 This test doesn't pass, does it? I see Vadim's poi
nednguyen 2016/10/04 01:49:52 Ah, this change should be undo. My bad
360 self.assertEqual('', stdout)
361
362
344 def test_missing_summary_json(self): 363 def test_missing_summary_json(self):
345 # summary.json is missing, should return None and emit warning. 364 # summary.json is missing, should return None and emit warning.
346 merged, output = self.call() 365 merged, output = self.call()
347 self.assertEqual(None, merged) 366 self.assertEqual(None, merged)
348 self.assertIn('@@@STEP_WARNINGS@@@', output) 367 self.assertIn('@@@STEP_WARNINGS@@@', output)
349 self.assertIn('summary.json is missing or can not be read', output) 368 self.assertIn('summary.json is missing or can not be read', output)
350 369
351 def test_unfinished_shards(self): 370 def test_unfinished_shards(self):
352 # Only one shard (#1) finished. Shard #0 did not. 371 # Only one shard (#1) finished. Shard #0 did not.
353 self.stage({ 372 self.stage({
(...skipping 27 matching lines...) Expand all
381 '@@@STEP_TEXT@3 disabled@@@', 400 '@@@STEP_TEXT@3 disabled@@@',
382 stdout) 401 stdout)
383 402
384 403
385 if __name__ == '__main__': 404 if __name__ == '__main__':
386 logging.basicConfig( 405 logging.basicConfig(
387 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) 406 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR)
388 if '-v' in sys.argv: 407 if '-v' in sys.argv:
389 unittest.TestCase.maxDiff = None 408 unittest.TestCase.maxDiff = None
390 unittest.main() 409 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698