From 52ff986f941561148407e72347b2725c3d084322 Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Mon, 17 Apr 2017 13:56:51 -0700 Subject: Add option to upload Jenkins test result to BQ --- tools/run_tests/run_tests.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'tools/run_tests/run_tests.py') diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 62e92c3d1d..22891c5c98 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -60,7 +60,10 @@ import python_utils.jobset as jobset import python_utils.report_utils as report_utils import python_utils.watch_dirs as watch_dirs import python_utils.start_port_server as start_port_server - +try: + from python_utils.upload_test_results import upload_results_to_bq +except (ImportError): + pass # It's ok to not import because this is only necessary to upload results to BQ. _ROOT = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../..')) os.chdir(_ROOT) @@ -1185,7 +1188,7 @@ argp.add_argument('--build_only', default=False, action='store_const', const=True, - help='Perform all the build steps but dont run any tests.') + help='Perform all the build steps but don\'t run any tests.') argp.add_argument('--measure_cpu_costs', default=False, action='store_const', const=True, help='Measure the cpu costs of tests') argp.add_argument('--update_submodules', default=[], nargs='*', @@ -1200,11 +1203,16 @@ argp.add_argument('--quiet_success', default=False, action='store_const', const=True, - help='Dont print anything when a test passes. Passing tests also will not be reported in XML report. ' + + help='Don\'t print anything when a test passes. Passing tests also will not be reported in XML report. ' + 'Useful when running many iterations of each test (argument -n).') argp.add_argument('--force_default_poller', default=False, action='store_const', const=True, - help='Dont try to iterate over many polling strategies when they exist') + help='Don\'t try to iterate over many polling strategies when they exist') argp.add_argument('--max_time', default=-1, type=int, help='Maximum test runtime in seconds') +argp.add_argument('--bq_result_table', + default='', + type=str, + nargs='?', + help='Upload test results to a specified BQ table.') args = argp.parse_args() if args.force_default_poller: @@ -1503,6 +1511,8 @@ def _build_and_run( finally: for antagonist in antagonists: antagonist.kill() + if args.bq_result_table and resultset: + upload_results_to_bq(resultset, args.bq_result_table, args, platform_string()) if xml_report and resultset: report_utils.render_junit_xml_report(resultset, xml_report, suite_name=args.report_suite_name) -- cgit v1.2.3