Repository: mesos Updated Branches: refs/heads/master bf507a208 -> dfd1ee14a
Added env var to set default flags for parallel test runner. This patch modifies the parallel test runner to examine the environment variable 'MESOS_GTEST_RUNNER_FLAGS' for a default set of flags to pass. Flags given explicitly on the command line always have precedence over default flags from the environment variable. This allows e.g., to set the default level of parallelism to not overload systems with many CPUs during 'make check' (which could ultimately lead to tests hitting timeouts). Review: https://reviews.apache.org/r/63999/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dfd1ee14 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dfd1ee14 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dfd1ee14 Branch: refs/heads/master Commit: dfd1ee14acd76195d50354de844a18ff30614fab Parents: bf507a2 Author: Benjamin Bannier <bbann...@apache.org> Authored: Mon Nov 27 16:46:22 2017 +0100 Committer: Benjamin Bannier <bbann...@apache.org> Committed: Mon Nov 27 16:47:01 2017 +0100 ---------------------------------------------------------------------- support/mesos-gtest-runner.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/dfd1ee14/support/mesos-gtest-runner.py ---------------------------------------------------------------------- diff --git a/support/mesos-gtest-runner.py b/support/mesos-gtest-runner.py index 408e661..4ae5fe3 100755 --- a/support/mesos-gtest-runner.py +++ b/support/mesos-gtest-runner.py @@ -33,6 +33,7 @@ from __future__ import print_function import multiprocessing import optparse import os +import shlex import signal import subprocess import sys @@ -122,7 +123,24 @@ def parse_arguments(): ' 1 also shows full logs of failed shards, and anything' ' >1 shows all output. DEFAULT: 1') - (options, executable) = parser.parse_args() + parser.epilog = ( + 'The environment variable MESOS_GTEST_RUNNER_FLAGS ' + 'can be used to set a default set of flags. Flags passed on the ' + 'command line always have precedence over these defaults.') + + # If the environment variable `MESOS_GTEST_RUNNER_FLAGS` is set we + # use it to set a default set of flags to pass. Flags passed on + # the command line always have precedence over these defaults. + # + # We manually construct `args` here and make use of the fact that + # in `optparser`'s implementation flags passed later on the + # command line overrule identical flags passed earlier. + args = [] + if 'MESOS_GTEST_RUNNER_FLAGS' in os.environ: + args.extend(shlex.split(os.environ['MESOS_GTEST_RUNNER_FLAGS'])) + args.extend(sys.argv[1:]) + + (options, executable) = parser.parse_args(args) if not executable: parser.print_usage()