diff --git a/.cvsignore b/.cvsignore index 1da9b55..47bc7b6 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -gtest-1.3.0.tar.bz2 +gtest-1.4.0.tar.bz2 diff --git a/gtest-svnr257.patch b/gtest-svnr257.patch deleted file mode 100644 index 988e928..0000000 --- a/gtest-svnr257.patch +++ /dev/null @@ -1,800 +0,0 @@ -Only in gtest-1.3.0: aclocal.m4 -Only in gtest-1.3.0/build-aux: config.guess -Only in gtest-1.3.0/build-aux: config.h.in -Only in gtest-1.3.0/build-aux: config.sub -Only in gtest-1.3.0/build-aux: depcomp -Only in gtest-1.3.0/build-aux: install-sh -Only in gtest-1.3.0/build-aux: ltmain.sh -Only in gtest-1.3.0/build-aux: missing -Only in gtest-1.3.0: configure -Only in gtest-1.3.0: Makefile.in -diff -urP gtest-1.3.0/scripts/fuse_gtest_files.py gtest-svn/scripts/fuse_gtest_files.py ---- gtest-1.3.0/scripts/fuse_gtest_files.py 2009-03-18 17:41:09.000000000 -0400 -+++ gtest-svn/scripts/fuse_gtest_files.py 2009-06-01 15:11:15.752227177 -0400 -@@ -29,7 +29,7 @@ - # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - --"""fuse_gtest_files.py v0.1.0 -+"""fuse_gtest_files.py v0.2.0 - Fuses Google Test source code into a .h file and a .cc file. - - SYNOPSIS -@@ -42,8 +42,8 @@ - two files contain everything you need to use Google Test. Hence - you can "install" Google Test by copying them to wherever you want. - -- GTEST_ROOT_DIR can be omitted and defaults to the parent directory -- of the directory holding the fuse_gtest_files.py script. -+ GTEST_ROOT_DIR can be omitted and defaults to the parent -+ directory of the directory holding this script. - - EXAMPLES - ./fuse_gtest_files.py fused_gtest -@@ -63,13 +63,17 @@ - import sets - import sys - -+# We assume that this file is in the scripts/ directory in the Google -+# Test root directory. -+DEFAULT_GTEST_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..') -+ - # Regex for matching '#include '. - INCLUDE_GTEST_FILE_REGEX = re.compile(r'^\s*#\s*include\s*<(gtest/.+)>') - - # Regex for matching '#include "src/..."'. - INCLUDE_SRC_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(src/.+)"') - --# Where to find the source files. -+# Where to find the source seed files. - GTEST_H_SEED = 'include/gtest/gtest.h' - GTEST_SPI_H_SEED = 'include/gtest/gtest-spi.h' - GTEST_ALL_CC_SEED = 'src/gtest-all.cc' -@@ -79,18 +83,18 @@ - GTEST_ALL_CC_OUTPUT = 'gtest/gtest-all.cc' - - --def GetGTestRootDir(): -- """Returns the absolute path to the Google Test root directory. -+def VerifyFileExists(directory, relative_path): -+ """Verifies that the given file exists; aborts on failure. - -- We assume that this script is in a sub-directory of the Google Test root. -+ relative_path is the file path relative to the given directory. - """ - -- my_path = sys.argv[0] # Path to this script. -- my_dir = os.path.dirname(my_path) -- if not my_dir: -- my_dir = '.' -- -- return os.path.abspath(os.path.join(my_dir, '..')) -+ if not os.path.isfile(os.path.join(directory, relative_path)): -+ print 'ERROR: Cannot find %s in directory %s.' % (relative_path, -+ directory) -+ print ('Please either specify a valid project root directory ' -+ 'or omit it on the command line.') -+ sys.exit(1) - - - def ValidateGTestRootDir(gtest_root): -@@ -99,21 +103,34 @@ - The function aborts the program on failure. - """ - -- def VerifyFileExists(relative_path): -- """Verifies that the given file exists; aborts on failure. -+ VerifyFileExists(gtest_root, GTEST_H_SEED) -+ VerifyFileExists(gtest_root, GTEST_ALL_CC_SEED) -+ -+ -+def VerifyOutputFile(output_dir, relative_path): -+ """Verifies that the given output file path is valid. - -- relative_path is the file path relative to the gtest root. -- """ -+ relative_path is relative to the output_dir directory. -+ """ - -- if not os.path.isfile(os.path.join(gtest_root, relative_path)): -- print 'ERROR: Cannot find %s in directory %s.' % (relative_path, -- gtest_root) -- print ('Please either specify a valid Google Test root directory ' -- 'or omit it on the command line.') -+ # Makes sure the output file either doesn't exist or can be overwritten. -+ output_file = os.path.join(output_dir, relative_path) -+ if os.path.exists(output_file): -+ # TODO(wan@google.com): The following user-interaction doesn't -+ # work with automated processes. We should provide a way for the -+ # Makefile to force overwriting the files. -+ print ('%s already exists in directory %s - overwrite it? (y/N) ' % -+ (relative_path, output_dir)) -+ answer = sys.stdin.readline().strip() -+ if answer not in ['y', 'Y']: -+ print 'ABORTED.' - sys.exit(1) - -- VerifyFileExists(GTEST_H_SEED) -- VerifyFileExists(GTEST_ALL_CC_SEED) -+ # Makes sure the directory holding the output file exists; creates -+ # it and all its ancestors if necessary. -+ parent_directory = os.path.dirname(output_file) -+ if not os.path.isdir(parent_directory): -+ os.makedirs(parent_directory) - - - def ValidateOutputDir(output_dir): -@@ -122,30 +139,8 @@ - The function aborts the program on failure. - """ - -- def VerifyOutputFile(relative_path): -- """Verifies that the given output file path is valid. -- -- relative_path is relative to the output_dir directory. -- """ -- -- # Makes sure the output file either doesn't exist or can be overwritten. -- output_file = os.path.join(output_dir, relative_path) -- if os.path.exists(output_file): -- print ('%s already exists in directory %s - overwrite it? (y/N) ' % -- (relative_path, output_dir)) -- answer = sys.stdin.readline().strip() -- if answer not in ['y', 'Y']: -- print 'ABORTED.' -- sys.exit(1) -- -- # Makes sure the directory holding the output file exists; creates -- # it and all its ancestors if necessary. -- parent_directory = os.path.dirname(output_file) -- if not os.path.isdir(parent_directory): -- os.makedirs(parent_directory) -- -- VerifyOutputFile(GTEST_H_OUTPUT) -- VerifyOutputFile(GTEST_ALL_CC_OUTPUT) -+ VerifyOutputFile(output_dir, GTEST_H_OUTPUT) -+ VerifyOutputFile(output_dir, GTEST_ALL_CC_OUTPUT) - - - def FuseGTestH(gtest_root, output_dir): -@@ -177,10 +172,9 @@ - output_file.close() - - --def FuseGTestAllCc(gtest_root, output_dir): -- """Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir.""" -+def FuseGTestAllCcToFile(gtest_root, output_file): -+ """Scans folder gtest_root to generate gtest/gtest-all.cc in output_file.""" - -- output_file = file(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w') - processed_files = sets.Set() - - def ProcessFile(gtest_source_file): -@@ -219,10 +213,19 @@ - output_file.write(line) - - ProcessFile(GTEST_ALL_CC_SEED) -+ -+ -+def FuseGTestAllCc(gtest_root, output_dir): -+ """Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir.""" -+ -+ output_file = file(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w') -+ FuseGTestAllCcToFile(gtest_root, output_file) - output_file.close() - - - def FuseGTest(gtest_root, output_dir): -+ """Fuses gtest.h and gtest-all.cc.""" -+ - ValidateGTestRootDir(gtest_root) - ValidateOutputDir(output_dir) - -@@ -234,7 +237,7 @@ - argc = len(sys.argv) - if argc == 2: - # fuse_gtest_files.py OUTPUT_DIR -- FuseGTest(GetGTestRootDir(), sys.argv[1]) -+ FuseGTest(DEFAULT_GTEST_ROOT_DIR, sys.argv[1]) - elif argc == 3: - # fuse_gtest_files.py GTEST_ROOT_DIR OUTPUT_DIR - FuseGTest(sys.argv[1], sys.argv[2]) -diff -urP gtest-1.3.0/test/gtest_break_on_failure_unittest.py gtest-svn/test/gtest_break_on_failure_unittest.py ---- gtest-1.3.0/test/gtest_break_on_failure_unittest.py 2009-06-01 15:13:04.583976123 -0400 -+++ gtest-svn/test/gtest_break_on_failure_unittest.py 2009-06-01 15:11:13.240226460 -0400 -@@ -59,9 +59,12 @@ - # The environment variable for enabling/disabling the throw-on-failure mode. - THROW_ON_FAILURE_ENV_VAR = 'GTEST_THROW_ON_FAILURE' - -+# The environment variable for enabling/disabling the catch-exceptions mode. -+CATCH_EXCEPTIONS_ENV_VAR = 'GTEST_CATCH_EXCEPTIONS' -+ - # Path to the gtest_break_on_failure_unittest_ program. --EXE_PATH = os.path.join(gtest_test_utils.GetBuildDir(), -- 'gtest_break_on_failure_unittest_') -+EXE_PATH = gtest_test_utils.GetTestExecutablePath( -+ 'gtest_break_on_failure_unittest_') - - - # Utilities. -Only in gtest-1.3.0/test: gtest_break_on_failure_unittest.py.orig -Only in gtest-1.3.0/test: gtest_break_on_failure_unittest.py.rej -diff -urP gtest-1.3.0/test/gtest_color_test.py gtest-svn/test/gtest_color_test.py ---- gtest-1.3.0/test/gtest_color_test.py 2009-03-18 17:41:04.000000000 -0400 -+++ gtest-svn/test/gtest_color_test.py 2009-06-01 15:11:13.238237101 -0400 -@@ -38,11 +38,11 @@ - import sys - import unittest - -+IS_WINDOWS = os.name = 'nt' - - COLOR_ENV_VAR = 'GTEST_COLOR' - COLOR_FLAG = 'gtest_color' --COMMAND = os.path.join(gtest_test_utils.GetBuildDir(), -- 'gtest_color_test_') -+COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_color_test_') - - - def SetEnvVar(env_var, value): -@@ -69,11 +69,12 @@ - def testNoEnvVarNoFlag(self): - """Tests the case when there's neither GTEST_COLOR nor --gtest_color.""" - -- self.assert_(not UsesColor('dumb', None, None)) -- self.assert_(not UsesColor('emacs', None, None)) -- self.assert_(not UsesColor('xterm-mono', None, None)) -- self.assert_(not UsesColor('unknown', None, None)) -- self.assert_(not UsesColor(None, None, None)) -+ if not IS_WINDOWS: -+ self.assert_(not UsesColor('dumb', None, None)) -+ self.assert_(not UsesColor('emacs', None, None)) -+ self.assert_(not UsesColor('xterm-mono', None, None)) -+ self.assert_(not UsesColor('unknown', None, None)) -+ self.assert_(not UsesColor(None, None, None)) - self.assert_(UsesColor('cygwin', None, None)) - self.assert_(UsesColor('xterm', None, None)) - self.assert_(UsesColor('xterm-color', None, None)) -@@ -83,7 +84,8 @@ - - self.assert_(not UsesColor('dumb', None, 'no')) - self.assert_(not UsesColor('xterm-color', None, 'no')) -- self.assert_(not UsesColor('emacs', None, 'auto')) -+ if not IS_WINDOWS: -+ self.assert_(not UsesColor('emacs', None, 'auto')) - self.assert_(UsesColor('xterm', None, 'auto')) - self.assert_(UsesColor('dumb', None, 'yes')) - self.assert_(UsesColor('xterm', None, 'yes')) -@@ -93,7 +95,8 @@ - - self.assert_(not UsesColor('dumb', 'no', None)) - self.assert_(not UsesColor('xterm-color', 'no', None)) -- self.assert_(not UsesColor('dumb', 'auto', None)) -+ if not IS_WINDOWS: -+ self.assert_(not UsesColor('dumb', 'auto', None)) - self.assert_(UsesColor('xterm-color', 'auto', None)) - self.assert_(UsesColor('dumb', 'yes', None)) - self.assert_(UsesColor('xterm-color', 'yes', None)) -diff -urP gtest-1.3.0/test/gtest_env_var_test.py gtest-svn/test/gtest_env_var_test.py ---- gtest-1.3.0/test/gtest_env_var_test.py 2009-06-01 15:13:04.585976029 -0400 -+++ gtest-svn/test/gtest_env_var_test.py 2009-06-01 15:11:13.243226284 -0400 -@@ -41,18 +41,7 @@ - IS_WINDOWS = os.name == 'nt' - IS_LINUX = os.name == 'posix' - --if IS_WINDOWS: -- BUILD_DIRS = [ -- 'build.dbg\\', -- 'build.opt\\', -- 'build.dbg8\\', -- 'build.opt8\\', -- ] -- COMMAND = 'gtest_env_var_test_.exe' -- --if IS_LINUX: -- COMMAND = os.path.join(gtest_test_utils.GetBuildDir(), -- 'gtest_env_var_test_') -+COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_env_var_test_') - - - def AssertEq(expected, actual): -@@ -101,37 +90,22 @@ - TestFlag(command, 'color', 'yes', 'auto') - TestFlag(command, 'filter', 'FooTest.Bar', '*') - TestFlag(command, 'output', 'tmp/foo.xml', '') -- TestFlag(command, 'print_time', '1', '0') -+ TestFlag(command, 'print_time', '0', '1') - TestFlag(command, 'repeat', '999', '1') - TestFlag(command, 'throw_on_failure', '1', '0') -+ TestFlag(command, 'death_test_style', 'threadsafe', 'fast') - - if IS_WINDOWS: - TestFlag(command, 'catch_exceptions', '1', '0') - if IS_LINUX: - TestFlag(command, 'stack_trace_depth', '0', '100') -- TestFlag(command, 'death_test_style', 'thread-safe', 'fast') - TestFlag(command, 'death_test_use_fork', '1', '0') - - --if IS_WINDOWS: -+class GTestEnvVarTest(unittest.TestCase): -+ def testEnvVarAffectsFlag(self): -+ TestEnvVarAffectsFlag(COMMAND) - -- def main(): -- for build_dir in BUILD_DIRS: -- command = build_dir + COMMAND -- print 'Testing with %s . . .' % (command,) -- TestEnvVarAffectsFlag(command) -- return 0 - -- if __name__ == '__main__': -- main() -- -- --if IS_LINUX: -- -- class GTestEnvVarTest(unittest.TestCase): -- def testEnvVarAffectsFlag(self): -- TestEnvVarAffectsFlag(COMMAND) -- -- -- if __name__ == '__main__': -- gtest_test_utils.Main() -+if __name__ == '__main__': -+ gtest_test_utils.Main() -Only in gtest-1.3.0/test: gtest_env_var_test.py.orig -Only in gtest-1.3.0/test: gtest_env_var_test.py.rej -diff -urP gtest-1.3.0/test/gtest_filter_unittest.py gtest-svn/test/gtest_filter_unittest.py ---- gtest-1.3.0/test/gtest_filter_unittest.py 2009-03-18 17:41:05.000000000 -0400 -+++ gtest-svn/test/gtest_filter_unittest.py 2009-06-01 15:11:13.240226460 -0400 -@@ -52,6 +52,8 @@ - - # Constants. - -+IS_WINDOWS = os.name == 'nt' -+ - # The environment variable for specifying the test filters. - FILTER_ENV_VAR = 'GTEST_FILTER' - -@@ -67,8 +69,7 @@ - ALSO_RUN_DISABED_TESTS_FLAG = 'gtest_also_run_disabled_tests' - - # Command to run the gtest_filter_unittest_ program. --COMMAND = os.path.join(gtest_test_utils.GetBuildDir(), -- 'gtest_filter_unittest_') -+COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_filter_unittest_') - - # Regex for determining whether parameterized tests are enabled in the binary. - PARAM_TEST_REGEX = re.compile(r'/ParamTest') -@@ -204,23 +205,36 @@ - self.assertEqual(len(set_var), len(full_partition)) - self.assertEqual(sets.Set(set_var), sets.Set(full_partition)) - -+ def AdjustForParameterizedTests(self, tests_to_run): -+ """Adjust tests_to_run in case value parameterized tests are disabled -+ in the binary. -+ """ -+ global param_tests_present -+ if not param_tests_present: -+ return list(sets.Set(tests_to_run) - sets.Set(PARAM_TESTS)) -+ else: -+ return tests_to_run -+ - def RunAndVerify(self, gtest_filter, tests_to_run): - """Runs gtest_flag_unittest_ with the given filter, and verifies - that the right set of tests were run. - """ -- # Adjust tests_to_run in case value parameterized tests are disabled -- # in the binary. -- global param_tests_present -- if not param_tests_present: -- tests_to_run = list(sets.Set(tests_to_run) - sets.Set(PARAM_TESTS)) -+ tests_to_run = self.AdjustForParameterizedTests(tests_to_run) - - # First, tests using GTEST_FILTER. - -- SetEnvVar(FILTER_ENV_VAR, gtest_filter) -- tests_run = Run(COMMAND)[0] -- SetEnvVar(FILTER_ENV_VAR, None) -- -- self.AssertSetEqual(tests_run, tests_to_run) -+ # Windows removes empty variables from the environment when passing it -+ # to a new process. This means it is impossible to pass an empty filter -+ # into a process using the GTEST_FILTER environment variable. However, -+ # we can still test the case when the variable is not supplied (i.e., -+ # gtest_filter is None). -+ # pylint: disable-msg=C6403 -+ if not IS_WINDOWS or gtest_filter != '': -+ SetEnvVar(FILTER_ENV_VAR, gtest_filter) -+ tests_run = Run(COMMAND)[0] -+ SetEnvVar(FILTER_ENV_VAR, None) -+ self.AssertSetEqual(tests_run, tests_to_run) -+ # pylint: enable-msg=C6403 - - # Next, tests using --gtest_filter. - -@@ -239,21 +253,33 @@ - on each shard should be identical to tests_to_run, without duplicates. - If check_exit_0, make sure that all shards returned 0. - """ -- SetEnvVar(FILTER_ENV_VAR, gtest_filter) -- partition = [] -- for i in range(0, total_shards): -- (tests_run, exit_code) = RunWithSharding(total_shards, i, command) -- if check_exit_0: -- self.assert_(exit_code is None) -- partition.append(tests_run) -+ tests_to_run = self.AdjustForParameterizedTests(tests_to_run) - -- self.AssertPartitionIsValid(tests_to_run, partition) -- SetEnvVar(FILTER_ENV_VAR, None) -+ # Windows removes empty variables from the environment when passing it -+ # to a new process. This means it is impossible to pass an empty filter -+ # into a process using the GTEST_FILTER environment variable. However, -+ # we can still test the case when the variable is not supplied (i.e., -+ # gtest_filter is None). -+ # pylint: disable-msg=C6403 -+ if not IS_WINDOWS or gtest_filter != '': -+ SetEnvVar(FILTER_ENV_VAR, gtest_filter) -+ partition = [] -+ for i in range(0, total_shards): -+ (tests_run, exit_code) = RunWithSharding(total_shards, i, command) -+ if check_exit_0: -+ self.assert_(exit_code is None) -+ partition.append(tests_run) -+ -+ self.AssertPartitionIsValid(tests_to_run, partition) -+ SetEnvVar(FILTER_ENV_VAR, None) -+ # pylint: enable-msg=C6403 - - def RunAndVerifyAllowingDisabled(self, gtest_filter, tests_to_run): - """Runs gtest_flag_unittest_ with the given filter, and enables - disabled tests. Verifies that the right set of tests were run. - """ -+ tests_to_run = self.AdjustForParameterizedTests(tests_to_run) -+ - # Construct the command line. - command = '%s --%s' % (COMMAND, ALSO_RUN_DISABED_TESTS_FLAG) - if gtest_filter is not None: -@@ -263,8 +289,10 @@ - self.AssertSetEqual(tests_run, tests_to_run) - - def setUp(self): -- """Sets up test case. Determines whether value-parameterized tests are -- enabled in the binary and sets flags accordingly. -+ """Sets up test case. -+ -+ Determines whether value-parameterized tests are enabled in the binary and -+ sets the flags accordingly. - """ - global param_tests_present - if param_tests_present is None: -diff -urP gtest-1.3.0/test/gtest_list_tests_unittest.py gtest-svn/test/gtest_list_tests_unittest.py ---- gtest-1.3.0/test/gtest_list_tests_unittest.py 2009-06-01 15:13:04.587976144 -0400 -+++ gtest-svn/test/gtest_list_tests_unittest.py 2009-06-01 15:11:13.242226157 -0400 -@@ -52,8 +52,7 @@ - LIST_TESTS_FLAG = 'gtest_list_tests' - - # Path to the gtest_list_tests_unittest_ program. --EXE_PATH = os.path.join(gtest_test_utils.GetBuildDir(), -- 'gtest_list_tests_unittest_'); -+EXE_PATH = gtest_test_utils.GetTestExecutablePath('gtest_list_tests_unittest_') - - # The expected output when running gtest_list_tests_unittest_ with - # --gtest_list_tests -Only in gtest-1.3.0/test: gtest_list_tests_unittest.py.orig -diff -urP gtest-1.3.0/test/gtest_output_test.py gtest-svn/test/gtest_output_test.py ---- gtest-1.3.0/test/gtest_output_test.py 2009-06-01 15:13:04.588976621 -0400 -+++ gtest-svn/test/gtest_output_test.py 2009-06-01 15:11:13.244226132 -0400 -@@ -54,16 +54,15 @@ - IS_WINDOWS = os.name == 'nt' - - if IS_WINDOWS: -- PROGRAM = r'..\build.dbg8\gtest_output_test_.exe' - GOLDEN_NAME = 'gtest_output_test_golden_win.txt' - else: -- PROGRAM = 'gtest_output_test_' - GOLDEN_NAME = 'gtest_output_test_golden_lin.txt' - --PROGRAM_PATH = os.path.join(gtest_test_utils.GetBuildDir(), PROGRAM) -+PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_output_test_') - - # At least one command we exercise must not have the - # --gtest_internal_skip_environment_and_ad_hoc_tests flag. -+COMMAND_LIST_TESTS = ({}, PROGRAM_PATH + ' --gtest_list_tests') - COMMAND_WITH_COLOR = ({}, PROGRAM_PATH + ' --gtest_color=yes') - COMMAND_WITH_TIME = ({}, PROGRAM_PATH + ' --gtest_print_time ' - '--gtest_internal_skip_environment_and_ad_hoc_tests ' -@@ -76,8 +75,7 @@ - ' --gtest_internal_skip_environment_and_ad_hoc_tests ' - ' --gtest_filter="PassingTest.*"') - --GOLDEN_PATH = os.path.join(gtest_test_utils.GetSourceDir(), -- GOLDEN_NAME) -+GOLDEN_PATH = os.path.join(gtest_test_utils.GetSourceDir(), GOLDEN_NAME) - - - def ToUnixLineEnding(s): -@@ -119,15 +117,35 @@ - def RemoveTestCounts(output): - """Removes test counts from a Google Test program's output.""" - -+ output = re.sub(r'\d+ tests, listed below', -+ '? tests, listed below', output) -+ output = re.sub(r'\d+ FAILED TESTS', -+ '? FAILED TESTS', output) - output = re.sub(r'\d+ tests from \d+ test cases', - '? tests from ? test cases', output) - return re.sub(r'\d+ tests\.', '? tests.', output) - - --def RemoveDeathTests(output): -- """Removes death test information from a Google Test program's output.""" -+def RemoveMatchingTests(test_output, pattern): -+ """Removes typed test information from a Google Test program's output. - -- return re.sub(r'\n.*DeathTest.*', '', 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 string that matches names of test cases to remove. -+ -+ Returns: -+ Contents of test_output with removed test case whose names match pattern. -+ """ -+ -+ test_output = re.sub( -+ r'\[ RUN \] .*%s(.|\n)*?\[( FAILED | OK )\] .*%s.*\n' % ( -+ pattern, pattern), -+ '', -+ test_output) -+ return re.sub(r'.*%s.*\n' % pattern, '', test_output) - - - def NormalizeOutput(output): -@@ -220,25 +238,50 @@ - GetCommandOutput(COMMAND_WITH_SHARDING)) - - -+test_list = GetShellCommandOutput(COMMAND_LIST_TESTS, '') -+SUPPORTS_DEATH_TESTS = 'DeathTest' in test_list -+SUPPORTS_TYPED_TESTS = 'TypedTest' in test_list -+ -+ - class GTestOutputTest(unittest.TestCase): -+ def RemoveUnsupportedTests(self, test_output): -+ if not SUPPORTS_DEATH_TESTS: -+ test_output = RemoveMatchingTests(test_output, 'DeathTest') -+ if not SUPPORTS_TYPED_TESTS: -+ test_output = RemoveMatchingTests(test_output, 'TypedTest') -+ return test_output -+ - def testOutput(self): - output = GetOutputOfAllCommands() -+ - golden_file = open(GOLDEN_PATH, 'rb') -- golden = golden_file.read() -+ # 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 -+ # unconditionally. -+ golden = ToUnixLineEnding(golden_file.read()) - golden_file.close() - - # We want the test to pass regardless of death tests being - # supported or not. -- self.assert_(output == golden or -- RemoveTestCounts(output) == -- RemoveTestCounts(RemoveDeathTests(golden))) -+ if SUPPORTS_DEATH_TESTS and SUPPORTS_TYPED_TESTS: -+ self.assert_(golden == output) -+ else: -+ self.assert_(RemoveTestCounts(self.RemoveUnsupportedTests(golden)) == -+ RemoveTestCounts(output)) - - - if __name__ == '__main__': - if sys.argv[1:] == [GENGOLDEN_FLAG]: -- output = GetOutputOfAllCommands() -- golden_file = open(GOLDEN_PATH, 'wb') -- golden_file.write(output) -- golden_file.close() -+ if SUPPORTS_DEATH_TESTS and SUPPORTS_TYPED_TESTS: -+ output = GetOutputOfAllCommands() -+ golden_file = open(GOLDEN_PATH, 'wb') -+ golden_file.write(output) -+ golden_file.close() -+ else: -+ print >> sys.stderr, ('Unable to write a golden file when compiled in an ' -+ 'environment that does not support death tests and ' -+ 'typed tests. Are you using VC 7.1?') -+ sys.exit(1) - else: - gtest_test_utils.Main() -Only in gtest-1.3.0/test: gtest_output_test.py.orig -Only in gtest-1.3.0/test: gtest_output_test.py.rej -diff -urP gtest-1.3.0/test/gtest_test_utils.py gtest-svn/test/gtest_test_utils.py ---- gtest-1.3.0/test/gtest_test_utils.py 2009-03-18 17:41:05.000000000 -0400 -+++ gtest-svn/test/gtest_test_utils.py 2009-06-01 15:11:13.243226284 -0400 -@@ -44,10 +44,10 @@ - import popen2 - _SUBPROCESS_MODULE_AVAILABLE = False - -+IS_WINDOWS = os.name == 'nt' - --# Initially maps a flag to its default value. After --# _ParseAndStripGTestFlags() is called, maps a flag to its actual --# value. -+# Initially maps a flag to its default value. After -+# _ParseAndStripGTestFlags() is called, maps a flag to its actual value. - _flag_map = {'gtest_source_dir': os.path.dirname(sys.argv[0]), - 'gtest_build_dir': os.path.dirname(sys.argv[0])} - _gtest_flags_are_parsed = False -@@ -103,6 +103,38 @@ - return os.path.abspath(GetFlag('gtest_build_dir')) - - -+def GetTestExecutablePath(executable_name): -+ """Returns the absolute path of the test binary given its name. -+ -+ The function will print a message and abort the program if the resulting file -+ doesn't exist. -+ -+ Args: -+ executable_name: name of the test binary that the test script runs. -+ -+ Returns: -+ The absolute path of the test binary. -+ """ -+ -+ path = os.path.abspath(os.path.join(GetBuildDir(), executable_name)) -+ if IS_WINDOWS and not path.endswith('.exe'): -+ path += '.exe' -+ -+ 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 --gtest_build_dir flag or the GTEST_BUILD_DIR\n' -+ 'environment variable. For convenient use, invoke this script via\n' -+ 'mk_test.py.\n' -+ # TODO(vladl@google.com): change mk_test.py to test.py after renaming -+ # the file. -+ 'Please run mk_test.py -h for help.') -+ print >> sys.stderr, message -+ sys.exit(1) -+ -+ return path -+ -+ - def GetExitStatus(exit_code): - """Returns the argument to exit(), or -1 if exit() wasn't called. - -diff -urP gtest-1.3.0/test/gtest_throw_on_failure_test.py gtest-svn/test/gtest_throw_on_failure_test.py ---- gtest-1.3.0/test/gtest_throw_on_failure_test.py 2009-06-01 15:13:04.590976387 -0400 -+++ gtest-svn/test/gtest_throw_on_failure_test.py 2009-06-01 15:11:13.245226329 -0400 -@@ -49,8 +49,8 @@ - - # Path to the gtest_throw_on_failure_test_ program, compiled with - # exceptions disabled. --EXE_PATH = os.path.join(gtest_test_utils.GetBuildDir(), -- 'gtest_throw_on_failure_test_') -+EXE_PATH = gtest_test_utils.GetTestExecutablePath( -+ 'gtest_throw_on_failure_test_') - - - # Utilities. -diff -urP gtest-1.3.0/test/gtest_uninitialized_test.py gtest-svn/test/gtest_uninitialized_test.py ---- gtest-1.3.0/test/gtest_uninitialized_test.py 2009-03-18 17:41:04.000000000 -0400 -+++ gtest-svn/test/gtest_uninitialized_test.py 2009-06-01 15:11:13.235227570 -0400 -@@ -34,25 +34,11 @@ - __author__ = 'wan@google.com (Zhanyong Wan)' - - import gtest_test_utils --import os - import sys - import unittest - --IS_WINDOWS = os.name == 'nt' --IS_LINUX = os.name == 'posix' - --if IS_WINDOWS: -- BUILD_DIRS = [ -- 'build.dbg\\', -- 'build.opt\\', -- 'build.dbg8\\', -- 'build.opt8\\', -- ] -- COMMAND = 'gtest_uninitialized_test_.exe' -- --if IS_LINUX: -- COMMAND = os.path.join(gtest_test_utils.GetBuildDir(), -- 'gtest_uninitialized_test_') -+COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_uninitialized_test_') - - - def Assert(condition): -@@ -77,25 +63,10 @@ - Assert('InitGoogleTest' in p.output) - - --if IS_WINDOWS: -+class GTestUninitializedTest(unittest.TestCase): -+ def testExitCodeAndOutput(self): -+ TestExitCodeAndOutput(COMMAND) - -- def main(): -- for build_dir in BUILD_DIRS: -- command = build_dir + COMMAND -- print 'Testing with %s . . .' % (command,) -- TestExitCodeAndOutput(command) -- return 0 - -- if __name__ == '__main__': -- main() -- -- --if IS_LINUX: -- -- class GTestUninitializedTest(unittest.TestCase): -- def testExitCodeAndOutput(self): -- TestExitCodeAndOutput(COMMAND) -- -- -- if __name__ == '__main__': -- gtest_test_utils.Main() -+if __name__ == '__main__': -+ gtest_test_utils.Main() -diff -urP gtest-1.3.0/test/gtest_xml_outfiles_test.py gtest-svn/test/gtest_xml_outfiles_test.py ---- gtest-1.3.0/test/gtest_xml_outfiles_test.py 2009-06-01 15:13:04.595225881 -0400 -+++ gtest-svn/test/gtest_xml_outfiles_test.py 2009-06-01 15:11:13.246225758 -0400 -@@ -98,8 +98,7 @@ - self._TestOutFile(GTEST_OUTPUT_2_TEST, EXPECTED_XML_2) - - def _TestOutFile(self, test_name, expected_xml): -- gtest_prog_path = os.path.join(gtest_test_utils.GetBuildDir(), -- test_name) -+ gtest_prog_path = gtest_test_utils.GetTestExecutablePath(test_name) - command = [gtest_prog_path, "--gtest_output=xml:%s" % self.output_dir_] - p = gtest_test_utils.Subprocess(command, working_dir=tempfile.mkdtemp()) - self.assert_(p.exited) -diff -urP gtest-1.3.0/test/gtest_xml_output_unittest.py gtest-svn/test/gtest_xml_output_unittest.py ---- gtest-1.3.0/test/gtest_xml_output_unittest.py 2009-06-01 15:13:04.595225881 -0400 -+++ gtest-svn/test/gtest_xml_output_unittest.py 2009-06-01 15:11:13.239225984 -0400 -@@ -121,10 +121,9 @@ - default name if no name is explicitly specified. - """ - temp_dir = tempfile.mkdtemp() -- output_file = os.path.join(temp_dir, -- GTEST_DEFAULT_OUTPUT_FILE) -- gtest_prog_path = os.path.join(gtest_test_utils.GetBuildDir(), -- "gtest_no_test_unittest") -+ output_file = os.path.join(temp_dir, GTEST_DEFAULT_OUTPUT_FILE) -+ gtest_prog_path = gtest_test_utils.GetTestExecutablePath( -+ "gtest_no_test_unittest") - try: - os.remove(output_file) - except OSError, e: -@@ -148,8 +147,7 @@ - """ - - xml_path = os.path.join(tempfile.mkdtemp(), gtest_prog_name + "out.xml") -- gtest_prog_path = os.path.join(gtest_test_utils.GetBuildDir(), -- gtest_prog_name) -+ gtest_prog_path = gtest_test_utils.GetTestExecutablePath(gtest_prog_name) - - command = [gtest_prog_path, "%s=xml:%s" % (GTEST_OUTPUT_FLAG, xml_path)] - p = gtest_test_utils.Subprocess(command) -diff -urP gtest-1.3.0/test/gtest_xml_test_utils.py gtest-svn/test/gtest_xml_test_utils.py ---- gtest-1.3.0/test/gtest_xml_test_utils.py 2009-06-01 15:13:04.596225868 -0400 -+++ gtest-svn/test/gtest_xml_test_utils.py 2009-06-01 15:11:13.238237101 -0400 -@@ -150,7 +150,7 @@ - for child in element.childNodes: - if child.nodeType == Node.CDATA_SECTION_NODE: - # Removes the source line number. -- cdata = re.sub(r"^.*/(.*:)\d+\n", "\\1*\n", child.nodeValue) -+ cdata = re.sub(r"^.*[/\\](.*:)\d+\n", "\\1*\n", child.nodeValue) - # Removes the actual stack trace. - child.nodeValue = re.sub(r"\nStack trace:\n(.|\n)*", - "", cdata) diff --git a/gtest.spec b/gtest.spec index 57d2c8e..41f70bb 100644 --- a/gtest.spec +++ b/gtest.spec @@ -1,14 +1,11 @@ Summary: Google C++ testing framework Name: gtest -Version: 1.3.0 -Release: 2.20090601svn257%{?dist} +Version: 1.4.0 +Release: 1%{?dist} License: BSD Group: Development/Tools URL: http://code.google.com/p/googletest/ Source0: http://googletest.googlecode.com/files/%{name}-%{version}.tar.bz2 -# Update to latest available SVN as of 20090601 -# Chromium needs at least 243. -Patch0: gtest-svnr257.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -33,7 +30,6 @@ This package contains development files for %{name}. %prep %setup -q -%patch0 -p1 # Keep a clean copy of samples. cp -pr ./samples ./samples.orig @@ -48,7 +44,7 @@ make %{?_smp_mflags} %check # Two tests fail here, unclear as to why. -make check ||: +make check # Restore the clean copy of samples. # To be later listed against %doc. @@ -93,11 +89,37 @@ rm -rf $RPM_BUILD_ROOT %{_includedir}/%{name}/internal %changelog -* Fri Jul 24 2009 Fedora Release Engineering - 1.3.0-2.20090601svn257 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Mon Jun 1 2009 Tom "spot" Callaway - 1.3.0-1 -- update to 1.3.0 +* Sat Nov 14 2009 Debarshi Ray - 1.4.0-1 +- Version bump to 1.4.0. + * New feature: the event listener API. + * New feature: test shuffling. + * New feature: the XML report format is closer to junitreport and can + be parsed by Hudson now. + * New feature: elapsed time for the tests is printed by default. + * New feature: comes with a TR1 tuple implementation such that Boost + is no longer needed for Combine(). + * New feature: EXPECT_DEATH_IF_SUPPORTED macro and friends. + * New feature: the Xcode project can now produce static gtest libraries in + addition to a framework. + * Compatibility fixes for gcc and minGW. + * Bug fixes and implementation clean-ups. + +* Fri Jul 24 2009 Release Engineering - 1.3.0-2.20090601svn257 +- Autorebuild for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Jun 01 2009 Tom "spot" Callaway - 1.3.0-1 +- Version bump to 1.3.0. + * New feature: ability to use Google Test assertions in other testing + frameworks. + * New feature: ability to run disabled test via + --gtest_also_run_disabled_tests. + * New feature: the --help flag for printing the usage. + * New feature: access to Google Test flag values in user code. + * New feature: a script that packs Google Test into one .h and one .cc file + for easy deployment. + * New feature: support for distributing test functions to multiple machines + (requires support from the test runner). + * Bug fixes and implementation clean-ups. * Tue Feb 24 2009 Fedora Release Engineering - 1.0.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild diff --git a/sources b/sources index a956203..789cd36 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -ec378387648dbfff9057134347ed6fe2 gtest-1.3.0.tar.bz2 +c91de493522cf1b75902d3b3730ff8de gtest-1.4.0.tar.bz2