32 """Unit test utilities for Google C++ Mocking Framework."""
34 __author__ =
'wan@google.com (Zhanyong Wan)'
41 SCRIPT_DIR = os.path.dirname(__file__)
or '.'
44 gtest_tests_util_dir = os.path.join(SCRIPT_DIR,
'../gtest/test')
45 if os.path.isdir(gtest_tests_util_dir):
46 GTEST_TESTS_UTIL_DIR = gtest_tests_util_dir
48 GTEST_TESTS_UTIL_DIR = os.path.join(SCRIPT_DIR,
'../../gtest/test')
50 sys.path.append(GTEST_TESTS_UTIL_DIR)
51 import gtest_test_utils
55 """Returns the absolute path of the directory where the .py files are."""
61 """Returns the absolute path of the test binary given its name.
63 The function will print a message and abort the program if the resulting file
67 executable_name: name of the test binary that the test script runs.
70 The absolute path of the test binary.
77 """Returns the argument to exit(), or -1 if exit() wasn't called.
80 exit_code: the result value of os.system(command).
90 if os.WIFEXITED(exit_code):
91 return os.WEXITSTATUS(exit_code)
101 TestCase = gtest_test_utils.TestCase
102 environ = gtest_test_utils.environ
103 SetEnvVar = gtest_test_utils.SetEnvVar
104 PREMATURE_EXIT_FILE_ENV_VAR = gtest_test_utils.PREMATURE_EXIT_FILE_ENV_VAR
110 """Runs the unit test."""