Monero
Loading...
Searching...
No Matches
gtest_output_test Namespace Reference

Classes

class  GTestOutputTest

Functions

 ToUnixLineEnding (s)
 RemoveLocations (test_output)
 RemoveStackTraceDetails (output)
 RemoveStackTraces (output)
 RemoveTime (output)
 RemoveTypeInfoDetails (test_output)
 NormalizeToCurrentPlatform (test_output)
 RemoveTestCounts (output)
 RemoveMatchingTests (test_output, pattern)
 NormalizeOutput (output)
 GetShellCommandOutput (env_cmd)
 GetCommandOutput (env_cmd)
 GetOutputOfAllCommands ()

Variables

str __author__ = 'wan@google.com (Zhanyong Wan)'
str GENGOLDEN_FLAG = '--gengolden'
str CATCH_EXCEPTIONS_ENV_VAR_NAME = 'GTEST_CATCH_EXCEPTIONS'
str IS_WINDOWS = 'nt'
str GOLDEN_NAME = 'gtest_output_test_golden_lin.txt'
 PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_output_test_')
tuple COMMAND_LIST_TESTS = ({}, [PROGRAM_PATH, '--gtest_list_tests'])
tuple COMMAND_WITH_COLOR = ({}, [PROGRAM_PATH, '--gtest_color=yes'])
tuple COMMAND_WITH_TIME
tuple COMMAND_WITH_DISABLED
tuple COMMAND_WITH_SHARDING
 GOLDEN_PATH = os.path.join(gtest_test_utils.GetSourceDir(), GOLDEN_NAME)
 test_list = GetShellCommandOutput(COMMAND_LIST_TESTS)
str SUPPORTS_DEATH_TESTS = 'DeathTest' in test_list
str SUPPORTS_TYPED_TESTS = 'TypedTest' in test_list
str SUPPORTS_THREADS = 'ExpectFailureWithThreadsTest' in test_list
bool SUPPORTS_STACK_TRACES = False
tuple CAN_GENERATE_GOLDEN_FILE
 output = GetOutputOfAllCommands()
 golden_file = open(GOLDEN_PATH, 'wb')
tuple message

Detailed Description

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.
       gtest_output_test.py --gengolden
       gtest_output_test.py

Function Documentation

◆ GetCommandOutput()

gtest_output_test.GetCommandOutput ( env_cmd)
Runs a command and returns its output with all file location
info stripped off.

Args:
  env_cmd:  The shell command. A 2-tuple where element 0 is a dict of extra
            environment variables to set, and element 1 is a string with
            the command and any flags.

◆ GetOutputOfAllCommands()

gtest_output_test.GetOutputOfAllCommands ( )
Returns concatenated output from several representative commands.

◆ GetShellCommandOutput()

gtest_output_test.GetShellCommandOutput ( env_cmd)
Runs a command in a sub-process, and returns its output in a string.

Args:
  env_cmd: The shell command. A 2-tuple where element 0 is a dict of extra
           environment variables to set, and element 1 is a string with
           the command and any flags.

Returns:
  A string with the command's combined standard and diagnostic output.

◆ NormalizeOutput()

gtest_output_test.NormalizeOutput ( output)
Normalizes output (the output of gtest_output_test_.exe).

◆ NormalizeToCurrentPlatform()

gtest_output_test.NormalizeToCurrentPlatform ( test_output)
Normalizes platform specific output details for easier comparison.

◆ RemoveLocations()

gtest_output_test.RemoveLocations ( test_output)
Removes all file location info from a Google Test program's output.

Args:
     test_output:  the output of a Google Test program.

Returns:
     output with all file location info (in the form of
     'DIRECTORY/FILE_NAME:LINE_NUMBER: 'or
     'DIRECTORY\\FILE_NAME(LINE_NUMBER): ') replaced by
     'FILE_NAME:#: '.

◆ RemoveMatchingTests()

gtest_output_test.RemoveMatchingTests ( test_output,
pattern )
Removes output of specified tests from a Google Test program's output.

This function strips not only the beginning and the end of a test but also
all output in between.

Args:
  test_output:       A string containing the test output.
  pattern:           A regex string that matches names of test cases or
                     tests to remove.

Returns:
  Contents of test_output with tests whose names match pattern removed.

◆ RemoveStackTraceDetails()

gtest_output_test.RemoveStackTraceDetails ( output)
Removes all stack traces from a Google Test program's output.

◆ RemoveStackTraces()

gtest_output_test.RemoveStackTraces ( output)
Removes all traces of stack traces from a Google Test program's output.

◆ RemoveTestCounts()

gtest_output_test.RemoveTestCounts ( output)
Removes test counts from a Google Test program's output.

◆ RemoveTime()

gtest_output_test.RemoveTime ( output)
Removes all time information from a Google Test program's output.

◆ RemoveTypeInfoDetails()

gtest_output_test.RemoveTypeInfoDetails ( test_output)
Removes compiler-specific type info from Google Test program's output.

Args:
     test_output:  the output of a Google Test program.

Returns:
     output with type information normalized to canonical form.

◆ ToUnixLineEnding()

gtest_output_test.ToUnixLineEnding ( s)
Changes all Windows/Mac line endings in s to UNIX line endings.

Variable Documentation

◆ __author__

str gtest_output_test.__author__ = 'wan@google.com (Zhanyong Wan)'
private

◆ CAN_GENERATE_GOLDEN_FILE

tuple gtest_output_test.CAN_GENERATE_GOLDEN_FILE
Initial value:
1= (SUPPORTS_DEATH_TESTS and
2 SUPPORTS_TYPED_TESTS and
3 SUPPORTS_THREADS and
4 not IS_WINDOWS)

◆ CATCH_EXCEPTIONS_ENV_VAR_NAME

str gtest_output_test.CATCH_EXCEPTIONS_ENV_VAR_NAME = 'GTEST_CATCH_EXCEPTIONS'

◆ COMMAND_LIST_TESTS

tuple gtest_output_test.COMMAND_LIST_TESTS = ({}, [PROGRAM_PATH, '--gtest_list_tests'])

◆ COMMAND_WITH_COLOR

tuple gtest_output_test.COMMAND_WITH_COLOR = ({}, [PROGRAM_PATH, '--gtest_color=yes'])

◆ COMMAND_WITH_DISABLED

tuple gtest_output_test.COMMAND_WITH_DISABLED
Initial value:
1= (
2 {}, [PROGRAM_PATH,
3 '--gtest_also_run_disabled_tests',
4 'internal_skip_environment_and_ad_hoc_tests',
5 '--gtest_filter=*DISABLED_*'])

◆ COMMAND_WITH_SHARDING

tuple gtest_output_test.COMMAND_WITH_SHARDING
Initial value:
1= (
2 {'GTEST_SHARD_INDEX': '1', 'GTEST_TOTAL_SHARDS': '2'},
3 [PROGRAM_PATH,
4 'internal_skip_environment_and_ad_hoc_tests',
5 '--gtest_filter=PassingTest.*'])

◆ COMMAND_WITH_TIME

tuple gtest_output_test.COMMAND_WITH_TIME
Initial value:
1= ({}, [PROGRAM_PATH,
2 '--gtest_print_time',
3 'internal_skip_environment_and_ad_hoc_tests',
4 '--gtest_filter=FatalFailureTest.*:LoggingTest.*'])

◆ GENGOLDEN_FLAG

str gtest_output_test.GENGOLDEN_FLAG = '--gengolden'

◆ golden_file

gtest_output_test.golden_file = open(GOLDEN_PATH, 'wb')

◆ GOLDEN_NAME

str gtest_output_test.GOLDEN_NAME = 'gtest_output_test_golden_lin.txt'

◆ GOLDEN_PATH

gtest_output_test.GOLDEN_PATH = os.path.join(gtest_test_utils.GetSourceDir(), GOLDEN_NAME)

◆ IS_WINDOWS

str gtest_output_test.IS_WINDOWS = 'nt'

◆ message

tuple gtest_output_test.message
Initial value:
1= (
2 )

◆ output

gtest_output_test.output = GetOutputOfAllCommands()

◆ PROGRAM_PATH

gtest_output_test.PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_output_test_')

◆ SUPPORTS_DEATH_TESTS

str gtest_output_test.SUPPORTS_DEATH_TESTS = 'DeathTest' in test_list

◆ SUPPORTS_STACK_TRACES

bool gtest_output_test.SUPPORTS_STACK_TRACES = False

◆ SUPPORTS_THREADS

str gtest_output_test.SUPPORTS_THREADS = 'ExpectFailureWithThreadsTest' in test_list

◆ SUPPORTS_TYPED_TESTS

str gtest_output_test.SUPPORTS_TYPED_TESTS = 'TypedTest' in test_list

◆ test_list

gtest_output_test.test_list = GetShellCommandOutput(COMMAND_LIST_TESTS)