Unverified Commit e887b03e authored by Gennadiy Civil's avatar Gennadiy Civil Committed by GitHub
Browse files

Merge pull request #1696 from gennadiycivil/master

Code transforms changes, renames. 
parents e5e2ef7c 2a7077fa
...@@ -86,7 +86,7 @@ include_directories( ...@@ -86,7 +86,7 @@ include_directories(
if (MSVC AND MSVC_VERSION EQUAL 1700) if (MSVC AND MSVC_VERSION EQUAL 1700)
add_definitions(/D _VARIADIC_MAX=10) add_definitions(/D _VARIADIC_MAX=10)
endif() endif()
######################################################################## ########################################################################
# #
# Defines the gtest & gtest_main libraries. User tests should link # Defines the gtest & gtest_main libraries. User tests should link
...@@ -171,28 +171,28 @@ if (gtest_build_tests) ...@@ -171,28 +171,28 @@ if (gtest_build_tests)
############################################################ ############################################################
# C++ tests built with standard compiler flags. # C++ tests built with standard compiler flags.
cxx_test(gtest-death-test_test gtest_main) cxx_test(googletest-death-test-test gtest_main)
cxx_test(gtest_environment_test gtest) cxx_test(gtest_environment_test gtest)
cxx_test(gtest-filepath_test gtest_main) cxx_test(googletest-filepath-test gtest_main)
cxx_test(gtest-linked_ptr_test gtest_main) cxx_test(googletest-linked-ptr-test gtest_main)
cxx_test(gtest-listener_test gtest_main) cxx_test(googletest-listener-test gtest_main)
cxx_test(gtest_main_unittest gtest_main) cxx_test(gtest_main_unittest gtest_main)
cxx_test(gtest-message_test gtest_main) cxx_test(googletest-message-test gtest_main)
cxx_test(gtest_no_test_unittest gtest) cxx_test(gtest_no_test_unittest gtest)
cxx_test(gtest-options_test gtest_main) cxx_test(googletest-options-test gtest_main)
cxx_test(gtest-param-test_test gtest cxx_test(googletest-param-test-test gtest
test/gtest-param-test2_test.cc) test/googletest-param-test2-test.cc)
cxx_test(gtest-port_test gtest_main) cxx_test(googletest-port-test gtest_main)
cxx_test(gtest_pred_impl_unittest gtest_main) cxx_test(gtest_pred_impl_unittest gtest_main)
cxx_test(gtest_premature_exit_test gtest cxx_test(gtest_premature_exit_test gtest
test/gtest_premature_exit_test.cc) test/gtest_premature_exit_test.cc)
cxx_test(gtest-printers_test gtest_main) cxx_test(googletest-printers-test gtest_main)
cxx_test(gtest_prod_test gtest_main cxx_test(gtest_prod_test gtest_main
test/production.cc) test/production.cc)
cxx_test(gtest_repeat_test gtest) cxx_test(gtest_repeat_test gtest)
cxx_test(gtest_sole_header_test gtest_main) cxx_test(gtest_sole_header_test gtest_main)
cxx_test(gtest_stress_test gtest) cxx_test(gtest_stress_test gtest)
cxx_test(gtest-test-part_test gtest_main) cxx_test(googletest-test-part-test gtest_main)
cxx_test(gtest_throw_on_failure_ex_test gtest) cxx_test(gtest_throw_on_failure_ex_test gtest)
cxx_test(gtest-typed-test_test gtest_main cxx_test(gtest-typed-test_test gtest_main
test/gtest-typed-test2_test.cc) test/gtest-typed-test2_test.cc)
...@@ -214,10 +214,10 @@ if (gtest_build_tests) ...@@ -214,10 +214,10 @@ if (gtest_build_tests)
cxx_test_with_flags(gtest-death-test_ex_nocatch_test cxx_test_with_flags(gtest-death-test_ex_nocatch_test
"${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=0" "${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=0"
gtest test/gtest-death-test_ex_test.cc) gtest test/googletest-death-test_ex_test.cc)
cxx_test_with_flags(gtest-death-test_ex_catch_test cxx_test_with_flags(gtest-death-test_ex_catch_test
"${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=1" "${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"
gtest test/gtest-death-test_ex_test.cc) gtest test/googletest-death-test_ex_test.cc)
cxx_test_with_flags(gtest_no_rtti_unittest "${cxx_no_rtti}" cxx_test_with_flags(gtest_no_rtti_unittest "${cxx_no_rtti}"
gtest_main_no_rtti test/gtest_unittest.cc) gtest_main_no_rtti test/gtest_unittest.cc)
...@@ -238,75 +238,75 @@ if (gtest_build_tests) ...@@ -238,75 +238,75 @@ if (gtest_build_tests)
cxx_library(gtest_main_use_own_tuple "${cxx_use_own_tuple}" cxx_library(gtest_main_use_own_tuple "${cxx_use_own_tuple}"
src/gtest-all.cc src/gtest_main.cc) src/gtest-all.cc src/gtest_main.cc)
cxx_test_with_flags(gtest-tuple_test "${cxx_use_own_tuple}" cxx_test_with_flags(googletest-tuple-test "${cxx_use_own_tuple}"
gtest_main_use_own_tuple test/gtest-tuple_test.cc) gtest_main_use_own_tuple test/googletest-tuple-test.cc)
cxx_test_with_flags(gtest_use_own_tuple_test "${cxx_use_own_tuple}" cxx_test_with_flags(gtest_use_own_tuple_test "${cxx_use_own_tuple}"
gtest_main_use_own_tuple gtest_main_use_own_tuple
test/gtest-param-test_test.cc test/gtest-param-test2_test.cc) test/googletest-param-test-test.cc test/googletest-param-test2-test.cc)
endif() endif()
############################################################ ############################################################
# Python tests. # Python tests.
cxx_executable(gtest_break_on_failure_unittest_ test gtest) cxx_executable(googletest-break-on-failure-unittest_ test gtest)
py_test(gtest_break_on_failure_unittest) py_test(googletest-break-on-failure-unittest)
# Visual Studio .NET 2003 does not support STL with exceptions disabled. # Visual Studio .NET 2003 does not support STL with exceptions disabled.
if (NOT MSVC OR MSVC_VERSION GREATER 1310) # 1310 is Visual Studio .NET 2003 if (NOT MSVC OR MSVC_VERSION GREATER 1310) # 1310 is Visual Studio .NET 2003
cxx_executable_with_flags( cxx_executable_with_flags(
gtest_catch_exceptions_no_ex_test_ googletest-catch-exceptions-no-ex-test_
"${cxx_no_exception}" "${cxx_no_exception}"
gtest_main_no_exception gtest_main_no_exception
test/gtest_catch_exceptions_test_.cc) test/googletest-catch-exceptions-test_.cc)
endif() endif()
cxx_executable_with_flags( cxx_executable_with_flags(
gtest_catch_exceptions_ex_test_ googletest-catch-exceptions-ex-test_
"${cxx_exception}" "${cxx_exception}"
gtest_main gtest_main
test/gtest_catch_exceptions_test_.cc) test/googletest-catch-exceptions-test_.cc)
py_test(gtest_catch_exceptions_test) py_test(googletest-catch-exceptions-test)
cxx_executable(gtest_color_test_ test gtest) cxx_executable(googletest-color-test_ test gtest)
py_test(gtest_color_test) py_test(googletest-color-test)
cxx_executable(gtest_env_var_test_ test gtest) cxx_executable(googletest-env-var-test_ test gtest)
py_test(gtest_env_var_test) py_test(googletest-env-var-test)
cxx_executable(gtest_filter_unittest_ test gtest) cxx_executable(googletest-filter-unittest_ test gtest)
py_test(gtest_filter_unittest) py_test(googletest-filter-unittest)
cxx_executable(gtest_help_test_ test gtest_main) cxx_executable(gtest_help_test_ test gtest_main)
py_test(gtest_help_test) py_test(gtest_help_test)
cxx_executable(gtest_list_tests_unittest_ test gtest) cxx_executable(googletest-list-tests-unittest_ test gtest)
py_test(gtest_list_tests_unittest) py_test(googletest-list-tests-unittest)
cxx_executable(gtest_output_test_ test gtest) cxx_executable(googletest-output-test_ test gtest)
py_test(gtest_output_test --no_stacktrace_support) py_test(googletest-output-test --no_stacktrace_support)
cxx_executable(gtest_shuffle_test_ test gtest) cxx_executable(googletest-shuffle-test_ test gtest)
py_test(gtest_shuffle_test) py_test(googletest-shuffle-test)
# MSVC 7.1 does not support STL with exceptions disabled. # MSVC 7.1 does not support STL with exceptions disabled.
if (NOT MSVC OR MSVC_VERSION GREATER 1310) if (NOT MSVC OR MSVC_VERSION GREATER 1310)
cxx_executable(gtest_throw_on_failure_test_ test gtest_no_exception) cxx_executable(googletest-throw-on-failure-test_ test gtest_no_exception)
set_target_properties(gtest_throw_on_failure_test_ set_target_properties(googletest-throw-on-failure-test_
PROPERTIES PROPERTIES
COMPILE_FLAGS "${cxx_no_exception}") COMPILE_FLAGS "${cxx_no_exception}")
py_test(gtest_throw_on_failure_test) py_test(googletest-throw-on-failure-test)
endif() endif()
cxx_executable(gtest_uninitialized_test_ test gtest) cxx_executable(googletest-uninitialized-test_ test gtest)
py_test(gtest_uninitialized_test) py_test(googletest-uninitialized-test)
cxx_executable(gtest_xml_outfile1_test_ test gtest_main) cxx_executable(gtest_xml_outfile1_test_ test gtest_main)
cxx_executable(gtest_xml_outfile2_test_ test gtest_main) cxx_executable(gtest_xml_outfile2_test_ test gtest_main)
py_test(gtest_xml_outfiles_test) py_test(gtest_xml_outfiles_test)
py_test(gtest_json_outfiles_test) py_test(googletest-json-outfiles-test)
cxx_executable(gtest_xml_output_unittest_ test gtest) cxx_executable(gtest_xml_output_unittest_ test gtest)
py_test(gtest_xml_output_unittest --no_stacktrace_support) py_test(gtest_xml_output_unittest --no_stacktrace_support)
py_test(gtest_json_output_unittest) py_test(googletest-json-output-unittest --no_stacktrace_support)
endif() endif()
...@@ -53,40 +53,40 @@ EXTRA_DIST += \ ...@@ -53,40 +53,40 @@ EXTRA_DIST += \
test/gtest-listener_test.cc \ test/gtest-listener_test.cc \
test/gtest-message_test.cc \ test/gtest-message_test.cc \
test/gtest-options_test.cc \ test/gtest-options_test.cc \
test/gtest-param-test2_test.cc \ test/googletest-param-test2-test.cc \
test/gtest-param-test2_test.cc \ test/googletest-param-test2-test.cc \
test/gtest-param-test_test.cc \ test/googletest-param-test-test.cc \
test/gtest-param-test_test.cc \ test/googletest-param-test-test.cc \
test/gtest-param-test_test.h \ test/gtest-param-test_test.h \
test/gtest-port_test.cc \ test/gtest-port_test.cc \
test/gtest_premature_exit_test.cc \ test/gtest_premature_exit_test.cc \
test/gtest-printers_test.cc \ test/gtest-printers_test.cc \
test/gtest-test-part_test.cc \ test/gtest-test-part_test.cc \
test/gtest-tuple_test.cc \ test/googletest-tuple-test.cc \
test/gtest-typed-test2_test.cc \ test/gtest-typed-test2_test.cc \
test/gtest-typed-test_test.cc \ test/gtest-typed-test_test.cc \
test/gtest-typed-test_test.h \ test/gtest-typed-test_test.h \
test/gtest-unittest-api_test.cc \ test/gtest-unittest-api_test.cc \
test/gtest_break_on_failure_unittest_.cc \ test/googletest-break-on-failure-unittest_.cc \
test/gtest_catch_exceptions_test_.cc \ test/googletest-catch-exceptions-test_.cc \
test/gtest_color_test_.cc \ test/googletest-color-test_.cc \
test/gtest_env_var_test_.cc \ test/googletest-env-var-test_.cc \
test/gtest_environment_test.cc \ test/gtest_environment_test.cc \
test/gtest_filter_unittest_.cc \ test/googletest-filter-unittest_.cc \
test/gtest_help_test_.cc \ test/gtest_help_test_.cc \
test/gtest_list_tests_unittest_.cc \ test/googletest-list-tests-unittest_.cc \
test/gtest_main_unittest.cc \ test/gtest_main_unittest.cc \
test/gtest_no_test_unittest.cc \ test/gtest_no_test_unittest.cc \
test/gtest_output_test_.cc \ test/googletest-output-test_.cc \
test/gtest_pred_impl_unittest.cc \ test/gtest_pred_impl_unittest.cc \
test/gtest_prod_test.cc \ test/gtest_prod_test.cc \
test/gtest_repeat_test.cc \ test/gtest_repeat_test.cc \
test/gtest_shuffle_test_.cc \ test/googletest-shuffle-test_.cc \
test/gtest_sole_header_test.cc \ test/gtest_sole_header_test.cc \
test/gtest_stress_test.cc \ test/gtest_stress_test.cc \
test/gtest_throw_on_failure_ex_test.cc \ test/gtest_throw_on_failure_ex_test.cc \
test/gtest_throw_on_failure_test_.cc \ test/googletest-throw-on-failure-test_.cc \
test/gtest_uninitialized_test_.cc \ test/googletest-uninitialized-test_.cc \
test/gtest_unittest.cc \ test/gtest_unittest.cc \
test/gtest_unittest.cc \ test/gtest_unittest.cc \
test/gtest_xml_outfile1_test_.cc \ test/gtest_xml_outfile1_test_.cc \
...@@ -97,19 +97,19 @@ EXTRA_DIST += \ ...@@ -97,19 +97,19 @@ EXTRA_DIST += \
# Python tests that we don't run. # Python tests that we don't run.
EXTRA_DIST += \ EXTRA_DIST += \
test/gtest_break_on_failure_unittest.py \ test/googletest-break-on-failure-unittest.py \
test/gtest_catch_exceptions_test.py \ test/googletest-catch-exceptions-test.py \
test/gtest_color_test.py \ test/googletest-color-test.py \
test/gtest_env_var_test.py \ test/googletest-env-var-test.py \
test/gtest_filter_unittest.py \ test/googletest-filter-unittest.py \
test/gtest_help_test.py \ test/gtest_help_test.py \
test/gtest_list_tests_unittest.py \ test/googletest-list-tests-unittest.py \
test/gtest_output_test.py \ test/googletest-output-test.py \
test/gtest_output_test_golden_lin.txt \ test/googletest-output-test_golden_lin.txt \
test/gtest_shuffle_test.py \ test/googletest-shuffle-test.py \
test/gtest_test_utils.py \ test/gtest_test_utils.py \
test/gtest_throw_on_failure_test.py \ test/googletest-throw-on-failure-test.py \
test/gtest_uninitialized_test.py \ test/googletest-uninitialized-test.py \
test/gtest_xml_outfiles_test.py \ test/gtest_xml_outfiles_test.py \
test/gtest_xml_output_unittest.py \ test/gtest_xml_output_unittest.py \
test/gtest_xml_test_utils.py test/gtest_xml_test_utils.py
......
...@@ -49,31 +49,48 @@ config_setting( ...@@ -49,31 +49,48 @@ config_setting(
values = {"define": "absl=1"}, values = {"define": "absl=1"},
) )
#on windows exclude gtest-tuple.h and gtest-tuple_test.cc #on windows exclude gtest-tuple.h and googletest-tuple-test.cc
cc_test( cc_test(
name = "gtest_all_test", name = "gtest_all_test",
size = "small", size = "small",
srcs = glob( srcs = glob(
include = [ include = [
"gtest-*.cc", "gtest-*.cc",
"googletest-*.cc",
"*.h", "*.h",
"googletest/include/gtest/**/*.h", "googletest/include/gtest/**/*.h",
], ],
exclude = [ exclude = [
"gtest-unittest-api_test.cc", "gtest-unittest-api_test.cc",
"gtest-tuple_test.cc", "googletest-tuple-test.cc",
"googletest/src/gtest-all.cc", "googletest/src/gtest-all.cc",
"gtest_all_test.cc", "gtest_all_test.cc",
"gtest-death-test_ex_test.cc", "gtest-death-test_ex_test.cc",
"gtest-listener_test.cc", "gtest-listener_test.cc",
"gtest-unittest-api_test.cc", "gtest-unittest-api_test.cc",
"gtest-param-test_test.cc", "googletest-param-test-test.cc",
"googletest-catch-exceptions-test_.cc",
"googletest-color-test_.cc",
"googletest-env-var-test_.cc",
"googletest-filter-unittest_.cc",
"googletest-break-on-failure-unittest_.cc",
"googletest-listener-test.cc",
"googletest-output-test_.cc",
"googletest-list-tests-unittest_.cc",
"googletest-shuffle-test_.cc",
"googletest-uninitialized-test_.cc",
"googletest-death-test_ex_test.cc",
"googletest-param-test-test",
"googletest-throw-on-failure-test_.cc",
"googletest-param-test-invalid-name1-test_.cc",
"googletest-param-test-invalid-name2-test_.cc",
], ],
) + select({ ) + select({
"//:windows": [], "//:windows": [],
"//:windows_msvc": [], "//:windows_msvc": [],
"//conditions:default": [ "//conditions:default": [
"gtest-tuple_test.cc", "googletest-tuple-test.cc",
], ],
}), }),
copts = select({ copts = select({
...@@ -98,6 +115,14 @@ cc_test( ...@@ -98,6 +115,14 @@ cc_test(
) )
# Tests death tests.
cc_test(
name = "googletest-death-test-test",
size = "medium",
srcs = ["googletest-death-test-test.cc"],
deps = ["//:gtest_main"],
)
cc_test( cc_test(
name = "gtest_test_macro_stack_footprint_test", name = "gtest_test_macro_stack_footprint_test",
size = "small", size = "small",
...@@ -107,14 +132,10 @@ cc_test( ...@@ -107,14 +132,10 @@ cc_test(
#These googletest tests have their own main() #These googletest tests have their own main()
cc_test( cc_test(
name = "gtest-listener_test", name = "googletest-listener-test",
size = "small", size = "small",
srcs = [ srcs = ["googletest-listener-test.cc"],
"gtest-listener_test.cc", deps = ["//:gtest_main"],
],
deps = [
"//:gtest",
],
) )
cc_test( cc_test(
...@@ -129,16 +150,14 @@ cc_test( ...@@ -129,16 +150,14 @@ cc_test(
) )
cc_test( cc_test(
name = "gtest-param-test_test", name = "googletest-param-test-test",
size = "small", size = "small",
srcs = [ srcs = [
"gtest-param-test2_test.cc", "googletest-param-test-test.cc",
"gtest-param-test_test.cc", "googletest-param-test-test.h",
"gtest-param-test_test.h", "googletest-param-test2-test.cc",
],
deps = [
"//:gtest",
], ],
deps = ["//:gtest"],
) )
cc_test( cc_test(
...@@ -174,87 +193,92 @@ py_test( ...@@ -174,87 +193,92 @@ py_test(
) )
cc_binary( cc_binary(
name = "gtest_output_test_", name = "googletest-output-test_",
testonly = 1, testonly = 1,
srcs = ["gtest_output_test_.cc"], srcs = ["googletest-output-test_.cc"],
deps = ["//:gtest"], deps = ["//:gtest"],
) )
py_test( py_test(
name = "gtest_output_test", name = "googletest-output-test",
size = "small", size = "small",
srcs = ["gtest_output_test.py"], srcs = ["googletest-output-test.py"],
args = select({ args = select({
":has_absl": [], ":has_absl": [],
"//conditions:default": ["--no_stacktrace_support"], "//conditions:default": ["--no_stacktrace_support"],
}), }),
data = [ data = [
"gtest_output_test_golden_lin.txt", "googletest-output-test-golden-lin.txt",
":gtest_output_test_", ":googletest-output-test_",
], ],
deps = [":gtest_test_utils"], deps = [":gtest_test_utils"],
) )
cc_binary( cc_binary(
name = "gtest_color_test_", name = "googletest-color-test_",
testonly = 1, testonly = 1,
srcs = ["gtest_color_test_.cc"], srcs = ["googletest-color-test_.cc"],
deps = ["//:gtest"], deps = ["//:gtest"],
) )
py_test( py_test(
name = "gtest_color_test", name = "googletest-color-test",
size = "small", size = "small",
srcs = ["gtest_color_test.py"], srcs = ["googletest-color-test.py"],
data = [":gtest_color_test_"], data = [":googletest-color-test_"],
deps = [":gtest_test_utils"], deps = [":gtest_test_utils"],
) )
cc_binary( cc_binary(
name = "gtest_env_var_test_", name = "googletest-env-var-test_",
testonly = 1, testonly = 1,
srcs = ["gtest_env_var_test_.cc"], srcs = ["googletest-env-var-test_.cc"],
deps = ["//:gtest"], deps = ["//:gtest"],
) )
py_test( py_test(
name = "gtest_env_var_test", name = "googletest-env-var-test",
size = "small", size = "medium",
srcs = ["gtest_env_var_test.py"], srcs = ["googletest-env-var-test.py"],
data = [":gtest_env_var_test_"], data = [":googletest-env-var-test_"],
deps = [":gtest_test_utils"], deps = [":gtest_test_utils"],
) )
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",
...@@ -262,72 +286,75 @@ cc_test( ...@@ -262,72 +286,75 @@ 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 = "googletest-list-tests-unittest_",
testonly = 1, testonly = 1,
srcs = ["gtest_list_tests_unittest_.cc"], srcs = ["googletest-list-tests-unittest_.cc"],
deps = ["//:gtest"], deps = ["//:gtest"],
) )
py_test( py_test(
name = "gtest_list_tests_unittest", name = "googletest-list-tests-unittest",
size = "small", size = "small",
srcs = ["gtest_list_tests_unittest.py"], srcs = ["googletest-list-tests-unittest.py"],
data = [":gtest_list_tests_unittest_"], data = [":googletest-list-tests-unittest_"],
deps = [":gtest_test_utils"], deps = [":gtest_test_utils"],
) )
cc_binary( cc_binary(
name = "gtest_shuffle_test_", name = "googletest-shuffle-test_",
srcs = ["gtest_shuffle_test_.cc"], srcs = ["googletest-shuffle-test_.cc"],
deps = ["//:gtest"], deps = ["//:gtest"],
) )
py_test( py_test(
name = "gtest_shuffle_test", name = "googletest-shuffle-test",
size = "small", size = "small",
srcs = ["gtest_shuffle_test.py"], srcs = ["googletest-shuffle-test.py"],
data = [":gtest_shuffle_test_"], data = [":googletest-shuffle-test_"],
deps = [":gtest_test_utils"], deps = [":gtest_test_utils"],
) )
cc_binary( cc_binary(
name = "gtest_catch_exceptions_no_ex_test_", name = "googletest-catch-exceptions-no-ex-test_",
testonly = 1, testonly = 1,
srcs = ["gtest_catch_exceptions_test_.cc"], srcs = ["googletest-catch-exceptions-test_.cc"],
deps = ["//:gtest_main"], deps = ["//:gtest_main"],
) )
cc_binary( cc_binary(
name = "gtest_catch_exceptions_ex_test_", name = "googletest-catch-exceptions-ex-test_",
testonly = 1, testonly = 1,
srcs = ["gtest_catch_exceptions_test_.cc"], srcs = ["googletest-catch-exceptions-test_.cc"],
copts = ["-fexceptions"], copts = ["-fexceptions"],
deps = ["//:gtest_main"], deps = ["//:gtest_main"],
) )
py_test( py_test(
name = "gtest_catch_exceptions_test", name = "googletest-catch-exceptions-test",
size = "small", size = "small",
srcs = ["gtest_catch_exceptions_test.py"], srcs = ["googletest-catch-exceptions-test.py"],
data = [ data = [
":gtest_catch_exceptions_ex_test_", ":googletest-catch-exceptions-ex-test_",
":gtest_catch_exceptions_no_ex_test_", ":googletest-catch-exceptions-no-ex-test_",
], ],
deps = [":gtest_test_utils"], deps = [":gtest_test_utils"],
) )
...@@ -395,17 +422,17 @@ py_test( ...@@ -395,17 +422,17 @@ py_test(
) )
cc_binary( cc_binary(
name = "gtest_uninitialized_test_", name = "googletest-uninitialized-test_",
testonly = 1, testonly = 1,
srcs = ["gtest_uninitialized_test_.cc"], srcs = ["googletest-uninitialized-test_.cc"],
deps = ["//:gtest"], deps = ["//:gtest"],
) )
py_test( py_test(
name = "gtest_uninitialized_test", name = "googletest-uninitialized-test",
size = "medium", size = "medium",
srcs = ["gtest_uninitialized_test.py"], srcs = ["googletest-uninitialized-test.py"],
data = [":gtest_uninitialized_test_"], data = ["googletest-uninitialized-test_"],
deps = [":gtest_test_utils"], deps = [":gtest_test_utils"],
) )
...@@ -424,3 +451,77 @@ py_test( ...@@ -424,3 +451,77 @@ py_test(
data = [":gtest_testbridge_test_"], data = [":gtest_testbridge_test_"],
deps = [":gtest_test_utils"], deps = [":gtest_test_utils"],
) )
py_test(
name = "googletest-json-outfiles-test",
size = "small",
srcs = [
"googletest-json-outfiles-test.py",
"gtest_json_test_utils.py",
],
data = [
":gtest_xml_outfile1_test_",
":gtest_xml_outfile2_test_",
],
deps = [":gtest_test_utils"],
)
py_test(
name = "googletest-json-output-unittest",
size = "medium",
srcs = [
"googletest-json-output-unittest.py",
"gtest_json_test_utils.py",
],
data = [
# We invoke gtest_no_test_unittest to verify the JSON output
# when the test program contains no test definition.
":gtest_no_test_unittest",
":gtest_xml_output_unittest_",
],
args = select({
":has_absl": [],
"//conditions:default": ["--no_stacktrace_support"],
}),
deps = [":gtest_test_utils"],
)
# Verifies interaction of death tests and exceptions.
cc_test(
name = "googletest-death-test_ex_catch_test",
size = "medium",
srcs = ["googletest-death-test_ex_test.cc"],
copts = ["-fexceptions"],
defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"],
deps = ["//:gtest"],
)
cc_binary(
name = "googletest-param-test-invalid-name1-test_",
testonly = 1,
srcs = ["googletest-param-test-invalid-name1-test_.cc"],
deps = ["//:gtest"],
)
cc_binary(
name = "googletest-param-test-invalid-name2-test_",
testonly = 1,
srcs = ["googletest-param-test-invalid-name2-test_.cc"],
deps = ["//:gtest"],
)
py_test(
name = "googletest-param-test-invalid-name1-test",
size = "small",
srcs = ["googletest-param-test-invalid-name1-test.py"],
data = [":googletest-param-test-invalid-name1-test_"],
deps = [":gtest_test_utils"],
)
py_test(
name = "googletest-param-test-invalid-name2-test",
size = "small",
srcs = ["googletest-param-test-invalid-name2-test.py"],
data = [":googletest-param-test-invalid-name2-test_"],
deps = [":gtest_test_utils"],
)
...@@ -34,7 +34,7 @@ ...@@ -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' ...@@ -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): ...@@ -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:
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
"""Tests Google Test's exception catching behavior. """Tests Google Test's exception catching behavior.
This script invokes gtest_catch_exceptions_test_ and This script invokes googletest-catch-exceptions-test_ and
gtest_catch_exceptions_ex_test_ (programs written with googletest-catch-exceptions-ex-test_ (programs written with
Google Test) and verifies their output. Google Test) and verifies their output.
""" """
...@@ -45,15 +45,15 @@ LIST_TESTS_FLAG = FLAG_PREFIX + 'list_tests' ...@@ -45,15 +45,15 @@ LIST_TESTS_FLAG = FLAG_PREFIX + 'list_tests'
NO_CATCH_EXCEPTIONS_FLAG = FLAG_PREFIX + 'catch_exceptions=0' NO_CATCH_EXCEPTIONS_FLAG = FLAG_PREFIX + 'catch_exceptions=0'
FILTER_FLAG = FLAG_PREFIX + 'filter' FILTER_FLAG = FLAG_PREFIX + 'filter'
# Path to the gtest_catch_exceptions_ex_test_ binary, compiled with # Path to the googletest-catch-exceptions-ex-test_ binary, compiled with
# exceptions enabled. # exceptions enabled.
EX_EXE_PATH = gtest_test_utils.GetTestExecutablePath( EX_EXE_PATH = gtest_test_utils.GetTestExecutablePath(
'gtest_catch_exceptions_ex_test_') 'googletest-catch-exceptions-ex-test_')
# Path to the gtest_catch_exceptions_test_ binary, compiled with # Path to the googletest-catch-exceptions-test_ binary, compiled with
# exceptions disabled. # exceptions disabled.
EXE_PATH = gtest_test_utils.GetTestExecutablePath( EXE_PATH = gtest_test_utils.GetTestExecutablePath(
'gtest_catch_exceptions_no_ex_test_') 'googletest-catch-exceptions-no-ex-test_')
environ = gtest_test_utils.environ environ = gtest_test_utils.environ
SetEnvVar = gtest_test_utils.SetEnvVar SetEnvVar = gtest_test_utils.SetEnvVar
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
// Author: vladl@google.com (Vlad Losev) // Author: vladl@google.com (Vlad Losev)
// //
// Tests for Google Test itself. Tests in this file throw C++ or SEH // Tests for Google Test itself. Tests in this file throw C++ or SEH
// exceptions, and the output is verified by gtest_catch_exceptions_test.py. // exceptions, and the output is verified by googletest-catch-exceptions-test.py.
#include "gtest/gtest.h" #include "gtest/gtest.h"
......
...@@ -40,7 +40,7 @@ IS_WINDOWS = os.name == 'nt' ...@@ -40,7 +40,7 @@ IS_WINDOWS = os.name == 'nt'
COLOR_ENV_VAR = 'GTEST_COLOR' COLOR_ENV_VAR = 'GTEST_COLOR'
COLOR_FLAG = 'gtest_color' COLOR_FLAG = 'gtest_color'
COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_color_test_') COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-color-test_')
def SetEnvVar(env_var, value): def SetEnvVar(env_var, value):
...@@ -53,7 +53,7 @@ def SetEnvVar(env_var, value): ...@@ -53,7 +53,7 @@ def SetEnvVar(env_var, value):
def UsesColor(term, color_env_var, color_flag): def UsesColor(term, color_env_var, color_flag):
"""Runs gtest_color_test_ and returns its exit code.""" """Runs googletest-color-test_ and returns its exit code."""
SetEnvVar('TERM', term) SetEnvVar('TERM', term)
SetEnvVar(COLOR_ENV_VAR, color_env_var) SetEnvVar(COLOR_ENV_VAR, color_env_var)
......
...@@ -69,7 +69,7 @@ TEST(CxxExceptionDeathTest, PrintsMessageForStdExceptions) { ...@@ -69,7 +69,7 @@ TEST(CxxExceptionDeathTest, PrintsMessageForStdExceptions) {
"exceptional message"); "exceptional message");
// Verifies that the location is mentioned in the failure text. // Verifies that the location is mentioned in the failure text.
EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(throw TestException(), ""), EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(throw TestException(), ""),
"gtest-death-test_ex_test.cc"); "googletest-death-test_ex_test.cc");
} }
# endif // GTEST_HAS_EXCEPTIONS # endif // GTEST_HAS_EXCEPTIONS
......
...@@ -40,7 +40,7 @@ import gtest_test_utils ...@@ -40,7 +40,7 @@ import gtest_test_utils
IS_WINDOWS = os.name == 'nt' IS_WINDOWS = os.name == 'nt'
IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux' IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux'
COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_env_var_test_') COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-env-var-test_')
environ = os.environ.copy() environ = os.environ.copy()
...@@ -62,7 +62,7 @@ def SetEnvVar(env_var, value): ...@@ -62,7 +62,7 @@ def SetEnvVar(env_var, value):
def GetFlag(flag): def GetFlag(flag):
"""Runs gtest_env_var_test_ and returns its output.""" """Runs googletest-env-var-test_ and returns its output."""
args = [COMMAND] args = [COMMAND]
if flag is not None: if flag is not None:
......
...@@ -115,7 +115,7 @@ int main(int argc, char** argv) { ...@@ -115,7 +115,7 @@ int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
if (argc != 2) { if (argc != 2) {
cout << "Usage: gtest_env_var_test_ NAME_OF_FLAG\n"; cout << "Usage: googletest-env-var-test_ NAME_OF_FLAG\n";
return 1; return 1;
} }
......
...@@ -33,7 +33,7 @@ ...@@ -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' ...@@ -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' ...@@ -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): ...@@ -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): ...@@ -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:
......
...@@ -46,7 +46,10 @@ GTEST_OUTPUT_FLAG = '--gtest_output' ...@@ -46,7 +46,10 @@ GTEST_OUTPUT_FLAG = '--gtest_output'
GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.json' GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.json'
GTEST_PROGRAM_NAME = 'gtest_xml_output_unittest_' GTEST_PROGRAM_NAME = 'gtest_xml_output_unittest_'
SUPPORTS_STACK_TRACES = False # The flag indicating stacktraces are not supported
NO_STACKTRACE_SUPPORT_FLAG = '--no_stacktrace_support'
SUPPORTS_STACK_TRACES = NO_STACKTRACE_SUPPORT_FLAG not in sys.argv
if SUPPORTS_STACK_TRACES: if SUPPORTS_STACK_TRACES:
STACK_TRACE_TEMPLATE = '\nStack trace:\n*' STACK_TRACE_TEMPLATE = '\nStack trace:\n*'
...@@ -607,5 +610,9 @@ class GTestJsonOutputUnitTest(gtest_test_utils.TestCase): ...@@ -607,5 +610,9 @@ class GTestJsonOutputUnitTest(gtest_test_utils.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
if NO_STACKTRACE_SUPPORT_FLAG in sys.argv:
# unittest.main() can't handle unknown flags
sys.argv.remove(NO_STACKTRACE_SUPPORT_FLAG)
os.environ['GTEST_STACK_TRACE_DEPTH'] = '1' os.environ['GTEST_STACK_TRACE_DEPTH'] = '1'
gtest_test_utils.Main() gtest_test_utils.Main()
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
A user can ask Google Test to list all tests by specifying the A user can ask Google Test to list all tests by specifying the
--gtest_list_tests flag. This script tests such functionality --gtest_list_tests flag. This script tests such functionality
by invoking gtest_list_tests_unittest_ (a program written with by invoking googletest-list-tests-unittest_ (a program written with
Google Test) the command line flags. Google Test) the command line flags.
""" """
...@@ -47,10 +47,10 @@ import gtest_test_utils ...@@ -47,10 +47,10 @@ import gtest_test_utils
# The command line flag for enabling/disabling listing all tests. # The command line flag for enabling/disabling listing all tests.
LIST_TESTS_FLAG = 'gtest_list_tests' LIST_TESTS_FLAG = 'gtest_list_tests'
# Path to the gtest_list_tests_unittest_ program. # Path to the googletest-list-tests-unittest_ program.
EXE_PATH = gtest_test_utils.GetTestExecutablePath('gtest_list_tests_unittest_') EXE_PATH = gtest_test_utils.GetTestExecutablePath('googletest-list-tests-unittest_')
# The expected output when running gtest_list_tests_unittest_ with # The expected output when running googletest-list-tests-unittest_ with
# --gtest_list_tests # --gtest_list_tests
EXPECTED_OUTPUT_NO_FILTER_RE = re.compile(r"""FooDeathTest\. EXPECTED_OUTPUT_NO_FILTER_RE = re.compile(r"""FooDeathTest\.
Test1 Test1
...@@ -94,7 +94,7 @@ MyInstantiation/ValueParamTest\. ...@@ -94,7 +94,7 @@ MyInstantiation/ValueParamTest\.
TestB/2 # GetParam\(\) = a very\\nlo{241}\.\.\. TestB/2 # GetParam\(\) = a very\\nlo{241}\.\.\.
""") """)
# The expected output when running gtest_list_tests_unittest_ with # The expected output when running googletest-list-tests-unittest_ with
# --gtest_list_tests and --gtest_filter=Foo*. # --gtest_list_tests and --gtest_filter=Foo*.
EXPECTED_OUTPUT_FILTER_FOO_RE = re.compile(r"""FooDeathTest\. EXPECTED_OUTPUT_FILTER_FOO_RE = re.compile(r"""FooDeathTest\.
Test1 Test1
...@@ -114,7 +114,7 @@ FooTest\. ...@@ -114,7 +114,7 @@ FooTest\.
def Run(args): def Run(args):
"""Runs gtest_list_tests_unittest_ and returns the list of tests printed.""" """Runs googletest-list-tests-unittest_ and returns the list of tests printed."""
return gtest_test_utils.Subprocess([EXE_PATH] + args, return gtest_test_utils.Subprocess([EXE_PATH] + args,
capture_stderr=False).output capture_stderr=False).output
...@@ -127,7 +127,7 @@ class GTestListTestsUnitTest(gtest_test_utils.TestCase): ...@@ -127,7 +127,7 @@ class GTestListTestsUnitTest(gtest_test_utils.TestCase):
"""Tests using the --gtest_list_tests flag to list all tests.""" """Tests using the --gtest_list_tests flag to list all tests."""
def RunAndVerify(self, flag_value, expected_output_re, other_flag): def RunAndVerify(self, flag_value, expected_output_re, other_flag):
"""Runs gtest_list_tests_unittest_ and verifies that it prints """Runs googletest-list-tests-unittest_ and verifies that it prints
the correct tests. the correct tests.
Args: Args:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment