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

Side by Side Diff: scripts/slave/recipe_modules/chromium/steps.py

Issue 417883002: Support proper retrying of telemetry_unittests in recipes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: merge to r285585 Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 class Test(object): 6 class Test(object):
7 """ 7 """
8 Base class for tests that can be retried after deapplying a previously 8 Base class for tests that can be retried after deapplying a previously
9 applied patch. 9 applied patch.
10 """ 10 """
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 if not gtest_results.valid: # pragma: no cover 370 if not gtest_results.valid: # pragma: no cover
371 return False 371 return False
372 global_tags = gtest_results.raw.get('global_tags', []) 372 global_tags = gtest_results.raw.get('global_tags', [])
373 return 'UNRELIABLE_RESULTS' not in global_tags 373 return 'UNRELIABLE_RESULTS' not in global_tags
374 374
375 def failures(self, api, suffix): 375 def failures(self, api, suffix):
376 assert self.has_valid_results(api, suffix) 376 assert self.has_valid_results(api, suffix)
377 return self._results[suffix].failures 377 return self._results[suffix].failures
378 378
379 379
380 class TelemetryUnitTests(Test): 380 class PythonBasedTest(Test):
381 @staticmethod
382 def compile_targets(_):
383 return []
384
385 def run_step(self, api, suffix, cmd_args, **kwargs):
386 raise NotImplementedError()
387
388 def run(self, api, suffix):
389 args = ['--write-full-results-to',
390 api.json.test_results(add_json_log=False)]
391 if suffix == 'without patch':
392 args.extend(self.failures(api, 'with patch'))
393
394 def followup_fn(step_result):
395 r = step_result.json.test_results
396 p = step_result.presentation
397
398 p.step_text += api.test_utils.format_step_text([
399 ['unexpected_failures:', r.unexpected_failures.keys()],
400 ])
401
402 return self.run_step(
403 api, suffix, args, can_fail_build=(not suffix),
404 step_test_data=lambda: api.json.test_api.canned_test_output(
405 True), followup_fn=followup_fn)
406
407 def has_valid_results(self, api, suffix):
408 # TODO(dpranke): we should just return zero/nonzero for success/fail.
409 # crbug.com/357866
410 step = api.step_history[self._step_name(suffix)]
411 return (step.json.test_results.valid and
412 step.retcode <= step.json.test_results.MAX_FAILURES_EXIT_STATUS)
413
414 def failures(self, api, suffix):
415 sn = self._step_name(suffix)
416 return api.step_history[sn].json.test_results.unexpected_failures
417
418
419 class MojoPythonTests(PythonBasedTest): # pylint: disable=W0232
420 name = 'mojo_python_tests'
421
422 def run_step(self, api, suffix, cmd_args, **kwargs):
423 return api.python(self._step_name(suffix),
424 api.path['checkout'].join('mojo', 'tools',
425 'run_mojo_python_tests.py'),
426 cmd_args, **kwargs)
427
428
429 class TelemetryUnitTests(PythonBasedTest): # pylint: disable=W0232
381 name = 'telemetry_unittests' 430 name = 'telemetry_unittests'
382 431
383 def run(self, api, suffix): 432 @staticmethod
384 # Until telemetry tests output JSON, need to fail on failure with patch. 433 def compile_targets(_):
385 # Otherwise, if the tests were failing on trunks and a cl introduces a 434 return ['chrome']
386 # new regression the cl would land since the failure text is hardcoded 435
387 # below. http://crbug.com/359521. 436 def run_step(self, api, suffix, cmd_args, **kwargs):
388 return api.chromium.run_telemetry_unittests( 437 return api.chromium.run_telemetry_unittests(suffix, cmd_args, **kwargs)
389 suffix, always_run=True, can_fail_build=True) 438
439
440 class TelemetryPerfUnitTests(PythonBasedTest):
441 name = 'telemetry_perf_unittests'
390 442
391 @staticmethod 443 @staticmethod
392 def compile_targets(_): 444 def compile_targets(_):
393 return ['chrome'] 445 return ['chrome']
394 446
395 def has_valid_results(self, api, suffix): 447 def run_step(self, api, suffix, cmd_args, **kwargs):
396 return True 448 return api.chromium.run_telemetry_perf_unittests(suffix, cmd_args,
397 449 **kwargs)
398 def failures(self, api, suffix):
399 # TODO(phajdan.jr): Make it possible to retry individual failing telemetry
400 # tests (add JSON).
401 if api.step_history[self._step_name(suffix)].retcode:
402 return ['telemetry_unittest']
403 return []
404
405 class TelemetryPerfUnitTests(Test):
406 name = 'telemetry_perf_unittests'
407
408 def run(self, api, suffix):
409 # Until telemetry tests output JSON, need to fail on failure with patch.
410 # Otherwise, if the tests were failing on trunks and a cl introduces a
411 # new regression the cl would land since the failure text is hardcoded
412 # below. http://crbug.com/359521.
413 return api.chromium.run_telemetry_perf_unittests(
414 suffix, always_run=True, can_fail_build=True)
415
416 @staticmethod
417 def compile_targets(_):
418 return ['chrome']
419
420 def has_valid_results(self, api, suffix):
421 return True
422
423 def failures(self, api, suffix):
424 # TODO(phajdan.jr): Make it possible to retry individual failing telemetry
425 # tests (add JSON).
426 if api.step_history[self._step_name(suffix)].retcode:
427 return ['telemetry_perf_unittests']
428 return []
429 450
430 451
431 class NaclIntegrationTest(Test): # pylint: disable=W0232 452 class NaclIntegrationTest(Test): # pylint: disable=W0232
432 name = 'nacl_integration' 453 name = 'nacl_integration'
433 454
434 @staticmethod 455 @staticmethod
435 def compile_targets(_): 456 def compile_targets(_):
436 return ['chrome'] 457 return ['chrome']
437 458
438 def run(self, api, suffix): 459 def run(self, api, suffix):
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 self.adb_install_apk[0], self.adb_install_apk[1]) 501 self.adb_install_apk[0], self.adb_install_apk[1])
481 yield api.chromium_android.run_instrumentation_suite( 502 yield api.chromium_android.run_instrumentation_suite(
482 self.name, test_data=self.test_data, 503 self.name, test_data=self.test_data,
483 flakiness_dashboard='test-results.appspot.com', 504 flakiness_dashboard='test-results.appspot.com',
484 verbose=True) 505 verbose=True)
485 506
486 def compile_targets(self, _): 507 def compile_targets(self, _):
487 return [self.compile_target] 508 return [self.compile_target]
488 509
489 510
490 class MojoPythonTests(Test): # pylint: disable=W0232 511 class BlinkTest(Test):
491 name = 'mojo_python_tests' 512 # TODO(dpranke): This should be converted to a PythonBasedTest, although it
513 # will need custom behavior because we archive the results as well.
492 514
493 @staticmethod
494 def compile_targets(_):
495 return []
496
497 def run(self, api, suffix):
498 args = ['--write-full-results-to',
499 api.json.test_results(add_json_log=False)]
500 if suffix == 'without patch':
501 args.extend(self.failures(api, 'with patch'))
502
503 def followup_fn(step_result):
504 r = step_result.json.test_results
505 p = step_result.presentation
506
507 p.step_text += api.test_utils.format_step_text([
508 ['unexpected_failures:', r.unexpected_failures.keys()],
509 ])
510
511 return api.python(
512 self._step_name(suffix),
513 api.path['checkout'].join(
514 'mojo',
515 'tools',
516 'run_mojo_python_tests.py'),
517 args,
518 can_fail_build=(not suffix),
519 always_run=True,
520 step_test_data=lambda: api.json.test_api.canned_test_output(
521 True), followup_fn=followup_fn)
522
523 def has_valid_results(self, api, suffix):
524 # TODO(dpranke): we should just return zero/nonzero for success/fail.
525 # crbug.com/357866
526 step = api.step_history[self._step_name(suffix)]
527 return (step.json.test_results.valid and
528 step.retcode <= step.json.test_results.MAX_FAILURES_EXIT_STATUS)
529
530 def failures(self, api, suffix):
531 sn = self._step_name(suffix)
532 return api.step_history[sn].json.test_results.unexpected_failures
533
534
535 class BlinkTest(Test):
536 name = 'webkit_tests' 515 name = 'webkit_tests'
537 516
538 def __init__(self, api): 517 def __init__(self, api):
539 self.results_dir = api.path['slave_build'].join('layout-test-results') 518 self.results_dir = api.path['slave_build'].join('layout-test-results')
540 self.layout_test_wrapper = api.path['build'].join( 519 self.layout_test_wrapper = api.path['build'].join(
541 'scripts', 'slave', 'chromium', 'layout_test_wrapper.py') 520 'scripts', 'slave', 'chromium', 'layout_test_wrapper.py')
542 521
543 def run(self, api, suffix): 522 def run(self, api, suffix):
544 args = ['--target', api.chromium.c.BUILD_CONFIG, 523 args = ['--target', api.chromium.c.BUILD_CONFIG,
545 '-o', self.results_dir, 524 '-o', self.results_dir,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 GTestTest('components_unittests'), 608 GTestTest('components_unittests'),
630 GTestTest('crypto_unittests'), 609 GTestTest('crypto_unittests'),
631 GTestTest('gfx_unittests'), 610 GTestTest('gfx_unittests'),
632 GTestTest('url_unittests'), 611 GTestTest('url_unittests'),
633 GTestTest('content_unittests'), 612 GTestTest('content_unittests'),
634 GTestTest('net_unittests'), 613 GTestTest('net_unittests'),
635 GTestTest('ui_unittests'), 614 GTestTest('ui_unittests'),
636 GTestTest('sync_unit_tests'), 615 GTestTest('sync_unit_tests'),
637 GTestTest('sql_unittests'), 616 GTestTest('sql_unittests'),
638 ] 617 ]
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/chromium/api.py ('k') | scripts/slave/recipes/chromium.expected/dynamic_gtest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698