aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests/run_tests.py
diff options
context:
space:
mode:
authorGravatar Matt Kwong <mattkwong@google.com>2017-04-17 13:56:51 -0700
committerGravatar Matt Kwong <mattkwong@google.com>2017-05-08 13:52:45 -0700
commit52ff986f941561148407e72347b2725c3d084322 (patch)
treee09cc78c33fd4e24d5cf3aa038b9358b23953815 /tools/run_tests/run_tests.py
parent06af233945e8349533ef1a1acddb863f35619a45 (diff)
Add option to upload Jenkins test result to BQ
Diffstat (limited to 'tools/run_tests/run_tests.py')
-rwxr-xr-xtools/run_tests/run_tests.py18
1 files changed, 14 insertions, 4 deletions
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)