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

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

Issue 419673005: Revert of Support proper retrying of telemetry_unittests in recipes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: 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 PythonBasedTest(Test): 380 class TelemetryUnitTests(Test):
381 @staticmethod 381 name = 'telemetry_unittests'
382 def compile_targets(_):
383 return []
384
385 def run_step(self, api, suffix, cmd_args, **kwargs):
386 raise NotImplementedError()
387 382
388 def run(self, api, suffix): 383 def run(self, api, suffix):
389 args = ['--write-full-results-to', 384 # Until telemetry tests output JSON, need to fail on failure with patch.
390 api.json.test_results(add_json_log=False)] 385 # Otherwise, if the tests were failing on trunks and a cl introduces a
391 if suffix == 'without patch': 386 # new regression the cl would land since the failure text is hardcoded
392 args.extend(self.failures(api, 'with patch')) 387 # below. http://crbug.com/359521.
393 388 return api.chromium.run_telemetry_unittests(
394 def followup_fn(step_result): 389 suffix, always_run=True, can_fail_build=True)
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
430 name = 'telemetry_unittests'
431
432 @staticmethod
433 def compile_targets(_):
434 return ['chrome']
435
436 def run_step(self, api, suffix, cmd_args, **kwargs):
437 return api.chromium.run_telemetry_unittests(suffix, cmd_args, **kwargs)
438
439
440 class TelemetryPerfUnitTests(PythonBasedTest):
441 name = 'telemetry_perf_unittests'
442 390
443 @staticmethod 391 @staticmethod
444 def compile_targets(_): 392 def compile_targets(_):
445 return ['chrome'] 393 return ['chrome']
446 394
447 def run_step(self, api, suffix, cmd_args, **kwargs): 395 def has_valid_results(self, api, suffix):
448 return api.chromium.run_telemetry_perf_unittests(suffix, cmd_args, 396 return True
449 **kwargs) 397
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 []
450 429
451 430
452 class NaclIntegrationTest(Test): # pylint: disable=W0232 431 class NaclIntegrationTest(Test): # pylint: disable=W0232
453 name = 'nacl_integration' 432 name = 'nacl_integration'
454 433
455 @staticmethod 434 @staticmethod
456 def compile_targets(_): 435 def compile_targets(_):
457 return ['chrome'] 436 return ['chrome']
458 437
459 def run(self, api, suffix): 438 def run(self, api, suffix):
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 self.adb_install_apk[0], self.adb_install_apk[1]) 480 self.adb_install_apk[0], self.adb_install_apk[1])
502 yield api.chromium_android.run_instrumentation_suite( 481 yield api.chromium_android.run_instrumentation_suite(
503 self.name, test_data=self.test_data, 482 self.name, test_data=self.test_data,
504 flakiness_dashboard='test-results.appspot.com', 483 flakiness_dashboard='test-results.appspot.com',
505 verbose=True) 484 verbose=True)
506 485
507 def compile_targets(self, _): 486 def compile_targets(self, _):
508 return [self.compile_target] 487 return [self.compile_target]
509 488
510 489
490 class MojoPythonTests(Test): # pylint: disable=W0232
491 name = 'mojo_python_tests'
492
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
511 class BlinkTest(Test): 535 class BlinkTest(Test):
512 # TODO(dpranke): This should be converted to a PythonBasedTest, although it
513 # will need custom behavior because we archive the results as well.
514
515 name = 'webkit_tests' 536 name = 'webkit_tests'
516 537
517 def __init__(self, api): 538 def __init__(self, api):
518 self.results_dir = api.path['slave_build'].join('layout-test-results') 539 self.results_dir = api.path['slave_build'].join('layout-test-results')
519 self.layout_test_wrapper = api.path['build'].join( 540 self.layout_test_wrapper = api.path['build'].join(
520 'scripts', 'slave', 'chromium', 'layout_test_wrapper.py') 541 'scripts', 'slave', 'chromium', 'layout_test_wrapper.py')
521 542
522 def run(self, api, suffix): 543 def run(self, api, suffix):
523 args = ['--target', api.chromium.c.BUILD_CONFIG, 544 args = ['--target', api.chromium.c.BUILD_CONFIG,
524 '-o', self.results_dir, 545 '-o', self.results_dir,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 GTestTest('components_unittests'), 629 GTestTest('components_unittests'),
609 GTestTest('crypto_unittests'), 630 GTestTest('crypto_unittests'),
610 GTestTest('gfx_unittests'), 631 GTestTest('gfx_unittests'),
611 GTestTest('url_unittests'), 632 GTestTest('url_unittests'),
612 GTestTest('content_unittests'), 633 GTestTest('content_unittests'),
613 GTestTest('net_unittests'), 634 GTestTest('net_unittests'),
614 GTestTest('ui_unittests'), 635 GTestTest('ui_unittests'),
615 GTestTest('sync_unit_tests'), 636 GTestTest('sync_unit_tests'),
616 GTestTest('sql_unittests'), 637 GTestTest('sql_unittests'),
617 ] 638 ]
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