diff options
Diffstat (limited to 'googletest/test/gtest_output_test.py')
-rwxr-xr-x | googletest/test/gtest_output_test.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/googletest/test/gtest_output_test.py b/googletest/test/gtest_output_test.py index 06dbee0..e431653 100755 --- a/googletest/test/gtest_output_test.py +++ b/googletest/test/gtest_output_test.py @@ -31,6 +31,7 @@ """Tests the text output of Google C++ Testing Framework. + SYNOPSIS gtest_output_test.py --build_dir=BUILD/DIR --gengolden # where BUILD/DIR contains the built gtest_output_test_ file. @@ -51,6 +52,7 @@ import gtest_test_utils GENGOLDEN_FLAG = '--gengolden' CATCH_EXCEPTIONS_ENV_VAR_NAME = 'GTEST_CATCH_EXCEPTIONS' +IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux' IS_WINDOWS = os.name == 'nt' # TODO(vladl@google.com): remove the _lin suffix. @@ -99,7 +101,8 @@ def RemoveLocations(test_output): 'FILE_NAME:#: '. """ - return re.sub(r'.*[/\\](.+)(\:\d+|\(\d+\))\: ', r'\1:#: ', test_output) + return re.sub(r'.*[/\\]((gtest_output_test_|gtest).cc)(\:\d+|\(\d+\))\: ', + r'\1:#: ', test_output) def RemoveStackTraceDetails(output): @@ -249,11 +252,12 @@ test_list = GetShellCommandOutput(COMMAND_LIST_TESTS) SUPPORTS_DEATH_TESTS = 'DeathTest' in test_list SUPPORTS_TYPED_TESTS = 'TypedTest' in test_list SUPPORTS_THREADS = 'ExpectFailureWithThreadsTest' in test_list -SUPPORTS_STACK_TRACES = False +SUPPORTS_STACK_TRACES = IS_LINUX CAN_GENERATE_GOLDEN_FILE = (SUPPORTS_DEATH_TESTS and SUPPORTS_TYPED_TESTS and SUPPORTS_THREADS and + SUPPORTS_STACK_TRACES and not IS_WINDOWS) class GTestOutputTest(gtest_test_utils.TestCase): @@ -279,7 +283,7 @@ class GTestOutputTest(gtest_test_utils.TestCase): def testOutput(self): output = GetOutputOfAllCommands() - golden_file = open(GOLDEN_PATH, 'r') + golden_file = open(GOLDEN_PATH, 'rb') # A mis-configured source control system can cause \r appear in EOL # sequences when we read the golden file irrespective of an operating # system used. Therefore, we need to strip those \r's from newlines @@ -330,9 +334,9 @@ if __name__ == '__main__': else: message = ( """Unable to write a golden file when compiled in an environment -that does not support all the required features (death tests, typed tests, -and multiple threads). Please generate the golden file using a binary built -with those features enabled.""") +that does not support all the required features (death tests, +typed tests, stack traces, and multiple threads). +Please build this test and generate the golden file using Blaze on Linux.""") sys.stderr.write(message) sys.exit(1) |