diff options
Diffstat (limited to 'test/gtest_test_utils.py')
-rwxr-xr-x | test/gtest_test_utils.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/test/gtest_test_utils.py b/test/gtest_test_utils.py index 6dd8db4..7e3cbca 100755 --- a/test/gtest_test_utils.py +++ b/test/gtest_test_utils.py @@ -56,6 +56,21 @@ GTEST_OUTPUT_VAR_NAME = 'GTEST_OUTPUT' IS_WINDOWS = os.name == 'nt' IS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0] +# The environment variable for specifying the path to the premature-exit file. +PREMATURE_EXIT_FILE_ENV_VAR = 'TEST_PREMATURE_EXIT_FILE' + +environ = os.environ.copy() + + +def SetEnvVar(env_var, value): + """Sets/unsets an environment variable to a given value.""" + + if value is not None: + environ[env_var] = value + elif env_var in environ: + del environ[env_var] + + # Here we expose a class from a particular module, depending on the # environment. The comment suppresses the 'Invalid variable name' lint # complaint. @@ -160,9 +175,9 @@ def GetTestExecutablePath(executable_name, build_dir=None): if not os.path.exists(path): message = ( - 'Unable to find the test binary. Please make sure to provide path\n' - 'to the binary via the --build_dir flag or the BUILD_DIR\n' - 'environment variable.') + 'Unable to find the test binary "%s". Please make sure to provide\n' + 'a path to the binary via the --build_dir flag or the BUILD_DIR\n' + 'environment variable.' % path) print >> sys.stderr, message sys.exit(1) |