changes to googletest break on failure and googletest filter unittests
This commit is contained in:
		@@ -227,35 +227,39 @@ py_test(
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cc_binary(
 | 
					cc_binary(
 | 
				
			||||||
    name = "gtest_filter_unittest_",
 | 
					    name = "googletest-filter-unittest_",
 | 
				
			||||||
    testonly = 1,
 | 
					    testonly = 1,
 | 
				
			||||||
    srcs = ["gtest_filter_unittest_.cc"],
 | 
					    srcs = ["googletest-filter-unittest_.cc"],
 | 
				
			||||||
    deps = ["//:gtest"],
 | 
					    deps = ["//:gtest"],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
py_test(
 | 
					py_test(
 | 
				
			||||||
    name = "gtest_filter_unittest",
 | 
					    name = "googletest-filter-unittest",
 | 
				
			||||||
    size = "small",
 | 
					    size = "medium",
 | 
				
			||||||
    srcs = ["gtest_filter_unittest.py"],
 | 
					    srcs = ["googletest-filter-unittest.py"],
 | 
				
			||||||
    data = [":gtest_filter_unittest_"],
 | 
					    data = [":googletest-filter-unittest_"],
 | 
				
			||||||
    deps = [":gtest_test_utils"],
 | 
					    deps = [":gtest_test_utils"],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cc_binary(
 | 
					cc_binary(
 | 
				
			||||||
    name = "gtest_break_on_failure_unittest_",
 | 
					    name = "googletest-break-on-failure-unittest_",
 | 
				
			||||||
    testonly = 1,
 | 
					    testonly = 1,
 | 
				
			||||||
    srcs = ["gtest_break_on_failure_unittest_.cc"],
 | 
					    srcs = ["googletest-break-on-failure-unittest_.cc"],
 | 
				
			||||||
    deps = ["//:gtest"],
 | 
					    deps = ["//:gtest"],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
py_test(
 | 
					py_test(
 | 
				
			||||||
    name = "gtest_break_on_failure_unittest",
 | 
					    name = "googletest-break-on-failure-unittest",
 | 
				
			||||||
    size = "small",
 | 
					    size = "small",
 | 
				
			||||||
    srcs = ["gtest_break_on_failure_unittest.py"],
 | 
					    srcs = ["googletest-break-on-failure-unittest.py"],
 | 
				
			||||||
    data = [":gtest_break_on_failure_unittest_"],
 | 
					    data = [":googletest-break-on-failure-unittest_"],
 | 
				
			||||||
    deps = [":gtest_test_utils"],
 | 
					    deps = [":gtest_test_utils"],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cc_test(
 | 
					cc_test(
 | 
				
			||||||
    name = "gtest_assert_by_exception_test",
 | 
					    name = "gtest_assert_by_exception_test",
 | 
				
			||||||
    size = "small",
 | 
					    size = "small",
 | 
				
			||||||
@@ -263,21 +267,24 @@ cc_test(
 | 
				
			|||||||
    deps = ["//:gtest"],
 | 
					    deps = ["//:gtest"],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cc_binary(
 | 
					cc_binary(
 | 
				
			||||||
    name = "gtest_throw_on_failure_test_",
 | 
					    name = "googletest-throw-on-failure-test_",
 | 
				
			||||||
    testonly = 1,
 | 
					    testonly = 1,
 | 
				
			||||||
    srcs = ["gtest_throw_on_failure_test_.cc"],
 | 
					    srcs = ["googletest-throw-on-failure-test_.cc"],
 | 
				
			||||||
    deps = ["//:gtest"],
 | 
					    deps = ["//:gtest"],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
py_test(
 | 
					py_test(
 | 
				
			||||||
    name = "gtest_throw_on_failure_test",
 | 
					    name = "googletest-throw-on-failure-test",
 | 
				
			||||||
    size = "small",
 | 
					    size = "small",
 | 
				
			||||||
    srcs = ["gtest_throw_on_failure_test.py"],
 | 
					    srcs = ["googletest-throw-on-failure-test.py"],
 | 
				
			||||||
    data = [":gtest_throw_on_failure_test_"],
 | 
					    data = [":googletest-throw-on-failure-test_"],
 | 
				
			||||||
    deps = [":gtest_test_utils"],
 | 
					    deps = [":gtest_test_utils"],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cc_binary(
 | 
					cc_binary(
 | 
				
			||||||
    name = "gtest_list_tests_unittest_",
 | 
					    name = "gtest_list_tests_unittest_",
 | 
				
			||||||
    testonly = 1,
 | 
					    testonly = 1,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,7 @@
 | 
				
			|||||||
A user can ask Google Test to seg-fault when an assertion fails, using
 | 
					A user can ask Google Test to seg-fault when an assertion fails, using
 | 
				
			||||||
either the GTEST_BREAK_ON_FAILURE environment variable or the
 | 
					either the GTEST_BREAK_ON_FAILURE environment variable or the
 | 
				
			||||||
--gtest_break_on_failure flag.  This script tests such functionality
 | 
					--gtest_break_on_failure flag.  This script tests such functionality
 | 
				
			||||||
by invoking gtest_break_on_failure_unittest_ (a program written with
 | 
					by invoking googletest-break-on-failure-unittest_ (a program written with
 | 
				
			||||||
Google Test) with different environments and command line flags.
 | 
					Google Test) with different environments and command line flags.
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -59,9 +59,9 @@ THROW_ON_FAILURE_ENV_VAR = 'GTEST_THROW_ON_FAILURE'
 | 
				
			|||||||
# The environment variable for enabling/disabling the catch-exceptions mode.
 | 
					# The environment variable for enabling/disabling the catch-exceptions mode.
 | 
				
			||||||
CATCH_EXCEPTIONS_ENV_VAR = 'GTEST_CATCH_EXCEPTIONS'
 | 
					CATCH_EXCEPTIONS_ENV_VAR = 'GTEST_CATCH_EXCEPTIONS'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Path to the gtest_break_on_failure_unittest_ program.
 | 
					# Path to the googletest-break-on-failure-unittest_ program.
 | 
				
			||||||
EXE_PATH = gtest_test_utils.GetTestExecutablePath(
 | 
					EXE_PATH = gtest_test_utils.GetTestExecutablePath(
 | 
				
			||||||
    'gtest_break_on_failure_unittest_')
 | 
					    'googletest-break-on-failure-unittest_')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
environ = gtest_test_utils.environ
 | 
					environ = gtest_test_utils.environ
 | 
				
			||||||
@@ -95,7 +95,7 @@ class GTestBreakOnFailureUnitTest(gtest_test_utils.TestCase):
 | 
				
			|||||||
  """
 | 
					  """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def RunAndVerify(self, env_var_value, flag_value, expect_seg_fault):
 | 
					  def RunAndVerify(self, env_var_value, flag_value, expect_seg_fault):
 | 
				
			||||||
    """Runs gtest_break_on_failure_unittest_ and verifies that it does
 | 
					    """Runs googletest-break-on-failure-unittest_ and verifies that it does
 | 
				
			||||||
    (or does not) have a seg-fault.
 | 
					    (or does not) have a seg-fault.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Args:
 | 
					    Args:
 | 
				
			||||||
@@ -33,7 +33,7 @@
 | 
				
			|||||||
A user can specify which test(s) in a Google Test program to run via either
 | 
					A user can specify which test(s) in a Google Test program to run via either
 | 
				
			||||||
the GTEST_FILTER environment variable or the --gtest_filter flag.
 | 
					the GTEST_FILTER environment variable or the --gtest_filter flag.
 | 
				
			||||||
This script tests such functionality by invoking
 | 
					This script tests such functionality by invoking
 | 
				
			||||||
gtest_filter_unittest_ (a program written with Google Test) with different
 | 
					googletest-filter-unittest_ (a program written with Google Test) with different
 | 
				
			||||||
environments and command line flags.
 | 
					environments and command line flags.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Note that test sharding may also influence which tests are filtered. Therefore,
 | 
					Note that test sharding may also influence which tests are filtered. Therefore,
 | 
				
			||||||
@@ -100,8 +100,8 @@ FILTER_FLAG = 'gtest_filter'
 | 
				
			|||||||
# The command line flag for including disabled tests.
 | 
					# The command line flag for including disabled tests.
 | 
				
			||||||
ALSO_RUN_DISABLED_TESTS_FLAG = 'gtest_also_run_disabled_tests'
 | 
					ALSO_RUN_DISABLED_TESTS_FLAG = 'gtest_also_run_disabled_tests'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Command to run the gtest_filter_unittest_ program.
 | 
					# Command to run the googletest-filter-unittest_ program.
 | 
				
			||||||
COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_filter_unittest_')
 | 
					COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-filter-unittest_')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Regex for determining whether parameterized tests are enabled in the binary.
 | 
					# Regex for determining whether parameterized tests are enabled in the binary.
 | 
				
			||||||
PARAM_TEST_REGEX = re.compile(r'/ParamTest')
 | 
					PARAM_TEST_REGEX = re.compile(r'/ParamTest')
 | 
				
			||||||
@@ -120,7 +120,7 @@ LIST_TESTS_FLAG = '--gtest_list_tests'
 | 
				
			|||||||
SUPPORTS_DEATH_TESTS = 'HasDeathTest' in gtest_test_utils.Subprocess(
 | 
					SUPPORTS_DEATH_TESTS = 'HasDeathTest' in gtest_test_utils.Subprocess(
 | 
				
			||||||
    [COMMAND, LIST_TESTS_FLAG]).output
 | 
					    [COMMAND, LIST_TESTS_FLAG]).output
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Full names of all tests in gtest_filter_unittests_.
 | 
					# Full names of all tests in googletest-filter-unittests_.
 | 
				
			||||||
PARAM_TESTS = [
 | 
					PARAM_TESTS = [
 | 
				
			||||||
    'SeqP/ParamTest.TestX/0',
 | 
					    'SeqP/ParamTest.TestX/0',
 | 
				
			||||||
    'SeqP/ParamTest.TestX/1',
 | 
					    'SeqP/ParamTest.TestX/1',
 | 
				
			||||||
@@ -292,7 +292,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
 | 
				
			|||||||
                               args=None, check_exit_0=False):
 | 
					                               args=None, check_exit_0=False):
 | 
				
			||||||
    """Checks that binary runs correct tests for the given filter and shard.
 | 
					    """Checks that binary runs correct tests for the given filter and shard.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Runs all shards of gtest_filter_unittest_ with the given filter, and
 | 
					    Runs all shards of googletest-filter-unittest_ with the given filter, and
 | 
				
			||||||
    verifies that the right set of tests were run. The union of tests run
 | 
					    verifies that the right set of tests were run. The union of tests run
 | 
				
			||||||
    on each shard should be identical to tests_to_run, without duplicates.
 | 
					    on each shard should be identical to tests_to_run, without duplicates.
 | 
				
			||||||
    If check_exit_0, .
 | 
					    If check_exit_0, .
 | 
				
			||||||
@@ -330,7 +330,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
 | 
				
			|||||||
  def RunAndVerifyAllowingDisabled(self, gtest_filter, tests_to_run):
 | 
					  def RunAndVerifyAllowingDisabled(self, gtest_filter, tests_to_run):
 | 
				
			||||||
    """Checks that the binary runs correct set of tests for the given filter.
 | 
					    """Checks that the binary runs correct set of tests for the given filter.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Runs gtest_filter_unittest_ with the given filter, and enables
 | 
					    Runs googletest-filter-unittest_ with the given filter, and enables
 | 
				
			||||||
    disabled tests. Verifies that the right set of tests were run.
 | 
					    disabled tests. Verifies that the right set of tests were run.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Args:
 | 
					    Args:
 | 
				
			||||||
@@ -31,7 +31,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
"""Tests Google Test's throw-on-failure mode with exceptions disabled.
 | 
					"""Tests Google Test's throw-on-failure mode with exceptions disabled.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This script invokes gtest_throw_on_failure_test_ (a program written with
 | 
					This script invokes googletest-throw-on-failure-test_ (a program written with
 | 
				
			||||||
Google Test) with different environments and command line flags.
 | 
					Google Test) with different environments and command line flags.
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -46,10 +46,10 @@ import gtest_test_utils
 | 
				
			|||||||
# The command line flag for enabling/disabling the throw-on-failure mode.
 | 
					# The command line flag for enabling/disabling the throw-on-failure mode.
 | 
				
			||||||
THROW_ON_FAILURE = 'gtest_throw_on_failure'
 | 
					THROW_ON_FAILURE = 'gtest_throw_on_failure'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Path to the gtest_throw_on_failure_test_ program, compiled with
 | 
					# Path to the googletest-throw-on-failure-test_ program, compiled with
 | 
				
			||||||
# exceptions disabled.
 | 
					# exceptions disabled.
 | 
				
			||||||
EXE_PATH = gtest_test_utils.GetTestExecutablePath(
 | 
					EXE_PATH = gtest_test_utils.GetTestExecutablePath(
 | 
				
			||||||
    'gtest_throw_on_failure_test_')
 | 
					    'googletest-throw-on-failure-test_')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Utilities.
 | 
					# Utilities.
 | 
				
			||||||
@@ -81,7 +81,7 @@ class ThrowOnFailureTest(gtest_test_utils.TestCase):
 | 
				
			|||||||
  """Tests the throw-on-failure mode."""
 | 
					  """Tests the throw-on-failure mode."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def RunAndVerify(self, env_var_value, flag_value, should_fail):
 | 
					  def RunAndVerify(self, env_var_value, flag_value, should_fail):
 | 
				
			||||||
    """Runs gtest_throw_on_failure_test_ and verifies that it does
 | 
					    """Runs googletest-throw-on-failure-test_ and verifies that it does
 | 
				
			||||||
    (or does not) exit with a non-zero code.
 | 
					    (or does not) exit with a non-zero code.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Args:
 | 
					    Args:
 | 
				
			||||||
@@ -32,7 +32,7 @@
 | 
				
			|||||||
// Tests Google Test's throw-on-failure mode with exceptions disabled.
 | 
					// Tests Google Test's throw-on-failure mode with exceptions disabled.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// This program must be compiled with exceptions disabled.  It will be
 | 
					// This program must be compiled with exceptions disabled.  It will be
 | 
				
			||||||
// invoked by gtest_throw_on_failure_test.py, and is expected to exit
 | 
					// invoked by googletest-throw-on-failure-test.py, and is expected to exit
 | 
				
			||||||
// with non-zero in the throw-on-failure mode or 0 otherwise.
 | 
					// with non-zero in the throw-on-failure mode or 0 otherwise.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "gtest/gtest.h"
 | 
					#include "gtest/gtest.h"
 | 
				
			||||||
		Reference in New Issue
	
	Block a user