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

Side by Side Diff: scripts/slave/recipe_modules/chromium_android/api.py

Issue 954743003: Make step status EXCEPTION when test runner has infrastructure failure. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Moved exit code dict to test_runner function. Created 5 years, 9 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
« no previous file with comments | « scripts/slave/recipe_modules/amp/example.py ('k') | scripts/slave/recipes/android/appurify.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 import os 5 import os
6 import re 6 import re
7 import urllib 7 import urllib
8 8
9 from infra.libs.infra_types import freeze 9 from infra.libs.infra_types import freeze
10 from slave import recipe_api 10 from slave import recipe_api
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 infra_step=True, 400 infra_step=True,
401 env=self.m.chromium.get_env()) 401 env=self.m.chromium.get_env())
402 402
403 def monkey_test(self, **kwargs): 403 def monkey_test(self, **kwargs):
404 args = [ 404 args = [
405 'monkey', 405 'monkey',
406 '-v', 406 '-v',
407 '--package=%s' % self.c.channel, 407 '--package=%s' % self.c.channel,
408 '--event-count=50000' 408 '--event-count=50000'
409 ] 409 ]
410 return self.m.python( 410 return self.test_runner(
411 'Monkey Test', 411 'Monkey Test',
412 self.c.test_runner,
413 args, 412 args,
414 env={'BUILDTYPE': self.c.BUILD_CONFIG}, 413 env={'BUILDTYPE': self.c.BUILD_CONFIG},
415 **kwargs) 414 **kwargs)
416 415
417 416
418 def _run_sharded_tests(self, 417 def _run_sharded_tests(self,
419 config='sharded_perf_tests.json', 418 config='sharded_perf_tests.json',
420 flaky_config=None, 419 flaky_config=None,
421 chartjson_output=False, 420 chartjson_output=False,
422 **kwargs): 421 **kwargs):
423 args = ['perf', '--release', '--verbose', '--steps', config] 422 args = ['perf', '--release', '--verbose', '--steps', config]
424 if flaky_config: 423 if flaky_config:
425 args.extend(['--flaky-steps', flaky_config]) 424 args.extend(['--flaky-steps', flaky_config])
426 args.extend(['--collect-chartjson-data'] if chartjson_output else []) 425 args.extend(['--collect-chartjson-data'] if chartjson_output else [])
427 426
428 self.m.python( 427 self.test_runner(
429 'Sharded Perf Tests', 428 'Sharded Perf Tests',
430 self.c.test_runner,
431 args, 429 args,
432 cwd=self.m.path['checkout'], 430 cwd=self.m.path['checkout'],
433 env=self.m.chromium.get_env(), 431 env=self.m.chromium.get_env(),
434 **kwargs) 432 **kwargs)
435 433
436 def run_sharded_perf_tests(self, config, flaky_config=None, perf_id=None, 434 def run_sharded_perf_tests(self, config, flaky_config=None, perf_id=None,
437 test_type_transform=lambda x: x, 435 test_type_transform=lambda x: x,
438 chartjson_file=False, **kwargs): 436 chartjson_file=False, **kwargs):
439 """Run the perf tests from the given config file. 437 """Run the perf tests from the given config file.
440 438
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 if self.c.coverage: 533 if self.c.coverage:
536 args.extend(['--coverage-dir', self.coverage_dir, 534 args.extend(['--coverage-dir', self.coverage_dir,
537 '--python-only']) 535 '--python-only'])
538 if host_driven_root: 536 if host_driven_root:
539 args.extend(['--host-driven-root', host_driven_root]) 537 args.extend(['--host-driven-root', host_driven_root])
540 if official_build: 538 if official_build:
541 args.extend(['--official-build']) 539 args.extend(['--official-build'])
542 if json_results_file: 540 if json_results_file:
543 args.extend(['--json-results-file', json_results_file]) 541 args.extend(['--json-results-file', json_results_file])
544 542
545 return self.m.python( 543 return self.test_runner(
546 'Instrumentation test %s%s' % (annotation or test_apk, 544 'Instrumentation test %s%s' % (annotation or test_apk,
547 ' (%s)' % suffix if suffix else ''), 545 ' (%s)' % suffix if suffix else ''),
548 self.c.test_runner,
549 args=['instrumentation'] + args, 546 args=['instrumentation'] + args,
550 **kwargs) 547 **kwargs)
551 548
552 def logcat_dump(self, gs_bucket=None): 549 def logcat_dump(self, gs_bucket=None):
553 if gs_bucket: 550 if gs_bucket:
554 log_path = self.m.chromium.output_dir.join('full_log') 551 log_path = self.m.chromium.output_dir.join('full_log')
555 self.m.python( 552 self.m.python(
556 'logcat_dump', 553 'logcat_dump',
557 self.m.path['checkout'].join('build', 'android', 554 self.m.path['checkout'].join('build', 'android',
558 'adb_logcat_printer.py'), 555 'adb_logcat_printer.py'),
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 if gtest_filter: 667 if gtest_filter:
671 args.append('--gtest_filter=%s' % gtest_filter) 668 args.append('--gtest_filter=%s' % gtest_filter)
672 if tool: 669 if tool:
673 args.append('--tool=%s' % tool) 670 args.append('--tool=%s' % tool)
674 if flakiness_dashboard: 671 if flakiness_dashboard:
675 args.append('--flakiness-dashboard-server=%s' % 672 args.append('--flakiness-dashboard-server=%s' %
676 flakiness_dashboard) 673 flakiness_dashboard)
677 if json_results_file: 674 if json_results_file:
678 args.extend(['--json-results-file', json_results_file]) 675 args.extend(['--json-results-file', json_results_file])
679 676
680 self.m.python( 677 self.test_runner(
681 name or str(suite), 678 name or str(suite),
682 self.c.test_runner,
683 ['gtest', '-s', suite] + args, 679 ['gtest', '-s', suite] + args,
684 env=self.m.chromium.get_env(), 680 env=self.m.chromium.get_env(),
685 **kwargs) 681 **kwargs)
686 682
687 def run_java_unit_test_suite(self, suite, verbose=True, **kwargs): 683 def run_java_unit_test_suite(self, suite, verbose=True, **kwargs):
688 args = [] 684 args = []
689 if verbose: 685 if verbose:
690 args.append('--verbose') 686 args.append('--verbose')
691 if self.c.BUILD_CONFIG == 'Release': 687 if self.c.BUILD_CONFIG == 'Release':
692 args.append('--release') 688 args.append('--release')
693 689
694 self.m.python( 690 self.test_runner(
695 str(suite), 691 str(suite),
696 self.c.test_runner,
697 ['junit', '-s', suite] + args, 692 ['junit', '-s', suite] + args,
698 env=self.m.chromium.get_env(), 693 env=self.m.chromium.get_env(),
699 **kwargs) 694 **kwargs)
700 695
701 def run_python_unit_test_suite(self, suite, verbose=True, **kwargs): 696 def run_python_unit_test_suite(self, suite, verbose=True, **kwargs):
702 args = [] 697 args = []
703 if verbose: 698 if verbose:
704 args.append('--verbose') 699 args.append('--verbose')
705 700
706 self.m.python( 701 self.test_runner(
707 str(suite), 702 str(suite),
708 self.c.test_runner,
709 ['python', '-s', suite] + args, 703 ['python', '-s', suite] + args,
710 env=self.m.chromium.get_env(), 704 env=self.m.chromium.get_env(),
711 **kwargs) 705 **kwargs)
712 706
713 def coverage_report(self, **kwargs): 707 def coverage_report(self, **kwargs):
714 assert self.c.coverage, ( 708 assert self.c.coverage, (
715 'Trying to generate coverage report but coverage is not enabled') 709 'Trying to generate coverage report but coverage is not enabled')
716 gs_dest = 'java/%s/%s' % ( 710 gs_dest = 'java/%s/%s' % (
717 self.m.properties['buildername'], self.m.properties['revision']) 711 self.m.properties['buildername'], self.m.properties['revision'])
718 712
(...skipping 11 matching lines...) Expand all
730 724
731 self.m.gsutil.upload( 725 self.m.gsutil.upload(
732 source=self.coverage_dir.join('coverage_html'), 726 source=self.coverage_dir.join('coverage_html'),
733 bucket='chrome-code-coverage', 727 bucket='chrome-code-coverage',
734 dest=gs_dest, 728 dest=gs_dest,
735 args=['-R'], 729 args=['-R'],
736 name='upload coverage report', 730 name='upload coverage report',
737 link_name='Coverage report', 731 link_name='Coverage report',
738 version='4.7', 732 version='4.7',
739 **kwargs) 733 **kwargs)
734
735 def test_runner(self, step_name, args=None, **kwargs):
736 """Wrapper for the python testrunner script.
737
738 Args:
739 step_name: Name of the step.
740 args: Testrunner arguments.
741 """
742 EXIT_CODES = {
743 'error': 1,
744 'infra': 87,
745 'warning': 88,
746 }
747 try:
748 step_result = self.m.python(
749 step_name, self.c.test_runner, args, **kwargs)
750 return step_result
751 except self.m.step.StepFailure as f:
752 step_result = f.result
753 raise
754 finally:
755 if (step_result.retcode == EXIT_CODES['error']):
756 step_result.presentation.status = self.m.step.FAILURE
757 elif (step_result.retcode == EXIT_CODES['infra']):
758 step_result.presentation.status = self.m.step.EXCEPTION
759 elif (step_result.retcode == EXIT_CODES['warning']):
760 step_result.presentation.status = self.m.step.WARNING
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/amp/example.py ('k') | scripts/slave/recipes/android/appurify.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698