diff --git a/SConstruct b/SConstruct index 433302746..f9f91dcbe 100644 --- a/SConstruct +++ b/SConstruct @@ -590,6 +590,11 @@ config_options = [ 'VERBOSE', """Create verbose output about what SCons is doing.""", False), + ( + 'gtest_flags', + """Additional options passed to each GTest test suite, e.g. + '--gtest_filter=*pattern*'. Separate multiple options with spaces.""", + ''), BoolVariable( 'renamed_shared_libraries', """If this option is turned on, the shared libraries that are created diff --git a/doc/sphinx/compiling/config-options.rst b/doc/sphinx/compiling/config-options.rst index 9f88895ae..85df4958a 100644 --- a/doc/sphinx/compiling/config-options.rst +++ b/doc/sphinx/compiling/config-options.rst @@ -487,6 +487,12 @@ Options List - default: ``'no'`` +.. _gtest-flags: + +* ``gtest_flags``: [ ``string`` ] + Additional options passed to each GTest test suite, e.g. + `--gtest_filter=*pattern*`. Separate multiple options with spaces. + .. _renamed-shared-libraries: * ``renamed_shared_libraries``: [ ``yes`` | ``no`` ] diff --git a/doc/sphinx/compiling/configure-build.rst b/doc/sphinx/compiling/configure-build.rst index d5b17dea0..6aad50de7 100644 --- a/doc/sphinx/compiling/configure-build.rst +++ b/doc/sphinx/compiling/configure-build.rst @@ -146,6 +146,7 @@ Less Common Options * :ref:`env_vars ` * :ref:`layout ` * :ref:`VERBOSE ` +* :ref:`gtest_flags ` .. _sec-build-commands: diff --git a/test/SConscript b/test/SConscript index 6b073ba15..fb275e572 100644 --- a/test/SConscript +++ b/test/SConscript @@ -50,8 +50,9 @@ def addTestProgram(subdir, progName, env_vars={}): if not os.path.isdir(workDir): os.mkdir(workDir) - code = subprocess.call([program.abspath, '--gtest_output=xml:'+resultsFile], - env=env['ENV'], cwd=workDir) + cmd = [program.abspath, '--gtest_output=xml:'+resultsFile] + cmd.extend(env['gtest_flags'].split()) + code = subprocess.call(cmd, env=env['ENV'], cwd=workDir) if code: print "FAILED: Test '{0}' exited with code {1}".format(progName, code)