From f8cc166605637f019c23f01493ff59106a5696eb Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 15 Jan 2015 07:39:09 -0800 Subject: [PATCH] Allow language to be specified to run_tests.py --- tools/run_tests/run_tests.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 0536ed68511..0fee6181911 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -46,7 +46,10 @@ _CONFIGS = { _DEFAULT = ['dbg', 'opt'] -_MAKE_TEST_TARGETS = ['buildtests_c', 'buildtests_cxx'] +_LANGUAGE_TEST_TARGETS = { + 'c++': 'buildtests_cxx', + 'c': 'buildtests_c', +} # parse command line argp = argparse.ArgumentParser(description='Run grpc tests.') @@ -64,6 +67,10 @@ argp.add_argument('--newline_on_success', default=False, action='store_const', const=True) +argp.add_argument('-l', '--language', + choices=sorted(_LANGUAGE_TEST_TARGETS.keys()), + nargs='+', + default=sorted(_LANGUAGE_TEST_TARGETS.keys())) args = argp.parse_args() # grab config @@ -72,6 +79,7 @@ run_configs = set(_CONFIGS[cfg] _CONFIGS.iterkeys() if x == 'all' else [x] for x in args.config)) build_configs = set(cfg.build_config for cfg in run_configs) +make_targets = set(_LANGUAGE_TEST_TARGETS[x] for x in args.language) filters = args.test_filter runs_per_test = args.runs_per_test forever = args.forever @@ -83,7 +91,7 @@ def _build_and_run(check_cancelled, newline_on_success, forever=False): if not jobset.run( (['make', '-j', '%d' % (multiprocessing.cpu_count() + 1), - 'CONFIG=%s' % cfg] + _MAKE_TEST_TARGETS + 'CONFIG=%s' % cfg] + list(make_targets) for cfg in build_configs), check_cancelled, maxjobs=1): return 1