From 509f7fe84094dc632ba1794c1f9bd3a7c049d5fe Mon Sep 17 00:00:00 2001 From: Che-Hsun Liu Date: Sun, 2 Jul 2017 20:19:03 +0800 Subject: Update googletest README.md Use `EXCLUDE_FROM_ALL` in `add_subdirectory` to prevent `make install` from including lots of headers from gtest/gmock. ``` add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src ${CMAKE_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL) ``` --- googletest/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/googletest/README.md b/googletest/README.md index 0a3474c..cdebd9d 100644 --- a/googletest/README.md +++ b/googletest/README.md @@ -161,7 +161,8 @@ Existing build's `CMakeLists.txt`: # Add googletest directly to our build. This defines # the gtest and gtest_main targets. add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src - ${CMAKE_BINARY_DIR}/googletest-build) + ${CMAKE_BINARY_DIR}/googletest-build + EXCLUDE_FROM_ALL) # The gtest/gtest_main targets carry header search path # dependencies automatically when using CMake 2.8.11 or -- cgit v0.12 From ca6a70c6082ff526b993c622d192c6d519800bc2 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Fri, 20 Jan 2017 12:54:07 -0500 Subject: Pass MSVC's C4826 warning. MSVC has an optional warning which flags when 32-bit pointers get cast into a 64-bit value. This is a little overaggressive I think, but to ease compiling in projects with aggressive warnings, fix this by just casting to const void * directly. Modern GCCs seem to compile it just fine. --- googletest/include/gtest/gtest-printers.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index e850d60..c6f69fa 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -426,13 +426,8 @@ void DefaultPrintTo(WrapPrinterType /* dummy */, *os << "NULL"; } else { // T is a function type, so '*os << p' doesn't do what we want - // (it just prints p as bool). We want to print p as a const - // void*. However, we cannot cast it to const void* directly, - // even using reinterpret_cast, as earlier versions of gcc - // (e.g. 3.4.5) cannot compile the cast when p is a function - // pointer. Casting to UInt64 first solves the problem. - *os << reinterpret_cast( - reinterpret_cast(p)); + // (it just prints p as bool). Cast p to const void* to print it. + *os << reinterpret_cast(p); } } -- cgit v0.12 From 8f04622cc1507a3954490a03a1dfcff9e340359e Mon Sep 17 00:00:00 2001 From: gpetit Date: Mon, 14 Aug 2017 13:45:27 -0400 Subject: Use GTEST_LOG instead of printf --- googletest/src/gtest.cc | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index d882ab2..b8579d3 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -2571,10 +2571,10 @@ void ReportInvalidTestCaseType(const char* test_case_name, << "probably rename one of the classes to put the tests into different\n" << "test cases."; - fprintf(stderr, "%s %s", - FormatFileLocation(code_location.file.c_str(), - code_location.line).c_str(), - errors.GetString().c_str()); + GTEST_LOG_(ERROR) + << FormatFileLocation(code_location.file.c_str(), + code_location.line), + << " " << errors.GetString(); } #endif // GTEST_HAS_PARAM_TEST @@ -3422,8 +3422,10 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener { XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file) : output_file_(output_file) { if (output_file_.c_str() == NULL || output_file_.empty()) { - fprintf(stderr, "XML output file may not be null\n"); - fflush(stderr); + { + // scoped to make sure the log is flushed before we exit + GTEST_LOG_(FATAL) << "XML output file may not be null"; + } exit(EXIT_FAILURE); } } @@ -3449,10 +3451,10 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, // 3. To interpret the meaning of errno in a thread-safe way, // we need the strerror_r() function, which is not available on // Windows. - fprintf(stderr, - "Unable to open file \"%s\"\n", - output_file_.c_str()); - fflush(stderr); + { // scoped to ensure the log is flushed before we exit + GTEST_LOG_(FATAL) << "Unable to open file \"" + << output_file_ << "\""; + } exit(EXIT_FAILURE); } std::stringstream stream; @@ -4403,9 +4405,9 @@ void UnitTestImpl::ConfigureXmlOutput() { listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter( UnitTestOptions::GetAbsolutePathToOutputFile().c_str())); } else if (output_format != "") { - printf("WARNING: unrecognized output format \"%s\" ignored.\n", - output_format.c_str()); - fflush(stdout); + GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \"" + << output_format + << "\" ignored."; } } @@ -4420,9 +4422,9 @@ void UnitTestImpl::ConfigureStreamingOutput() { listeners()->Append(new StreamingListener(target.substr(0, pos), target.substr(pos+1))); } else { - printf("WARNING: unrecognized streaming target \"%s\" ignored.\n", - target.c_str()); - fflush(stdout); + GTEST_LOG_(WARNING) << "unrecognized streaming target \"" + << target + << "\" ignored."; } } } @@ -4551,9 +4553,9 @@ static void TearDownEnvironment(Environment* env) { env->TearDown(); } bool UnitTestImpl::RunAllTests() { // Makes sure InitGoogleTest() was called. if (!GTestIsInitialized()) { - printf("%s", - "\nThis test program did NOT call ::testing::InitGoogleTest " - "before calling RUN_ALL_TESTS(). Please fix it.\n"); + GTEST_LOG_(ERROR) << + "\nThis test program did NOT call ::testing::InitGoogleTest " + "before calling RUN_ALL_TESTS(). Please fix it."; return false; } @@ -5253,10 +5255,11 @@ bool ParseGoogleTestFlag(const char* const arg) { void LoadFlagsFromFile(const std::string& path) { FILE* flagfile = posix::FOpen(path.c_str(), "r"); if (!flagfile) { - fprintf(stderr, - "Unable to open file \"%s\"\n", - GTEST_FLAG(flagfile).c_str()); - fflush(stderr); + { // scoped to ensure the log is flushed before we exit + GTEST_LOG_(FATAL) << "Unable to open file \"" + << GTEST_FLAG(flagfile) + << "\""; + } exit(EXIT_FAILURE); } std::string contents(ReadEntireFile(flagfile)); -- cgit v0.12 From ca76206f4268a009427afa96dfd792012db64583 Mon Sep 17 00:00:00 2001 From: gpetit Date: Mon, 14 Aug 2017 15:30:01 -0400 Subject: Removed extra colon in error log --- googletest/src/gtest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 07b028b..b2d2a28 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -2571,7 +2571,7 @@ void ReportInvalidTestCaseType(const char* test_case_name, GTEST_LOG_(ERROR) << FormatFileLocation(code_location.file.c_str(), - code_location.line), + code_location.line) << " " << errors.GetString(); } #endif // GTEST_HAS_PARAM_TEST -- cgit v0.12 From 9538687a89b456e8b4339d7b7928e951ec928198 Mon Sep 17 00:00:00 2001 From: Zhongming Qu Date: Tue, 4 Jul 2017 17:50:00 -0400 Subject: Remove trailing whitespaces in BUILD.bazel --- BUILD.bazel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index a442374..5a193fa 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,4 +1,4 @@ -# Copyright 2017 Google Inc. +# Copyright 2017 Google Inc. # All Rights Reserved. # # @@ -41,7 +41,7 @@ config_setting( values = {"cpu": "x64_windows_msvc"}, ) -# Google Test including Google Mock +# Google Test including Google Mock cc_library( name = "gtest", srcs = glob( -- cgit v0.12 From 99d0ef39a6673b193150399ff69cc1ec78b4b6c7 Mon Sep 17 00:00:00 2001 From: Zhongming Qu Date: Fri, 18 Aug 2017 03:59:05 -0700 Subject: Also can build when included in source. --- BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.bazel b/BUILD.bazel index 5a193fa..922ce04 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -88,7 +88,7 @@ cc_library( srcs = [ "googlemock/src/gmock_main.cc", ], - deps = ["//:gtest"], + deps = [":gtest"], ) # The following rules build samples of how to use gTest. -- cgit v0.12 From 4d26df729c4172a4786fb4ca509a264dfd9b89dc Mon Sep 17 00:00:00 2001 From: Brian Silverman Date: Tue, 19 Jul 2016 16:44:26 -0700 Subject: Speed up printing of characters which need hex escaping This change speeds up the runtime of a value-parameterized test I have which has lots of values with large strings full of unprintable characters by 2x. I profiled it and traced most of the slowness during googletest startup down to the way String::FormatHexInt was creating and destroyed a stringstream for each character in the string for each value. --- googletest/src/gtest-printers.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/googletest/src/gtest-printers.cc b/googletest/src/gtest-printers.cc index a2df412..dd67f64 100644 --- a/googletest/src/gtest-printers.cc +++ b/googletest/src/gtest-printers.cc @@ -180,7 +180,10 @@ static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) { *os << static_cast(c); return kAsIs; } else { - *os << "\\x" + String::FormatHexInt(static_cast(c)); + ostream::fmtflags flags = os->flags(); + *os << "\\x" << std::hex << std::uppercase + << static_cast(static_cast(c)); + os->flags(flags); return kHexEscape; } } -- cgit v0.12 From b567aadd1b3eeccdb85305cdb65664f0245e90bc Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Tue, 9 May 2017 18:54:04 +0200 Subject: remove unused TestCase import --- googletest/samples/sample10_unittest.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/googletest/samples/sample10_unittest.cc b/googletest/samples/sample10_unittest.cc index 977e5ff..10aa762 100644 --- a/googletest/samples/sample10_unittest.cc +++ b/googletest/samples/sample10_unittest.cc @@ -38,7 +38,6 @@ using ::testing::EmptyTestEventListener; using ::testing::InitGoogleTest; using ::testing::Test; -using ::testing::TestCase; using ::testing::TestEventListeners; using ::testing::TestInfo; using ::testing::TestPartResult; -- cgit v0.12 From d15b8b4524063e065263316e67e74a47f7dc4af2 Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Wed, 30 Aug 2017 21:25:34 +0200 Subject: switch one build to Release mode This turns on optimization which allows the compiler to discover more problems and omit some more warnings. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 417d2c5..81692dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,7 @@ script: ./travis.sh env: matrix: - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=Debug VERBOSE=1 - - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c++11 + - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 notifications: email: false sudo: false -- cgit v0.12 From 520ad96b78179fde7110ea29f7c22a6a9b32ed09 Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Wed, 30 Aug 2017 21:42:33 +0200 Subject: treat all warnings as errors for GCC (-Werror) --- googletest/cmake/internal_utils.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index ec5d08c..0b41e3a 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -94,7 +94,7 @@ macro(config_compiler_and_linker) set(cxx_no_exception_flags "-D_HAS_EXCEPTIONS=0") set(cxx_no_rtti_flags "-GR-") elseif (CMAKE_COMPILER_IS_GNUCXX) - set(cxx_base_flags "-Wall -Wshadow") + set(cxx_base_flags "-Wall -Wshadow -Werror") set(cxx_exception_flags "-fexceptions") set(cxx_no_exception_flags "-fno-exceptions") # Until version 4.3.2, GCC doesn't define a macro to indicate -- cgit v0.12 From e7c9e80e63e5cdcd3252ed81c9d3dbf0a7fb6841 Mon Sep 17 00:00:00 2001 From: Bernhard Bauer Date: Thu, 4 Feb 2016 11:50:08 +0000 Subject: Allow macros inside of parametrized test names. This allows doing things like TEST_P(TestFixture, MAYBE(TestName)) for nicer conditional test disabling. --- googletest/include/gtest/gtest-param-test.h | 15 +++++++++------ googletest/include/gtest/gtest-param-test.h.pump | 9 ++++++--- googletest/test/gtest-param-test_test.cc | 16 ++++++++++++++++ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h index 038f9ba..e01c3ff 100644 --- a/googletest/include/gtest/gtest-param-test.h +++ b/googletest/include/gtest/gtest-param-test.h @@ -1375,7 +1375,10 @@ internal::CartesianProductHolder10AddTestPattern(\ - #test_case_name, \ - #test_name, \ + GTEST_STRINGIFY_(test_case_name), \ + GTEST_STRINGIFY_(test_name), \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(\ test_case_name, test_name)>()); \ @@ -1412,11 +1415,11 @@ internal::CartesianProductHolder10, and return std::string. // // testing::PrintToStringParamName is a builtin test suffix generator that -// returns the value of testing::PrintToString(GetParam()). It does not work -// for std::string or C strings. +// returns the value of testing::PrintToString(GetParam()). // // Note: test names must be non-empty, unique, and may only contain ASCII -// alphanumeric characters or underscore. +// alphanumeric characters or underscore. Because PrintToString adds quotes +// to std::string and C strings, it won't work for these types. # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ ::testing::internal::ParamGenerator \ diff --git a/googletest/include/gtest/gtest-param-test.h.pump b/googletest/include/gtest/gtest-param-test.h.pump index 3078d6d..8ab18dd 100644 --- a/googletest/include/gtest/gtest-param-test.h.pump +++ b/googletest/include/gtest/gtest-param-test.h.pump @@ -441,7 +441,10 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine( ]] # endif // GTEST_HAS_COMBINE - +// Use a macro to stringify the test (case) name, because direct stringification +// does not work if one of the arguments is itself a macro +// (https://gcc.gnu.org/onlinedocs/cpp/Stringification.html). +# define GTEST_STRINGIFY_(name) #name # define TEST_P(test_case_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ @@ -456,8 +459,8 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine( #test_case_name, \ ::testing::internal::CodeLocation(\ __FILE__, __LINE__))->AddTestPattern(\ - #test_case_name, \ - #test_name, \ + GTEST_STRINGIFY_(test_case_name), \ + GTEST_STRINGIFY_(test_name), \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(\ test_case_name, test_name)>()); \ diff --git a/googletest/test/gtest-param-test_test.cc b/googletest/test/gtest-param-test_test.cc index 857f6c5..a6ecef6 100644 --- a/googletest/test/gtest-param-test_test.cc +++ b/googletest/test/gtest-param-test_test.cc @@ -809,6 +809,22 @@ TEST_P(NamingTest, TestsReportCorrectNamesAndParameters) { INSTANTIATE_TEST_CASE_P(ZeroToFiveSequence, NamingTest, Range(0, 5)); +// Tests that macros in test names are expanded correctly. +class MacroNamingTest : public TestWithParam {}; + +#define PREFIX_WITH_FOO(test_name) FOO_##test_name +#define PREFIX_WITH_MACRO(test_name) Macro##test_name + +TEST_P(PREFIX_WITH_MACRO(NamingTest), PREFIX_WITH_FOO(SomeTestName)) { + const ::testing::TestInfo* const test_info = + ::testing::UnitTest::GetInstance()->current_test_info(); + + EXPECT_STREQ("FortyTwo/MacroNamingTest", test_info->test_case_name()); + EXPECT_STREQ("FOO_SomeTestName", test_info->name()); +} + +INSTANTIATE_TEST_CASE_P(FortyTwo, MacroNamingTest, Values(42)); + // Tests that user supplied custom parameter names are working correctly. // Runs the test with a builtin helper method which uses PrintToString, // as well as a custom function and custom functor to ensure all possible -- cgit v0.12 From 86e5f0083e5217e37eb94a391a2f7349bcef4660 Mon Sep 17 00:00:00 2001 From: Bernhard Bauer Date: Wed, 10 Feb 2016 17:41:18 +0000 Subject: Add a non-parametrized test. --- googletest/test/gtest-param-test_test.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/googletest/test/gtest-param-test_test.cc b/googletest/test/gtest-param-test_test.cc index a6ecef6..f6f5955 100644 --- a/googletest/test/gtest-param-test_test.cc +++ b/googletest/test/gtest-param-test_test.cc @@ -825,6 +825,18 @@ TEST_P(PREFIX_WITH_MACRO(NamingTest), PREFIX_WITH_FOO(SomeTestName)) { INSTANTIATE_TEST_CASE_P(FortyTwo, MacroNamingTest, Values(42)); +// Tests the same thing for non-parametrized tests. +class MacroNamingTestNonParametrized : public ::testing::Test {}; + +TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized), + PREFIX_WITH_FOO(SomeTestName)) { + const ::testing::TestInfo* const test_info = + ::testing::UnitTest::GetInstance()->current_test_info(); + + EXPECT_STREQ("MacroNamingTestNonParametrized", test_info->test_case_name()); + EXPECT_STREQ("FOO_SomeTestName", test_info->name()); +} + // Tests that user supplied custom parameter names are working correctly. // Runs the test with a builtin helper method which uses PrintToString, // as well as a custom function and custom functor to ensure all possible -- cgit v0.12 From 8abacca52eeb9e9502b5cc2c3b4733d8adf3c42b Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Mon, 4 Sep 2017 13:23:08 +0200 Subject: avoid -Wshadow warning on GCC When using INSTANTIATE_TEST_CASE_P with a lambda function which uses 'info' as parameter name, GCC complains that this would shadow parameter 'info' used in the macro's VA_ARGS call. --- googletest/test/gtest-param-test_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/test/gtest-param-test_test.cc b/googletest/test/gtest-param-test_test.cc index 857f6c5..d1b0644 100644 --- a/googletest/test/gtest-param-test_test.cc +++ b/googletest/test/gtest-param-test_test.cc @@ -857,8 +857,8 @@ TEST_P(CustomLambdaNamingTest, CustomTestNames) {} INSTANTIATE_TEST_CASE_P(CustomParamNameLambda, CustomLambdaNamingTest, Values(std::string("LambdaName")), - [](const ::testing::TestParamInfo& info) { - return info.param; + [](const ::testing::TestParamInfo& tpinfo) { + return tpinfo.param; }); #endif // GTEST_LANG_CXX11 -- cgit v0.12 From 55fd999adf5a8ecfcd502f07b0ea4b691ca7215f Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Wed, 30 Aug 2017 21:43:37 +0200 Subject: avoid warning about unused variable --- googletest/test/gtest_unittest.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index f84def9..78f3ee2 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -2096,7 +2096,7 @@ class UnitTestRecordPropertyTestEnvironment : public Environment { }; // This will test property recording outside of any test or test case. -static Environment* record_property_env = +Environment* record_property_env = AddGlobalTestEnvironment(new UnitTestRecordPropertyTestEnvironment); // This group of tests is for predicate assertions (ASSERT_PRED*, etc) @@ -4188,6 +4188,12 @@ TEST(AssertionSyntaxTest, WorksWithConst) { } // namespace +// we don't use the variable further, just avoid compiler warning +// by defining a function which uses it +void dummy_use_of_record_property_env() { + (void) record_property_env; +} + namespace testing { // Tests that Google Test tracks SUCCEED*. -- cgit v0.12 From 48b06628803c56e90d110f4cd0ca2a11b3132196 Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Sat, 2 Sep 2017 19:07:44 +0200 Subject: cache ccache --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 417d2c5..e517782 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ os: - linux - osx language: cpp +cache: ccache compiler: - gcc - clang -- cgit v0.12 From 98f2f152539ed24cce004a14bbd1307215a925cc Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Mon, 4 Sep 2017 14:06:14 +0200 Subject: install ccache on travis osx build slave --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index e517782..b7ee780 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,8 @@ install: - if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi # /usr/bin/clang is 3.4, lets override with modern one. - if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi +# ccache on OS X needs installation first +- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install ccache; export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi - echo ${PATH} - echo ${CXX} - ${CXX} --version -- cgit v0.12 From aa0b5458a1c33b40f813013f3a6bbb928f8a3d9f Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Mon, 4 Sep 2017 19:38:35 +0200 Subject: remove GTEST_HAS_PARAM_TESTS As mentioned in issue #360: "Now that all the platforms gtest supports work with value-parameterized tests, we should remove the uses of the GTEST_HAS_PARAM_TESTS macro from the codebase everywhere." https://github.com/google/googletest/issues/360 --- googletest/include/gtest/gtest-param-test.h | 7 ------- googletest/include/gtest/gtest-param-test.h.pump | 7 ------- googletest/include/gtest/gtest.h | 4 ---- .../include/gtest/internal/gtest-param-util-generated.h | 7 ------- .../gtest/internal/gtest-param-util-generated.h.pump | 7 ------- googletest/include/gtest/internal/gtest-param-util.h | 7 ------- googletest/include/gtest/internal/gtest-port.h | 15 ++++----------- googletest/samples/sample7_unittest.cc | 12 ------------ googletest/src/gtest-internal-inl.h | 4 ---- googletest/src/gtest.cc | 8 -------- googletest/test/gtest-param-test2_test.cc | 4 ---- googletest/test/gtest-param-test_test.cc | 14 -------------- googletest/test/gtest-param-test_test.h | 4 ---- googletest/test/gtest_filter_unittest_.cc | 2 -- googletest/test/gtest_output_test_.cc | 4 ---- googletest/test/gtest_repeat_test.cc | 10 ---------- 16 files changed, 4 insertions(+), 112 deletions(-) diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h index 038f9ba..7548a7c 100644 --- a/googletest/include/gtest/gtest-param-test.h +++ b/googletest/include/gtest/gtest-param-test.h @@ -185,15 +185,10 @@ TEST_P(DerivedTest, DoesBlah) { # include #endif -// scripts/fuse_gtest.py depends on gtest's own header being #included -// *unconditionally*. Therefore these #includes cannot be moved -// inside #if GTEST_HAS_PARAM_TEST. #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util-generated.h" -#if GTEST_HAS_PARAM_TEST - namespace testing { // Functions producing parameter generators. @@ -1439,6 +1434,4 @@ internal::CartesianProductHolder10 #endif -// scripts/fuse_gtest.py depends on gtest's own header being #included -// *unconditionally*. Therefore these #includes cannot be moved -// inside #if GTEST_HAS_PARAM_TEST. #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util-generated.h" -#if GTEST_HAS_PARAM_TEST - namespace testing { // Functions producing parameter generators. @@ -505,6 +500,4 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine( } // namespace testing -#endif // GTEST_HAS_PARAM_TEST - #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index c1cd69a..1b55677 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -1180,14 +1180,12 @@ class GTEST_API_ UnitTest { // Returns the random seed used at the start of the current test run. int random_seed() const; -#if GTEST_HAS_PARAM_TEST // Returns the ParameterizedTestCaseRegistry object used to keep track of // value-parameterized tests and instantiate and register them. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. internal::ParameterizedTestCaseRegistry& parameterized_test_registry() GTEST_LOCK_EXCLUDED_(mutex_); -#endif // GTEST_HAS_PARAM_TEST // Gets the number of successful test cases. int successful_test_case_count() const; @@ -1706,7 +1704,6 @@ class GTEST_API_ AssertHelper { } // namespace internal -#if GTEST_HAS_PARAM_TEST // The pure interface class that all value-parameterized tests inherit from. // A value-parameterized class must inherit from both ::testing::Test and // ::testing::WithParamInterface. In most cases that just means inheriting @@ -1783,7 +1780,6 @@ template class TestWithParam : public Test, public WithParamInterface { }; -#endif // GTEST_HAS_PARAM_TEST // Macros for indicating success/failure in test code. diff --git a/googletest/include/gtest/internal/gtest-param-util-generated.h b/googletest/include/gtest/internal/gtest-param-util-generated.h index 4d1d81d..34bd0dd 100644 --- a/googletest/include/gtest/internal/gtest-param-util-generated.h +++ b/googletest/include/gtest/internal/gtest-param-util-generated.h @@ -46,14 +46,9 @@ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ -// scripts/fuse_gtest.py depends on gtest's own header being #included -// *unconditionally*. Therefore these #includes cannot be moved -// inside #if GTEST_HAS_PARAM_TEST. #include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-port.h" -#if GTEST_HAS_PARAM_TEST - namespace testing { // Forward declarations of ValuesIn(), which is implemented in @@ -5141,6 +5136,4 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2, } // namespace internal } // namespace testing -#endif // GTEST_HAS_PARAM_TEST - #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ diff --git a/googletest/include/gtest/internal/gtest-param-util-generated.h.pump b/googletest/include/gtest/internal/gtest-param-util-generated.h.pump index 5c7c47a..7fcf4ce 100644 --- a/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +++ b/googletest/include/gtest/internal/gtest-param-util-generated.h.pump @@ -45,14 +45,9 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ -// scripts/fuse_gtest.py depends on gtest's own header being #included -// *unconditionally*. Therefore these #includes cannot be moved -// inside #if GTEST_HAS_PARAM_TEST. #include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-port.h" -#if GTEST_HAS_PARAM_TEST - namespace testing { // Forward declarations of ValuesIn(), which is implemented in @@ -281,6 +276,4 @@ $for j [[ } // namespace internal } // namespace testing -#endif // GTEST_HAS_PARAM_TEST - #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ diff --git a/googletest/include/gtest/internal/gtest-param-util.h b/googletest/include/gtest/internal/gtest-param-util.h index 3142f74..3c80863 100644 --- a/googletest/include/gtest/internal/gtest-param-util.h +++ b/googletest/include/gtest/internal/gtest-param-util.h @@ -41,16 +41,11 @@ #include #include -// scripts/fuse_gtest.py depends on gtest's own header being #included -// *unconditionally*. Therefore these #includes cannot be moved -// inside #if GTEST_HAS_PARAM_TEST. #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-linked_ptr.h" #include "gtest/internal/gtest-port.h" #include "gtest/gtest-printers.h" -#if GTEST_HAS_PARAM_TEST - namespace testing { // Input to a parameterized test name generator, describing a test parameter. @@ -725,6 +720,4 @@ class ParameterizedTestCaseRegistry { } // namespace internal } // namespace testing -#endif // GTEST_HAS_PARAM_TEST - #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 643beff..d70f2d7 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -171,7 +171,6 @@ // GTEST_HAS_COMBINE - the Combine() function (for value-parameterized // tests) // GTEST_HAS_DEATH_TEST - death tests -// GTEST_HAS_PARAM_TEST - value-parameterized tests // GTEST_HAS_TYPED_TEST - typed tests // GTEST_HAS_TYPED_TEST_P - type-parameterized tests // GTEST_IS_THREADSAFE - Google Test is thread-safe. @@ -807,11 +806,6 @@ using ::std::tuple_size; # define GTEST_HAS_DEATH_TEST 1 #endif -// We don't support MSVC 7.1 with exceptions disabled now. Therefore -// all the compilers we care about are adequate for supporting -// value-parameterized tests. -#define GTEST_HAS_PARAM_TEST 1 - // Determines whether to support type-driven tests. // Typed tests need and variadic macros, which GCC, VC++ 8.0, @@ -822,11 +816,10 @@ using ::std::tuple_size; # define GTEST_HAS_TYPED_TEST_P 1 #endif -// Determines whether to support Combine(). This only makes sense when -// value-parameterized tests are enabled. The implementation doesn't -// work on Sun Studio since it doesn't understand templated conversion -// operators. -#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC) +// Determines whether to support Combine(). +// The implementation doesn't work on Sun Studio since it doesn't +// understand templated conversion operators. +#if GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC) # define GTEST_HAS_COMBINE 1 #endif diff --git a/googletest/samples/sample7_unittest.cc b/googletest/samples/sample7_unittest.cc index b59e1d9..efa9728 100644 --- a/googletest/samples/sample7_unittest.cc +++ b/googletest/samples/sample7_unittest.cc @@ -40,7 +40,6 @@ #include "gtest/gtest.h" namespace { -#if GTEST_HAS_PARAM_TEST using ::testing::TestWithParam; using ::testing::Values; @@ -116,15 +115,4 @@ INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7, Values(&CreateOnTheFlyPrimeTable, &CreatePreCalculatedPrimeTable<1000>)); -#else - -// Google Test may not support value-parameterized tests with some -// compilers. If we use conditional compilation to compile out all -// code referring to the gtest_main library, MSVC linker will not link -// that library at all and consequently complain about missing entry -// point defined in that library (fatal error LNK1561: entry point -// must be defined). This dummy test keeps gtest_main linked in. -TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {} - -#endif // GTEST_HAS_PARAM_TEST } // namespace diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index 021feb1..1437293 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -664,13 +664,11 @@ class GTEST_API_ UnitTestImpl { tear_down_tc)->AddTestInfo(test_info); } -#if GTEST_HAS_PARAM_TEST // Returns ParameterizedTestCaseRegistry object used to keep track of // value-parameterized tests and instantiate and register them. internal::ParameterizedTestCaseRegistry& parameterized_test_registry() { return parameterized_test_registry_; } -#endif // GTEST_HAS_PARAM_TEST // Sets the TestCase object for the test that's currently running. void set_current_test_case(TestCase* a_current_test_case) { @@ -845,14 +843,12 @@ class GTEST_API_ UnitTestImpl { // shuffled order. std::vector test_case_indices_; -#if GTEST_HAS_PARAM_TEST // ParameterizedTestRegistry object used to register value-parameterized // tests. internal::ParameterizedTestCaseRegistry parameterized_test_registry_; // Indicates whether RegisterParameterizedTests() has been called already. bool parameterized_tests_registered_; -#endif // GTEST_HAS_PARAM_TEST // Index of the last death test case registered. Initially -1. int last_death_test_case_; diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 2484caf..cc0bbb4 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -2555,7 +2555,6 @@ TestInfo* MakeAndRegisterTestInfo( return test_info; } -#if GTEST_HAS_PARAM_TEST void ReportInvalidTestCaseType(const char* test_case_name, CodeLocation code_location) { Message errors; @@ -2574,7 +2573,6 @@ void ReportInvalidTestCaseType(const char* test_case_name, code_location.line).c_str(), errors.GetString().c_str()); } -#endif // GTEST_HAS_PARAM_TEST } // namespace internal @@ -2613,12 +2611,10 @@ namespace internal { // and INSTANTIATE_TEST_CASE_P into regular tests and registers those. // This will be done just once during the program runtime. void UnitTestImpl::RegisterParameterizedTests() { -#if GTEST_HAS_PARAM_TEST if (!parameterized_tests_registered_) { parameterized_test_registry_.RegisterTests(); parameterized_tests_registered_ = true; } -#endif } } // namespace internal @@ -4313,7 +4309,6 @@ const TestInfo* UnitTest::current_test_info() const // Returns the random seed used at the start of the current test run. int UnitTest::random_seed() const { return impl_->random_seed(); } -#if GTEST_HAS_PARAM_TEST // Returns ParameterizedTestCaseRegistry object used to keep track of // value-parameterized tests and instantiate and register them. internal::ParameterizedTestCaseRegistry& @@ -4321,7 +4316,6 @@ internal::ParameterizedTestCaseRegistry& GTEST_LOCK_EXCLUDED_(mutex_) { return impl_->parameterized_test_registry(); } -#endif // GTEST_HAS_PARAM_TEST // Creates an empty UnitTest. UnitTest::UnitTest() { @@ -4360,10 +4354,8 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent) &default_global_test_part_result_reporter_), per_thread_test_part_result_reporter_( &default_per_thread_test_part_result_reporter_), -#if GTEST_HAS_PARAM_TEST parameterized_test_registry_(), parameterized_tests_registered_(false), -#endif // GTEST_HAS_PARAM_TEST last_death_test_case_(-1), current_test_case_(NULL), current_test_info_(NULL), diff --git a/googletest/test/gtest-param-test2_test.cc b/googletest/test/gtest-param-test2_test.cc index 4a782fe..e7afdc3 100644 --- a/googletest/test/gtest-param-test2_test.cc +++ b/googletest/test/gtest-param-test2_test.cc @@ -36,8 +36,6 @@ #include "test/gtest-param-test_test.h" -#if GTEST_HAS_PARAM_TEST - using ::testing::Values; using ::testing::internal::ParamGenerator; @@ -61,5 +59,3 @@ INSTANTIATE_TEST_CASE_P(MultiplesOf33, INSTANTIATE_TEST_CASE_P(Sequence2, InstantiationInMultipleTranslaionUnitsTest, Values(42*3, 42*4, 42*5)); - -#endif // GTEST_HAS_PARAM_TEST diff --git a/googletest/test/gtest-param-test_test.cc b/googletest/test/gtest-param-test_test.cc index 857f6c5..d1e9d60 100644 --- a/googletest/test/gtest-param-test_test.cc +++ b/googletest/test/gtest-param-test_test.cc @@ -35,8 +35,6 @@ #include "gtest/gtest.h" -#if GTEST_HAS_PARAM_TEST - # include # include # include @@ -1025,31 +1023,19 @@ TEST_F(ParameterizedDeathTest, GetParamDiesFromTestF) { INSTANTIATE_TEST_CASE_P(RangeZeroToFive, ParameterizedDerivedTest, Range(0, 5)); -#endif // GTEST_HAS_PARAM_TEST - -TEST(CompileTest, CombineIsDefinedOnlyWhenGtestHasParamTestIsDefined) { -#if GTEST_HAS_COMBINE && !GTEST_HAS_PARAM_TEST - FAIL() << "GTEST_HAS_COMBINE is defined while GTEST_HAS_PARAM_TEST is not\n" -#endif -} - int main(int argc, char **argv) { -#if GTEST_HAS_PARAM_TEST // Used in TestGenerationTest test case. AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance()); // Used in GeneratorEvaluationTest test case. Tests that the updated value // will be picked up for instantiating tests in GeneratorEvaluationTest. GeneratorEvaluationTest::set_param_value(1); -#endif // GTEST_HAS_PARAM_TEST ::testing::InitGoogleTest(&argc, argv); -#if GTEST_HAS_PARAM_TEST // Used in GeneratorEvaluationTest test case. Tests that value updated // here will NOT be used for instantiating tests in // GeneratorEvaluationTest. GeneratorEvaluationTest::set_param_value(2); -#endif // GTEST_HAS_PARAM_TEST return RUN_ALL_TESTS(); } diff --git a/googletest/test/gtest-param-test_test.h b/googletest/test/gtest-param-test_test.h index 26ea122..249c089 100644 --- a/googletest/test/gtest-param-test_test.h +++ b/googletest/test/gtest-param-test_test.h @@ -39,8 +39,6 @@ #include "gtest/gtest.h" -#if GTEST_HAS_PARAM_TEST - // Test fixture for testing definition and instantiation of a test // in separate translation units. class ExternalInstantiationTest : public ::testing::TestWithParam { @@ -52,6 +50,4 @@ class InstantiationInMultipleTranslaionUnitsTest : public ::testing::TestWithParam { }; -#endif // GTEST_HAS_PARAM_TEST - #endif // GTEST_TEST_GTEST_PARAM_TEST_TEST_H_ diff --git a/googletest/test/gtest_filter_unittest_.cc b/googletest/test/gtest_filter_unittest_.cc index 77deffc..e74a7a3 100644 --- a/googletest/test/gtest_filter_unittest_.cc +++ b/googletest/test/gtest_filter_unittest_.cc @@ -117,7 +117,6 @@ TEST(DISABLED_FoobarbazTest, TestA) { FAIL() << "Expected failure."; } -#if GTEST_HAS_PARAM_TEST class ParamTest : public testing::TestWithParam { }; @@ -129,7 +128,6 @@ TEST_P(ParamTest, TestY) { INSTANTIATE_TEST_CASE_P(SeqP, ParamTest, testing::Values(1, 2)); INSTANTIATE_TEST_CASE_P(SeqQ, ParamTest, testing::Values(5, 6)); -#endif // GTEST_HAS_PARAM_TEST } // namespace diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc index 1070a9f..9f400c5 100644 --- a/googletest/test/gtest_output_test_.cc +++ b/googletest/test/gtest_output_test_.cc @@ -757,8 +757,6 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) { // This #ifdef block tests the output of value-parameterized tests. -#if GTEST_HAS_PARAM_TEST - std::string ParamNameFunc(const testing::TestParamInfo& info) { return info.param; } @@ -779,8 +777,6 @@ INSTANTIATE_TEST_CASE_P(PrintingStrings, testing::Values(std::string("a")), ParamNameFunc); -#endif // GTEST_HAS_PARAM_TEST - // This #ifdef block tests the output of typed tests. #if GTEST_HAS_TYPED_TEST diff --git a/googletest/test/gtest_repeat_test.cc b/googletest/test/gtest_repeat_test.cc index 481012a..fceb7c7 100644 --- a/googletest/test/gtest_repeat_test.cc +++ b/googletest/test/gtest_repeat_test.cc @@ -119,7 +119,6 @@ TEST(BarDeathTest, ThreadSafeAndFast) { EXPECT_DEATH_IF_SUPPORTED(::testing::internal::posix::Abort(), ""); } -#if GTEST_HAS_PARAM_TEST int g_param_test_count = 0; const int kNumberOfParamTests = 10; @@ -135,7 +134,6 @@ TEST_P(MyParamTest, ShouldPass) { INSTANTIATE_TEST_CASE_P(MyParamSequence, MyParamTest, testing::Range(0, kNumberOfParamTests)); -#endif // GTEST_HAS_PARAM_TEST // Resets the count for each test. void ResetCounts() { @@ -144,9 +142,7 @@ void ResetCounts() { g_should_fail_count = 0; g_should_pass_count = 0; g_death_test_count = 0; -#if GTEST_HAS_PARAM_TEST g_param_test_count = 0; -#endif // GTEST_HAS_PARAM_TEST } // Checks that the count for each test is expected. @@ -156,9 +152,7 @@ void CheckCounts(int expected) { GTEST_CHECK_INT_EQ_(expected, g_should_fail_count); GTEST_CHECK_INT_EQ_(expected, g_should_pass_count); GTEST_CHECK_INT_EQ_(expected, g_death_test_count); -#if GTEST_HAS_PARAM_TEST GTEST_CHECK_INT_EQ_(expected * kNumberOfParamTests, g_param_test_count); -#endif // GTEST_HAS_PARAM_TEST } // Tests the behavior of Google Test when --gtest_repeat is not specified. @@ -201,9 +195,7 @@ void TestRepeatWithFilterForSuccessfulTests(int repeat) { GTEST_CHECK_INT_EQ_(0, g_should_fail_count); GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count); GTEST_CHECK_INT_EQ_(repeat, g_death_test_count); -#if GTEST_HAS_PARAM_TEST GTEST_CHECK_INT_EQ_(repeat * kNumberOfParamTests, g_param_test_count); -#endif // GTEST_HAS_PARAM_TEST } // Tests using --gtest_repeat when --gtest_filter specifies a set of @@ -219,9 +211,7 @@ void TestRepeatWithFilterForFailedTests(int repeat) { GTEST_CHECK_INT_EQ_(repeat, g_should_fail_count); GTEST_CHECK_INT_EQ_(0, g_should_pass_count); GTEST_CHECK_INT_EQ_(0, g_death_test_count); -#if GTEST_HAS_PARAM_TEST GTEST_CHECK_INT_EQ_(0, g_param_test_count); -#endif // GTEST_HAS_PARAM_TEST } } // namespace -- cgit v0.12 From e8c6942ac1570c9598cf2d177f6c69cc5ab2bd7b Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Tue, 5 Sep 2017 12:01:14 +0200 Subject: remove obsolete link_directories command It's not necessary, as the target_link_libraries command contains an absolute path already, and the path given doesn't exist anymore, leading only to linker warnings like: ld: warning: directory not found for option '-L/Users/travis/build/google/googletest/build/googlemock/gtest/src' --- googletest/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index 59343ed..8391dbd 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -75,9 +75,6 @@ include_directories( ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}) -# Where Google Test's libraries can be found. -link_directories(${gtest_BINARY_DIR}/src) - # Summary of tuple support for Microsoft Visual Studio: # Compiler version(MS) version(cmake) Support # ---------- ----------- -------------- ----------------------------- -- cgit v0.12 From 9a8794faed3c6a7c80205122d73d93dcb376dd57 Mon Sep 17 00:00:00 2001 From: Stepan Khapugin Date: Tue, 5 Sep 2017 14:10:53 +0200 Subject: add a cast --- googletest/include/gtest/gtest-printers.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index fba7661..129fc68 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -137,7 +137,8 @@ class TypeWithoutFormatter { public: // This default version is called when kTypeKind is kOtherType. static void PrintValue(const T& value, ::std::ostream* os) { - PrintBytesInObjectTo(reinterpret_cast(&value), + PrintBytesInObjectTo(reinterpret_cast( + reinterpret_cast(&value)), sizeof(value), os); } }; -- cgit v0.12 From 83d8dd0e9c5e0ed212e88f006e7e752d9a44e616 Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Tue, 5 Sep 2017 15:23:55 +0200 Subject: call clang via ccache on Linux --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b7ee780..c63909d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ install: # /usr/bin/gcc is 4.6 always, but gcc-X.Y is available. - if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi # /usr/bin/clang is 3.4, lets override with modern one. -- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi +- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; ln -sf /usr/bin/ccache /$HOME/bin/$CXX; ln -sf /usr/bin/ccache /$HOME/bin/$CC; fi # ccache on OS X needs installation first - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install ccache; export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi - echo ${PATH} -- cgit v0.12 From 56f8222a148d0089356063619362e5671bfa782b Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Tue, 5 Sep 2017 13:53:31 +0200 Subject: show ccache statistics in log --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index c63909d..31cea0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,9 @@ os: - osx language: cpp cache: ccache +before_cache: + # print statistics before uploading new cache + - ccache --show-stats compiler: - gcc - clang -- cgit v0.12 From dd8e4a635893a32dec691ab245c08f7311a2784b Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Tue, 5 Sep 2017 15:46:34 +0200 Subject: reset ccache statistics at install --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 31cea0a..ad6dc19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,8 @@ install: - if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; ln -sf /usr/bin/ccache /$HOME/bin/$CXX; ln -sf /usr/bin/ccache /$HOME/bin/$CC; fi # ccache on OS X needs installation first - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install ccache; export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi +# reset ccache statistics +- ccache --zero-stats - echo ${PATH} - echo ${CXX} - ${CXX} --version -- cgit v0.12 From beca85ff4afb247e75ce0ba886ea461b01e788f8 Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Tue, 5 Sep 2017 17:39:04 +0200 Subject: drop unused valgrind package from installation ... and remove explicit gcc installation (will be installed with g++ automatically) --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 417d2c5..164bfae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,10 +22,8 @@ addons: - ubuntu-toolchain-r-test - llvm-toolchain-precise-3.7 packages: - - gcc-4.9 - g++-4.9 - clang-3.7 - - valgrind os: - linux - osx -- cgit v0.12 From be94bf501e649dfa6790b3cce2bbe300949b6e74 Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Tue, 5 Sep 2017 17:45:48 +0200 Subject: remove unused variables from travis environment --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 417d2c5..2709467 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,8 +36,8 @@ compiler: script: ./travis.sh env: matrix: - - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=Debug VERBOSE=1 - - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c++11 + - BUILD_TYPE=Debug VERBOSE=1 + - BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c++11 notifications: email: false sudo: false -- cgit v0.12 From f6dde80e94b982fa74b7da78e56263eee59e4887 Mon Sep 17 00:00:00 2001 From: Gasprd Petit Date: Thu, 7 Sep 2017 07:47:09 -0400 Subject: Removed flush scopes around GTEST_LOG(FATAL) and exit call since FATAL is expected to abort() --- googletest/src/gtest.cc | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 0895b42..fa170e7 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -3449,11 +3449,7 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener { XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file) : output_file_(output_file) { if (output_file_.c_str() == NULL || output_file_.empty()) { - { - // scoped to make sure the log is flushed before we exit - GTEST_LOG_(FATAL) << "XML output file may not be null"; - } - exit(EXIT_FAILURE); + GTEST_LOG_(FATAL) << "XML output file may not be null"; } } @@ -3478,11 +3474,8 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, // 3. To interpret the meaning of errno in a thread-safe way, // we need the strerror_r() function, which is not available on // Windows. - { // scoped to ensure the log is flushed before we exit - GTEST_LOG_(FATAL) << "Unable to open file \"" - << output_file_ << "\""; - } - exit(EXIT_FAILURE); + GTEST_LOG_(FATAL) << "Unable to open file \"" + << output_file_ << "\""; } std::stringstream stream; PrintXmlUnitTest(&stream, unit_test); @@ -5283,12 +5276,9 @@ bool ParseGoogleTestFlag(const char* const arg) { void LoadFlagsFromFile(const std::string& path) { FILE* flagfile = posix::FOpen(path.c_str(), "r"); if (!flagfile) { - { // scoped to ensure the log is flushed before we exit - GTEST_LOG_(FATAL) << "Unable to open file \"" - << GTEST_FLAG(flagfile) - << "\""; - } - exit(EXIT_FAILURE); + GTEST_LOG_(FATAL) << "Unable to open file \"" + << GTEST_FLAG(flagfile) + << "\""; } std::string contents(ReadEntireFile(flagfile)); posix::FClose(flagfile); -- cgit v0.12 From 6c0146fd0075aae0beb394c19285a8869745cc2c Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Thu, 7 Sep 2017 17:33:19 +0200 Subject: use GTEST_ATTRIBUTE_UNUSED_ instead of dummy function --- googletest/test/gtest_unittest.cc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 78f3ee2..745c950 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -2096,7 +2096,7 @@ class UnitTestRecordPropertyTestEnvironment : public Environment { }; // This will test property recording outside of any test or test case. -Environment* record_property_env = +Environment* record_property_env GTEST_ATTRIBUTE_UNUSED_ = AddGlobalTestEnvironment(new UnitTestRecordPropertyTestEnvironment); // This group of tests is for predicate assertions (ASSERT_PRED*, etc) @@ -4188,12 +4188,6 @@ TEST(AssertionSyntaxTest, WorksWithConst) { } // namespace -// we don't use the variable further, just avoid compiler warning -// by defining a function which uses it -void dummy_use_of_record_property_env() { - (void) record_property_env; -} - namespace testing { // Tests that Google Test tracks SUCCEED*. -- cgit v0.12 From 4f68ab5b84dda2b364ea3350fc2a96d1cb15adf5 Mon Sep 17 00:00:00 2001 From: Alex Yursha <31780593+yursha@users.noreply.github.com> Date: Fri, 8 Sep 2017 17:20:59 -0700 Subject: Fix ellipsis position in examples --- googlemock/docs/ForDummies.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/googlemock/docs/ForDummies.md b/googlemock/docs/ForDummies.md index 0bf528e..7691056 100644 --- a/googlemock/docs/ForDummies.md +++ b/googlemock/docs/ForDummies.md @@ -217,7 +217,8 @@ The macro can be followed by some optional _clauses_ that provide more informati This syntax is designed to make an expectation read like English. For example, you can probably guess that ``` -using ::testing::Return;... +using ::testing::Return; +... EXPECT_CALL(turtle, GetX()) .Times(5) .WillOnce(Return(100)) @@ -251,7 +252,8 @@ EXPECT_CALL(turtle, Forward(_)); A list of built-in matchers can be found in the [CheatSheet](CheatSheet.md). For example, here's the `Ge` (greater than or equal) matcher: ``` -using ::testing::Ge;... +using ::testing::Ge; +... EXPECT_CALL(turtle, Forward(Ge(100))); ``` @@ -280,7 +282,8 @@ First, if the return type of a mock function is a built-in type or a pointer, th Second, if a mock function doesn't have a default action, or the default action doesn't suit you, you can specify the action to be taken each time the expectation matches using a series of `WillOnce()` clauses followed by an optional `WillRepeatedly()`. For example, ``` -using ::testing::Return;... +using ::testing::Return; +... EXPECT_CALL(turtle, GetX()) .WillOnce(Return(100)) .WillOnce(Return(200)) @@ -290,7 +293,8 @@ EXPECT_CALL(turtle, GetX()) This says that `turtle.GetX()` will be called _exactly three times_ (Google Mock inferred this from how many `WillOnce()` clauses we've written, since we didn't explicitly write `Times()`), and will return 100, 200, and 300 respectively. ``` -using ::testing::Return;... +using ::testing::Return; +... EXPECT_CALL(turtle, GetY()) .WillOnce(Return(100)) .WillOnce(Return(200)) @@ -317,7 +321,8 @@ Instead of returning 100, 101, 102, ..., consecutively, this mock function will Time for another quiz! What do you think the following means? ``` -using ::testing::Return;... +using ::testing::Return; +... EXPECT_CALL(turtle, GetY()) .Times(4) .WillOnce(Return(100)); @@ -331,7 +336,8 @@ So far we've only shown examples where you have a single expectation. More reali By default, when a mock method is invoked, Google Mock will search the expectations in the **reverse order** they are defined, and stop when an active expectation that matches the arguments is found (you can think of it as "newer rules override older ones."). If the matching expectation cannot take any more calls, you will get an upper-bound-violated failure. Here's an example: ``` -using ::testing::_;... +using ::testing::_; +... EXPECT_CALL(turtle, Forward(_)); // #1 EXPECT_CALL(turtle, Forward(10)) // #2 .Times(2); @@ -347,7 +353,8 @@ By default, an expectation can match a call even though an earlier expectation h Sometimes, you may want all the expected calls to occur in a strict order. To say this in Google Mock is easy: ``` -using ::testing::InSequence;... +using ::testing::InSequence; +... TEST(FooTest, DrawsLineSegment) { ... { @@ -373,7 +380,8 @@ Now let's do a quick quiz to see how well you can use this mock stuff already. H After you've come up with your answer, take a look at ours and compare notes (solve it yourself first - don't cheat!): ``` -using ::testing::_;... +using ::testing::_; +... EXPECT_CALL(turtle, GoTo(_, _)) // #1 .Times(AnyNumber()); EXPECT_CALL(turtle, GoTo(0, 0)) // #2 -- cgit v0.12 From c9cf07a8ba4de21e528a2f2e0e38767c34d54412 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Fri, 1 Sep 2017 14:21:43 +0100 Subject: Make the failure messages from EXPECT_EQ and friends actually symmetric, instead of reading more like reversing the former "expected" and "actual" roles of the LHS and RHS arguments. This patch is manually applied from internal version (125109873) --- googletest/src/gtest.cc | 9 +- googletest/test/gtest_output_test_golden_lin.txt | 134 +++++++++++++---------- googletest/test/gtest_unittest.cc | 106 ++++++++++-------- googletest/test/gtest_xml_output_unittest.py | 21 ++-- 4 files changed, 152 insertions(+), 118 deletions(-) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index fa170e7..2d1b5b9 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -1313,13 +1313,14 @@ AssertionResult EqFailure(const char* lhs_expression, const std::string& rhs_value, bool ignoring_case) { Message msg; - msg << " Expected: " << lhs_expression; + msg << "Expected equality of these values:"; + msg << "\n " << lhs_expression; if (lhs_value != lhs_expression) { - msg << "\n Which is: " << lhs_value; + msg << "\n Which is: " << lhs_value; } - msg << "\nTo be equal to: " << rhs_expression; + msg << "\n " << rhs_expression; if (rhs_value != rhs_expression) { - msg << "\n Which is: " << rhs_value; + msg << "\n Which is: " << rhs_value; } if (ignoring_case) { diff --git a/googletest/test/gtest_output_test_golden_lin.txt b/googletest/test/gtest_output_test_golden_lin.txt index 2223d56..677d9f4 100644 --- a/googletest/test/gtest_output_test_golden_lin.txt +++ b/googletest/test/gtest_output_test_golden_lin.txt @@ -5,8 +5,9 @@ Value of: false Actual: false Expected: true gtest_output_test_.cc:#: Failure - Expected: 2 -To be equal to: 3 +Expected equality of these values: + 2 + 3 [==========] Running 66 tests from 29 test cases. [----------] Global test environment set-up. FooEnvironment::SetUp() called. @@ -34,21 +35,24 @@ BarEnvironment::SetUp() called. [----------] 2 tests from NonfatalFailureTest [ RUN ] NonfatalFailureTest.EscapesStringOperands gtest_output_test_.cc:#: Failure - Expected: kGoldenString - Which is: "\"Line" -To be equal to: actual - Which is: "actual \"string\"" -gtest_output_test_.cc:#: Failure - Expected: golden - Which is: "\"Line" -To be equal to: actual - Which is: "actual \"string\"" +Expected equality of these values: + kGoldenString + Which is: "\"Line" + actual + Which is: "actual \"string\"" +gtest_output_test_.cc:#: Failure +Expected equality of these values: + golden + Which is: "\"Line" + actual + Which is: "actual \"string\"" [ FAILED ] NonfatalFailureTest.EscapesStringOperands [ RUN ] NonfatalFailureTest.DiffForLongStrings gtest_output_test_.cc:#: Failure - Expected: golden_str - Which is: "\"Line\0 1\"\nLine 2" -To be equal to: "Line 2" +Expected equality of these values: + golden_str + Which is: "\"Line\0 1\"\nLine 2" + "Line 2" With diff: @@ -1,2 @@ -\"Line\0 1\" @@ -59,16 +63,18 @@ With diff: [ RUN ] FatalFailureTest.FatalFailureInSubroutine (expecting a failure that x should be 1) gtest_output_test_.cc:#: Failure - Expected: 1 -To be equal to: x - Which is: 2 +Expected equality of these values: + 1 + x + Which is: 2 [ FAILED ] FatalFailureTest.FatalFailureInSubroutine [ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine (expecting a failure that x should be 1) gtest_output_test_.cc:#: Failure - Expected: 1 -To be equal to: x - Which is: 2 +Expected equality of these values: + 1 + x + Which is: 2 [ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine [ RUN ] FatalFailureTest.NonfatalFailureInSubroutine (expecting a failure on false) @@ -107,39 +113,44 @@ This failure is expected, and shouldn't have a trace. [ RUN ] SCOPED_TRACETest.WorksInLoop (expected to fail) gtest_output_test_.cc:#: Failure - Expected: 2 -To be equal to: n - Which is: 1 +Expected equality of these values: + 2 + n + Which is: 1 Google Test trace: gtest_output_test_.cc:#: i = 1 gtest_output_test_.cc:#: Failure - Expected: 1 -To be equal to: n - Which is: 2 +Expected equality of these values: + 1 + n + Which is: 2 Google Test trace: gtest_output_test_.cc:#: i = 2 [ FAILED ] SCOPED_TRACETest.WorksInLoop [ RUN ] SCOPED_TRACETest.WorksInSubroutine (expected to fail) gtest_output_test_.cc:#: Failure - Expected: 2 -To be equal to: n - Which is: 1 +Expected equality of these values: + 2 + n + Which is: 1 Google Test trace: gtest_output_test_.cc:#: n = 1 gtest_output_test_.cc:#: Failure - Expected: 1 -To be equal to: n - Which is: 2 +Expected equality of these values: + 1 + n + Which is: 2 Google Test trace: gtest_output_test_.cc:#: n = 2 [ FAILED ] SCOPED_TRACETest.WorksInSubroutine [ RUN ] SCOPED_TRACETest.CanBeNested (expected to fail) gtest_output_test_.cc:#: Failure - Expected: 1 -To be equal to: n - Which is: 2 +Expected equality of these values: + 1 + n + Which is: 2 Google Test trace: gtest_output_test_.cc:#: n = 2 gtest_output_test_.cc:#: @@ -437,9 +448,10 @@ Expected: 1 fatal failure [ OK ] TypedTest/0.Success [ RUN ] TypedTest/0.Failure gtest_output_test_.cc:#: Failure - Expected: 1 -To be equal to: TypeParam() - Which is: 0 +Expected equality of these values: + 1 + TypeParam() + Which is: 0 Expected failure [ FAILED ] TypedTest/0.Failure, where TypeParam = int [----------] 2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char @@ -447,10 +459,11 @@ Expected failure [ OK ] Unsigned/TypedTestP/0.Success [ RUN ] Unsigned/TypedTestP/0.Failure gtest_output_test_.cc:#: Failure - Expected: 1U - Which is: 1 -To be equal to: TypeParam() - Which is: '\0' +Expected equality of these values: + 1U + Which is: 1 + TypeParam() + Which is: '\0' Expected failure [ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char [----------] 2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int @@ -458,10 +471,11 @@ Expected failure [ OK ] Unsigned/TypedTestP/1.Success [ RUN ] Unsigned/TypedTestP/1.Failure gtest_output_test_.cc:#: Failure - Expected: 1U - Which is: 1 -To be equal to: TypeParam() - Which is: 0 +Expected equality of these values: + 1U + Which is: 1 + TypeParam() + Which is: 0 Expected failure [ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int [----------] 4 tests from ExpectFailureTest @@ -597,18 +611,20 @@ Expected non-fatal failure. [----------] 1 test from PrintingFailingParams/FailingParamTest [ RUN ] PrintingFailingParams/FailingParamTest.Fails/0 gtest_output_test_.cc:#: Failure - Expected: 1 -To be equal to: GetParam() - Which is: 2 +Expected equality of these values: + 1 + GetParam() + Which is: 2 [ FAILED ] PrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2 [----------] 2 tests from PrintingStrings/ParamTest [ RUN ] PrintingStrings/ParamTest.Success/a [ OK ] PrintingStrings/ParamTest.Success/a [ RUN ] PrintingStrings/ParamTest.Failure/a gtest_output_test_.cc:#: Failure - Expected: "b" -To be equal to: GetParam() - Which is: "a" +Expected equality of these values: + "b" + GetParam() + Which is: "a" Expected failure [ FAILED ] PrintingStrings/ParamTest.Failure/a, where GetParam() = "a" [----------] Global test environment tear-down @@ -678,16 +694,18 @@ Expected fatal failure. [ RUN ] FatalFailureTest.FatalFailureInSubroutine (expecting a failure that x should be 1) gtest_output_test_.cc:#: Failure - Expected: 1 -To be equal to: x - Which is: 2 +Expected equality of these values: + 1 + x + Which is: 2 [ FAILED ] FatalFailureTest.FatalFailureInSubroutine (? ms) [ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine (expecting a failure that x should be 1) gtest_output_test_.cc:#: Failure - Expected: 1 -To be equal to: x - Which is: 2 +Expected equality of these values: + 1 + x + Which is: 2 [ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms) [ RUN ] FatalFailureTest.NonfatalFailureInSubroutine (expecting a failure on false) diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 745c950..00d9f06 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -2429,8 +2429,9 @@ TEST(StringAssertionTest, ASSERT_STREQ) { const char p2[] = "good"; ASSERT_STREQ(p1, p2); - EXPECT_FATAL_FAILURE(ASSERT_STREQ("bad", "good"), - "Expected: \"bad\""); + EXPECT_FATAL_FAILURE( + ASSERT_STREQ("bad", "good"), + "Expected equality of these values:\n \"bad\"\n \"good\""); } // Tests ASSERT_STREQ with NULL arguments. @@ -3528,35 +3529,39 @@ TEST(AssertionTest, EqFailure) { EqFailure("foo", "bar", foo_val, bar_val, false) .failure_message()); EXPECT_STREQ( - " Expected: foo\n" - " Which is: 5\n" - "To be equal to: bar\n" - " Which is: 6", + "Expected equality of these values:\n" + " foo\n" + " Which is: 5\n" + " bar\n" + " Which is: 6", msg1.c_str()); const std::string msg2( EqFailure("foo", "6", foo_val, bar_val, false) .failure_message()); EXPECT_STREQ( - " Expected: foo\n" - " Which is: 5\n" - "To be equal to: 6", + "Expected equality of these values:\n" + " foo\n" + " Which is: 5\n" + " 6", msg2.c_str()); const std::string msg3( EqFailure("5", "bar", foo_val, bar_val, false) .failure_message()); EXPECT_STREQ( - " Expected: 5\n" - "To be equal to: bar\n" - " Which is: 6", + "Expected equality of these values:\n" + " 5\n" + " bar\n" + " Which is: 6", msg3.c_str()); const std::string msg4( EqFailure("5", "6", foo_val, bar_val, false).failure_message()); EXPECT_STREQ( - " Expected: 5\n" - "To be equal to: 6", + "Expected equality of these values:\n" + " 5\n" + " 6", msg4.c_str()); const std::string msg5( @@ -3564,10 +3569,11 @@ TEST(AssertionTest, EqFailure) { std::string("\"x\""), std::string("\"y\""), true).failure_message()); EXPECT_STREQ( - " Expected: foo\n" - " Which is: \"x\"\n" - "To be equal to: bar\n" - " Which is: \"y\"\n" + "Expected equality of these values:\n" + " foo\n" + " Which is: \"x\"\n" + " bar\n" + " Which is: \"y\"\n" "Ignoring case", msg5.c_str()); } @@ -3580,11 +3586,12 @@ TEST(AssertionTest, EqFailureWithDiff) { const std::string msg1( EqFailure("left", "right", left, right, false).failure_message()); EXPECT_STREQ( - " Expected: left\n" - " Which is: " + "Expected equality of these values:\n" + " left\n" + " Which is: " "1\\n2XXX\\n3\\n5\\n6\\n7\\n8\\n9\\n10\\n11\\n12XXX\\n13\\n14\\n15\n" - "To be equal to: right\n" - " Which is: 1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n11\\n12\\n13\\n14\n" + " right\n" + " Which is: 1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n11\\n12\\n13\\n14\n" "With diff:\n@@ -1,5 +1,6 @@\n 1\n-2XXX\n+2\n 3\n+4\n 5\n 6\n" "@@ -7,8 +8,6 @@\n 8\n 9\n-10\n 11\n-12XXX\n+12\n 13\n 14\n-15\n", msg1.c_str()); @@ -3679,9 +3686,10 @@ TEST(ExpectTest, ASSERT_EQ_Double) { TEST(AssertionTest, ASSERT_EQ) { ASSERT_EQ(5, 2 + 3); EXPECT_FATAL_FAILURE(ASSERT_EQ(5, 2*3), - " Expected: 5\n" - "To be equal to: 2*3\n" - " Which is: 6"); + "Expected equality of these values:\n" + " 5\n" + " 2*3\n" + " Which is: 6"); } // Tests ASSERT_EQ(NULL, pointer). @@ -3698,7 +3706,7 @@ TEST(AssertionTest, ASSERT_EQ_NULL) { // A failure. static int n = 0; EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n), - "To be equal to: &n\n"); + " &n\n Which is:"); } #endif // GTEST_CAN_COMPARE_NULL @@ -3714,7 +3722,7 @@ TEST(ExpectTest, ASSERT_EQ_0) { // A failure. EXPECT_FATAL_FAILURE(ASSERT_EQ(0, 5.6), - "Expected: 0"); + " 0\n 5.6"); } // Tests ASSERT_NE. @@ -3813,7 +3821,7 @@ void TestEq1(int x) { // Tests calling a test subroutine that's not part of a fixture. TEST(AssertionTest, NonFixtureSubroutine) { EXPECT_FATAL_FAILURE(TestEq1(2), - "To be equal to: x"); + "Which is: 2"); } // An uncopyable class. @@ -3862,7 +3870,8 @@ TEST(AssertionTest, AssertWorksWithUncopyableObject) { EXPECT_FATAL_FAILURE(TestAssertNonPositive(), "IsPositiveUncopyable(y) evaluates to false, where\ny evaluates to -1"); EXPECT_FATAL_FAILURE(TestAssertEqualsUncopyable(), - "Expected: x\n Which is: 5\nTo be equal to: y\n Which is: -1"); + "Expected equality of these values:\n" + " x\n Which is: 5\n y\n Which is: -1"); } // Tests that uncopyable objects can be used in expects. @@ -3874,7 +3883,8 @@ TEST(AssertionTest, ExpectWorksWithUncopyableObject) { "IsPositiveUncopyable(y) evaluates to false, where\ny evaluates to -1"); EXPECT_EQ(x, x); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(x, y), - "Expected: x\n Which is: 5\nTo be equal to: y\n Which is: -1"); + "Expected equality of these values:\n" + " x\n Which is: 5\n y\n Which is: -1"); } enum NamedEnum { @@ -3950,7 +3960,7 @@ TEST(AssertionTest, AnonymousEnum) { // ICE's in C++Builder. EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB), - "To be equal to: kCaseB"); + "kCaseB"); EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC), "Which is: 42"); # endif @@ -4390,9 +4400,10 @@ TEST(ExpectTest, ExpectFalseWithAssertionResult) { TEST(ExpectTest, EXPECT_EQ) { EXPECT_EQ(5, 2 + 3); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2*3), - " Expected: 5\n" - "To be equal to: 2*3\n" - " Which is: 6"); + "Expected equality of these values:\n" + " 5\n" + " 2*3\n" + " Which is: 6"); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(5, 2 - 3), "2 - 3"); } @@ -4423,7 +4434,7 @@ TEST(ExpectTest, EXPECT_EQ_NULL) { // A failure. int n = 0; EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n), - "To be equal to: &n\n"); + "&n\n"); } #endif // GTEST_CAN_COMPARE_NULL @@ -4439,7 +4450,7 @@ TEST(ExpectTest, EXPECT_EQ_0) { // A failure. EXPECT_NONFATAL_FAILURE(EXPECT_EQ(0, 5.6), - "Expected: 0"); + "Expected equality of these values:\n 0\n 5.6"); } // Tests EXPECT_NE. @@ -4539,7 +4550,7 @@ TEST(ExpectTest, EXPECT_ANY_THROW) { TEST(ExpectTest, ExpectPrecedence) { EXPECT_EQ(1 < 2, true); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(true, true && false), - "To be equal to: true && false"); + "true && false"); } @@ -4686,7 +4697,7 @@ TEST(EqAssertionTest, Bool) { EXPECT_FATAL_FAILURE({ bool false_value = false; ASSERT_EQ(false_value, true); - }, "To be equal to: true"); + }, "Which is: false"); } // Tests using int values in {EXPECT|ASSERT}_EQ. @@ -4720,10 +4731,11 @@ TEST(EqAssertionTest, WideChar) { EXPECT_EQ(L'b', L'b'); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(L'\0', L'x'), - " Expected: L'\0'\n" - " Which is: L'\0' (0, 0x0)\n" - "To be equal to: L'x'\n" - " Which is: L'x' (120, 0x78)"); + "Expected equality of these values:\n" + " L'\0'\n" + " Which is: L'\0' (0, 0x0)\n" + " L'x'\n" + " Which is: L'x' (120, 0x78)"); static wchar_t wchar; wchar = L'b'; @@ -4731,7 +4743,7 @@ TEST(EqAssertionTest, WideChar) { "wchar"); wchar = 0x8119; EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast(0x8120), wchar), - "To be equal to: wchar"); + "wchar"); } // Tests using ::std::string values in {EXPECT|ASSERT}_EQ. @@ -4760,8 +4772,8 @@ TEST(EqAssertionTest, StdString) { static ::std::string str3(str1); str3.at(2) = '\0'; EXPECT_FATAL_FAILURE(ASSERT_EQ(str1, str3), - "To be equal to: str3\n" - " Which is: \"A \\0 in the middle\""); + " str3\n" + " Which is: \"A \\0 in the middle\""); } #if GTEST_HAS_STD_WSTRING @@ -4881,7 +4893,7 @@ TEST(EqAssertionTest, CharPointer) { ASSERT_EQ(p1, p1); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2), - "To be equal to: p2"); + "p2"); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2), "p2"); EXPECT_FATAL_FAILURE(ASSERT_EQ(reinterpret_cast(0x1234), @@ -4903,7 +4915,7 @@ TEST(EqAssertionTest, WideCharPointer) { EXPECT_EQ(p0, p0); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2), - "To be equal to: p2"); + "p2"); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2), "p2"); void* pv3 = (void*)0x1234; // NOLINT diff --git a/googletest/test/gtest_xml_output_unittest.py b/googletest/test/gtest_xml_output_unittest.py index e940a5a..9f92f98 100755 --- a/googletest/test/gtest_xml_output_unittest.py +++ b/googletest/test/gtest_xml_output_unittest.py @@ -64,20 +64,23 @@ EXPECTED_NON_EMPTY_XML = """ - + - - + + -- cgit v0.12 From 9681b4c8e6aae36ac1d0ae0c4e99bdf013b41913 Mon Sep 17 00:00:00 2001 From: ly2048 <31530391+ly2048@users.noreply.github.com> Date: Thu, 14 Sep 2017 13:22:04 +0800 Subject: Add explicit `CMAKE_DEBUG_POSTFIX` option Enable generating different library name to be compatible with CMake's `FindGTest`. --- googletest/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index 8391dbd..b9a920b 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -27,6 +27,8 @@ option( "Build gtest with internal symbols hidden in shared libraries." OFF) +set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Generate debug library name with a postfix.") + # Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build(). include(cmake/hermetic_build.cmake OPTIONAL) -- cgit v0.12 From d4af64ca13173c76f6da1aa32dcda7dd3abeb522 Mon Sep 17 00:00:00 2001 From: Benjamin Kircher Date: Sat, 16 Sep 2017 11:51:36 +0200 Subject: Remove redundant declaration TempDir() function is declared twice, once in `internal/gtest-port.h` and a second time in `gtest.h`. Fixes a warning with GCC when -Wredundant-decls is given. --- googletest/include/gtest/internal/gtest-port.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 643beff..12bdb4c 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -2591,10 +2591,6 @@ std::string StringFromGTestEnv(const char* flag, const char* default_val); } // namespace internal -// Returns a path to temporary directory. -// Tries to determine an appropriate directory for the platform. -GTEST_API_ std::string TempDir(); - } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ -- cgit v0.12 From cf512a099cd59a05ff981db778d08ab3cf143969 Mon Sep 17 00:00:00 2001 From: "stkhapugin@chromium.org" Date: Tue, 19 Sep 2017 12:44:52 +0200 Subject: Swap reinterpret_cast for static_cast Swap reinterpret_cast for static_cast --- googletest/include/gtest/gtest-printers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 129fc68..282a2da 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -137,8 +137,8 @@ class TypeWithoutFormatter { public: // This default version is called when kTypeKind is kOtherType. static void PrintValue(const T& value, ::std::ostream* os) { - PrintBytesInObjectTo(reinterpret_cast( - reinterpret_cast(&value)), + PrintBytesInObjectTo(static_cast( + reinterpret_cast(&value)), sizeof(value), os); } }; -- cgit v0.12 From d30a37e743e45de88b85333756bb938d2f6eeecd Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 21 Sep 2017 10:54:14 -0400 Subject: Revert "Allow macros inside of parametrized test names." --- googletest/include/gtest/gtest-param-test.h | 15 +++++-------- googletest/include/gtest/gtest-param-test.h.pump | 9 +++----- googletest/test/gtest-param-test_test.cc | 28 ------------------------ 3 files changed, 9 insertions(+), 43 deletions(-) diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h index e01c3ff..038f9ba 100644 --- a/googletest/include/gtest/gtest-param-test.h +++ b/googletest/include/gtest/gtest-param-test.h @@ -1375,10 +1375,7 @@ internal::CartesianProductHolder10AddTestPattern(\ - GTEST_STRINGIFY_(test_case_name), \ - GTEST_STRINGIFY_(test_name), \ + #test_case_name, \ + #test_name, \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(\ test_case_name, test_name)>()); \ @@ -1415,11 +1412,11 @@ internal::CartesianProductHolder10, and return std::string. // // testing::PrintToStringParamName is a builtin test suffix generator that -// returns the value of testing::PrintToString(GetParam()). +// returns the value of testing::PrintToString(GetParam()). It does not work +// for std::string or C strings. // // Note: test names must be non-empty, unique, and may only contain ASCII -// alphanumeric characters or underscore. Because PrintToString adds quotes -// to std::string and C strings, it won't work for these types. +// alphanumeric characters or underscore. # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ ::testing::internal::ParamGenerator \ diff --git a/googletest/include/gtest/gtest-param-test.h.pump b/googletest/include/gtest/gtest-param-test.h.pump index 8ab18dd..3078d6d 100644 --- a/googletest/include/gtest/gtest-param-test.h.pump +++ b/googletest/include/gtest/gtest-param-test.h.pump @@ -441,10 +441,7 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine( ]] # endif // GTEST_HAS_COMBINE -// Use a macro to stringify the test (case) name, because direct stringification -// does not work if one of the arguments is itself a macro -// (https://gcc.gnu.org/onlinedocs/cpp/Stringification.html). -# define GTEST_STRINGIFY_(name) #name + # define TEST_P(test_case_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ @@ -459,8 +456,8 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine( #test_case_name, \ ::testing::internal::CodeLocation(\ __FILE__, __LINE__))->AddTestPattern(\ - GTEST_STRINGIFY_(test_case_name), \ - GTEST_STRINGIFY_(test_name), \ + #test_case_name, \ + #test_name, \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(\ test_case_name, test_name)>()); \ diff --git a/googletest/test/gtest-param-test_test.cc b/googletest/test/gtest-param-test_test.cc index 9d6f09f..d1b0644 100644 --- a/googletest/test/gtest-param-test_test.cc +++ b/googletest/test/gtest-param-test_test.cc @@ -809,34 +809,6 @@ TEST_P(NamingTest, TestsReportCorrectNamesAndParameters) { INSTANTIATE_TEST_CASE_P(ZeroToFiveSequence, NamingTest, Range(0, 5)); -// Tests that macros in test names are expanded correctly. -class MacroNamingTest : public TestWithParam {}; - -#define PREFIX_WITH_FOO(test_name) FOO_##test_name -#define PREFIX_WITH_MACRO(test_name) Macro##test_name - -TEST_P(PREFIX_WITH_MACRO(NamingTest), PREFIX_WITH_FOO(SomeTestName)) { - const ::testing::TestInfo* const test_info = - ::testing::UnitTest::GetInstance()->current_test_info(); - - EXPECT_STREQ("FortyTwo/MacroNamingTest", test_info->test_case_name()); - EXPECT_STREQ("FOO_SomeTestName", test_info->name()); -} - -INSTANTIATE_TEST_CASE_P(FortyTwo, MacroNamingTest, Values(42)); - -// Tests the same thing for non-parametrized tests. -class MacroNamingTestNonParametrized : public ::testing::Test {}; - -TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized), - PREFIX_WITH_FOO(SomeTestName)) { - const ::testing::TestInfo* const test_info = - ::testing::UnitTest::GetInstance()->current_test_info(); - - EXPECT_STREQ("MacroNamingTestNonParametrized", test_info->test_case_name()); - EXPECT_STREQ("FOO_SomeTestName", test_info->name()); -} - // Tests that user supplied custom parameter names are working correctly. // Runs the test with a builtin helper method which uses PrintToString, // as well as a custom function and custom functor to ensure all possible -- cgit v0.12 From b70cf1a663ad30f77ab9867095a87d3d5429450d Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 27 Sep 2017 13:31:13 +0100 Subject: Use gender-neutral pronouns in comments and docs --- googlemock/docs/CookBook.md | 2 +- googlemock/docs/FrequentlyAskedQuestions.md | 2 +- googlemock/include/gmock/gmock-spec-builders.h | 2 +- googlemock/src/gmock-internal-utils.cc | 2 +- googlemock/src/gmock-spec-builders.cc | 4 ++-- googlemock/test/gmock-cardinalities_test.cc | 2 +- googlemock/test/gmock-internal-utils_test.cc | 2 +- googlemock/test/gmock-spec-builders_test.cc | 2 +- googletest/docs/AdvancedGuide.md | 2 +- googletest/docs/FAQ.md | 4 ++-- googletest/include/gtest/internal/gtest-port.h | 2 +- googletest/src/gtest.cc | 2 +- googletest/test/gtest-death-test_test.cc | 2 +- googletest/test/gtest-filepath_test.cc | 2 +- googletest/test/gtest-options_test.cc | 2 +- googletest/test/gtest-port_test.cc | 2 +- googletest/test/gtest_color_test_.cc | 2 +- googletest/test/gtest_output_test_.cc | 2 +- googletest/test/gtest_repeat_test.cc | 2 +- googletest/test/gtest_unittest.cc | 2 +- 20 files changed, 22 insertions(+), 22 deletions(-) diff --git a/googlemock/docs/CookBook.md b/googlemock/docs/CookBook.md index 753c6dd..3d07e68 100644 --- a/googlemock/docs/CookBook.md +++ b/googlemock/docs/CookBook.md @@ -227,7 +227,7 @@ If a mock method has no `EXPECT_CALL` spec but is called, Google Mock will print a warning about the "uninteresting call". The rationale is: * New methods may be added to an interface after a test is written. We shouldn't fail a test just because a method it doesn't know about is called. - * However, this may also mean there's a bug in the test, so Google Mock shouldn't be silent either. If the user believes these calls are harmless, he can add an `EXPECT_CALL()` to suppress the warning. + * However, this may also mean there's a bug in the test, so Google Mock shouldn't be silent either. If the user believes these calls are harmless, they can add an `EXPECT_CALL()` to suppress the warning. However, sometimes you may want to suppress all "uninteresting call" warnings, while sometimes you may want the opposite, i.e. to treat all diff --git a/googlemock/docs/FrequentlyAskedQuestions.md b/googlemock/docs/FrequentlyAskedQuestions.md index 5eac83f..ccaa3d7 100644 --- a/googlemock/docs/FrequentlyAskedQuestions.md +++ b/googlemock/docs/FrequentlyAskedQuestions.md @@ -240,7 +240,7 @@ You cannot mock a variadic function (i.e. a function taking ellipsis The problem is that in general, there is _no way_ for a mock object to know how many arguments are passed to the variadic method, and what the arguments' types are. Only the _author of the base class_ knows -the protocol, and we cannot look into his head. +the protocol, and we cannot look into their head. Therefore, to mock such a function, the _user_ must teach the mock object how to figure out the number of arguments and their types. One diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h index 9680244..a8347bd 100644 --- a/googlemock/include/gmock/gmock-spec-builders.h +++ b/googlemock/include/gmock/gmock-spec-builders.h @@ -1774,7 +1774,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase { // There is no generally useful and implementable semantics of // copying a mock object, so copying a mock is usually a user error. // Thus we disallow copying function mockers. If the user really - // wants to copy a mock object, he should implement his own copy + // wants to copy a mock object, they should implement their own copy // operation, for example: // // class MockFoo : public Foo { diff --git a/googlemock/src/gmock-internal-utils.cc b/googlemock/src/gmock-internal-utils.cc index 6464abc..91bf3fd 100644 --- a/googlemock/src/gmock-internal-utils.cc +++ b/googlemock/src/gmock-internal-utils.cc @@ -71,7 +71,7 @@ GTEST_API_ string ConvertIdentifierNameToWords(const char* id_name) { } // This class reports Google Mock failures as Google Test failures. A -// user can define another class in a similar fashion if he intends to +// user can define another class in a similar fashion if they intend to // use Google Mock with a testing framework other than Google Test. class GoogleTestFailureReporter : public FailureReporterInterface { public: diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index 0eaaee7..fc4968b 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -353,10 +353,10 @@ UntypedFunctionMockerBase::UntypedInvokeWith(const void* const untyped_args) // the behavior of ReportUninterestingCall(). const bool need_to_report_uninteresting_call = // If the user allows this uninteresting call, we print it - // only when he wants informational messages. + // only when they want informational messages. reaction == kAllow ? LogIsVisible(kInfo) : // If the user wants this to be a warning, we print it only - // when he wants to see warnings. + // when they want to see warnings. reaction == kWarn ? LogIsVisible(kWarning) : // Otherwise, the user wants this to be an error, and we // should always print detailed information in the error. diff --git a/googlemock/test/gmock-cardinalities_test.cc b/googlemock/test/gmock-cardinalities_test.cc index 64815e5..04c792b 100644 --- a/googlemock/test/gmock-cardinalities_test.cc +++ b/googlemock/test/gmock-cardinalities_test.cc @@ -391,7 +391,7 @@ TEST(ExactlyTest, HasCorrectBounds) { EXPECT_EQ(3, c.ConservativeUpperBound()); } -// Tests that a user can make his own cardinality by implementing +// Tests that a user can make their own cardinality by implementing // CardinalityInterface and calling MakeCardinality(). class EvenCardinality : public CardinalityInterface { diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc index 9c2423e..72d9a85 100644 --- a/googlemock/test/gmock-internal-utils_test.cc +++ b/googlemock/test/gmock-internal-utils_test.cc @@ -49,7 +49,7 @@ // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in -// his code. +// their code. #define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index c649bfd..a7bf03e 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -2682,7 +2682,7 @@ TEST(SynchronizationTest, CanCallMockMethodInAction) { } // namespace -// Allows the user to define his own main and then invoke gmock_main +// Allows the user to define their own main and then invoke gmock_main // from it. This might be necessary on some platforms which require // specific setup and teardown. #if GMOCK_RENAME_MAIN diff --git a/googletest/docs/AdvancedGuide.md b/googletest/docs/AdvancedGuide.md index 1076496..e4dd94d 100644 --- a/googletest/docs/AdvancedGuide.md +++ b/googletest/docs/AdvancedGuide.md @@ -1263,7 +1263,7 @@ known as abstract tests. As an example of its application, when you are designing an interface you can write a standard suite of abstract tests (perhaps using a factory function as the test parameter) that all implementations of the interface are expected to pass. When -someone implements the interface, he can instantiate your suite to get +someone implements the interface, they can instantiate your suite to get all the interface-conformance tests for free. To define abstract tests, you should organize your code like this: diff --git a/googletest/docs/FAQ.md b/googletest/docs/FAQ.md index 76c2372..c39b625 100644 --- a/googletest/docs/FAQ.md +++ b/googletest/docs/FAQ.md @@ -102,9 +102,9 @@ Then every user of your machine can write tests without recompiling Google Test. This seemed like a good idea, but it has a -got-cha: every user needs to compile his tests using the _same_ compiler +got-cha: every user needs to compile their tests using the _same_ compiler flags used to compile the installed Google Test libraries; otherwise -he may run into undefined behaviors (i.e. the tests can behave +they may run into undefined behaviors (i.e. the tests can behave strangely and may even crash for no obvious reasons). Why? Because C++ has this thing called the One-Definition Rule: if diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 12bdb4c..5529ba5 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -741,7 +741,7 @@ using ::std::tuple_size; # define _TR1_FUNCTIONAL 1 # include # undef _TR1_FUNCTIONAL // Allows the user to #include - // if he chooses to. + // if they choose to. # else # include // NOLINT # endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 2d1b5b9..d77f676 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -137,7 +137,7 @@ // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in -// his code. +// their code. #define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ diff --git a/googletest/test/gtest-death-test_test.cc b/googletest/test/gtest-death-test_test.cc index 957fe38..85021e3 100644 --- a/googletest/test/gtest-death-test_test.cc +++ b/googletest/test/gtest-death-test_test.cc @@ -61,7 +61,7 @@ using testing::internal::AlwaysTrue; // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in -// his code. +// their code. # define GTEST_IMPLEMENTATION_ 1 # include "src/gtest-internal-inl.h" # undef GTEST_IMPLEMENTATION_ diff --git a/googletest/test/gtest-filepath_test.cc b/googletest/test/gtest-filepath_test.cc index da72986..22f4ed6 100644 --- a/googletest/test/gtest-filepath_test.cc +++ b/googletest/test/gtest-filepath_test.cc @@ -45,7 +45,7 @@ // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in -// his code. +// their code. #define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ diff --git a/googletest/test/gtest-options_test.cc b/googletest/test/gtest-options_test.cc index 5586dc3..88c6e9a 100644 --- a/googletest/test/gtest-options_test.cc +++ b/googletest/test/gtest-options_test.cc @@ -50,7 +50,7 @@ // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in -// his code. +// their code. #define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ diff --git a/googletest/test/gtest-port_test.cc b/googletest/test/gtest-port_test.cc index 1d25ee6..62ee11b 100644 --- a/googletest/test/gtest-port_test.cc +++ b/googletest/test/gtest-port_test.cc @@ -50,7 +50,7 @@ // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in -// his code. +// their code. #define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ diff --git a/googletest/test/gtest_color_test_.cc b/googletest/test/gtest_color_test_.cc index f61ebb8..672069c 100644 --- a/googletest/test/gtest_color_test_.cc +++ b/googletest/test/gtest_color_test_.cc @@ -41,7 +41,7 @@ // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in -// his code. +// their code. #define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc index 1070a9f..e5fa764 100644 --- a/googletest/test/gtest_output_test_.cc +++ b/googletest/test/gtest_output_test_.cc @@ -42,7 +42,7 @@ // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in -// his code. +// their code. #define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ diff --git a/googletest/test/gtest_repeat_test.cc b/googletest/test/gtest_repeat_test.cc index 481012a..165d202 100644 --- a/googletest/test/gtest_repeat_test.cc +++ b/googletest/test/gtest_repeat_test.cc @@ -39,7 +39,7 @@ // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in -// his code. +// their code. #define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 00d9f06..e4f743b 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -71,7 +71,7 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) { // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in -// his code. +// their code. #define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ -- cgit v0.12 From 4597ec587ca2a5e35cfb8e44257ce2340624b22a Mon Sep 17 00:00:00 2001 From: Joe Alam Date: Sat, 7 Oct 2017 23:34:53 +0100 Subject: Updated README with information about C runtime dynamic/static linking issues in Windows --- googletest/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/googletest/README.md b/googletest/README.md index 0a3474c..0f6d6d5 100644 --- a/googletest/README.md +++ b/googletest/README.md @@ -182,6 +182,17 @@ technique is discussed in more detail in which also contains a link to a fully generalized implementation of the technique. +##### Visual Studio Dynamic vs Static Runtimes ##### + +By default, new Visual Studio projects link the C runtimes dynamically +but Google Test links them statically. +This will generate an error that looks something like the following: + gtest.lib(gtest-all.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj + +Google Test already has a CMake option for this: `gtest_force_shared_crt` + +Enabling this option will make gtest link the runtimes dynamically too, +and match the project in which it is included. ### Legacy Build Scripts ### -- cgit v0.12 From ecb1c3ddb6cf7d7df10bfbafdd374ca3d412992b Mon Sep 17 00:00:00 2001 From: Dariusz Ostolski Date: Sat, 14 Oct 2017 18:33:19 +0200 Subject: #1282: Doc typo fix --- googlemock/docs/CheatSheet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemock/docs/CheatSheet.md b/googlemock/docs/CheatSheet.md index c94c2da..c6367fd 100644 --- a/googlemock/docs/CheatSheet.md +++ b/googlemock/docs/CheatSheet.md @@ -65,7 +65,7 @@ can specify it by appending `_WITH_CALLTYPE` to any of the macros described in the previous two sections and supplying the calling convention as the first argument to the macro. For example, ``` - MOCK_METHOD_1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int n)); + MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int n)); MOCK_CONST_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, Bar, int(double x, double y)); ``` where `STDMETHODCALLTYPE` is defined by `` on Windows. -- cgit v0.12 From dfed97a69ac3ec28c92a0b82f78326dd4af9c0ff Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Wed, 18 Oct 2017 10:40:00 -0400 Subject: Workaround for Travis issue https://github.com/travis-ci/travis-ci/issues/8552 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 418720f..32349c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,8 @@ addons: os: - linux - osx + before_install: + - brew update language: cpp cache: ccache before_cache: -- cgit v0.12 From 34aaf58c8b1b324a8c2b62069ee412c3a29e056b Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Wed, 18 Oct 2017 10:42:33 -0400 Subject: =?UTF-8?q?Revert=20"Workaround=20for=20Travis=20issue=20https://g?= =?UTF-8?q?ithub.com/travis-ci/travis-ci/is=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 32349c5..418720f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,8 +31,6 @@ addons: os: - linux - osx - before_install: - - brew update language: cpp cache: ccache before_cache: -- cgit v0.12 From 54c2648bff0e5e26ff1f3462b3d610bb1f2be959 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Wed, 18 Oct 2017 16:18:47 -0400 Subject: Workaround for Travis issue https://goo.gl/d5eV8o --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 32349c5..68acbd3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ install: # /usr/bin/clang is 3.4, lets override with modern one. - if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; ln -sf /usr/bin/ccache /$HOME/bin/$CXX; ln -sf /usr/bin/ccache /$HOME/bin/$CC; fi # ccache on OS X needs installation first -- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install ccache; export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi +- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install ccache; export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi # reset ccache statistics - ccache --zero-stats - echo ${PATH} @@ -31,8 +31,6 @@ addons: os: - linux - osx - before_install: - - brew update language: cpp cache: ccache before_cache: -- cgit v0.12 From 1beff241c359fb8c98c98a661142e5b614eceb64 Mon Sep 17 00:00:00 2001 From: Manoj Gupta Date: Tue, 17 Oct 2017 11:01:39 -0700 Subject: googletest: Add GTEST_API_ attribute to ThreadLocal class. ThreadLocal class needs to be have default visibility. Root cause is gtest uses typeinfo for the ThreadLocal class. The problem manifests When gtest/gmock are built as a shared library with libc++. When a class is used in typeinfo, it must have default visibility. There is an explanation about typeinfo and visibility here: https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/CppRuntimeEnv/Articles/SymbolVisibility.html When libc++ is used with gtest in shared library mode, any tests that are compiled with -fvisibility=hidden and exercise the macro EXPECT_CALL, it results in an abort like: [ FATAL ] /usr/include/gtest/internal/gtest-port.h:1394:: Condition typeid(*base) == typeid(Derived) failed. This is because the typeinfo for ThreadLocal class is not visible. Therefore, linker failed to match it to the shared library symbol, creating a new symbol instead. This fixes https://github.com/google/googletest/issues/1207. --- googletest/include/gtest/internal/gtest-port.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 5529ba5..5e13159 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -2061,7 +2061,7 @@ extern "C" inline void DeleteThreadLocalValue(void* value_holder) { // Implements thread-local storage on pthreads-based systems. template -class ThreadLocal { +class GTEST_API_ ThreadLocal { public: ThreadLocal() : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {} @@ -2193,7 +2193,7 @@ class GTestMutexLock { typedef GTestMutexLock MutexLock; template -class ThreadLocal { +class GTEST_API_ ThreadLocal { public: ThreadLocal() : value_() {} explicit ThreadLocal(const T& value) : value_(value) {} -- cgit v0.12 From 77380cddf77133b98a16b5427ac732648233de29 Mon Sep 17 00:00:00 2001 From: Arkadiy Shapkin Date: Wed, 3 May 2017 13:30:11 +0300 Subject: Enable C++11 features for VS2015 and VS2017 --- googletest/include/gtest/internal/gtest-port.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 5529ba5..331483e 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -325,7 +325,7 @@ // -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a // value for __cplusplus, and recent versions of clang, gcc, and // probably other compilers set that too in C++11 mode. -# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L +# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L || _MSC_VER >= 1900 // Compiling in at least C++11 mode. # define GTEST_LANG_CXX11 1 # else @@ -357,12 +357,16 @@ #if GTEST_STDLIB_CXX11 # define GTEST_HAS_STD_BEGIN_AND_END_ 1 # define GTEST_HAS_STD_FORWARD_LIST_ 1 -# define GTEST_HAS_STD_FUNCTION_ 1 +# if !defined(_MSC_VER) || (_MSC_FULL_VER >= 190023824) // works only with VS2015U2 and better +# define GTEST_HAS_STD_FUNCTION_ 1 +# endif # define GTEST_HAS_STD_INITIALIZER_LIST_ 1 # define GTEST_HAS_STD_MOVE_ 1 # define GTEST_HAS_STD_SHARED_PTR_ 1 # define GTEST_HAS_STD_TYPE_TRAITS_ 1 # define GTEST_HAS_STD_UNIQUE_PTR_ 1 +# define GTEST_HAS_UNORDERED_MAP_ 1 +# define GTEST_HAS_UNORDERED_SET_ 1 #endif // C++11 specifies that provides std::tuple. @@ -660,7 +664,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // support TR1 tuple. libc++ only provides std::tuple, in C++11 mode, // and it can be used with some compilers that define __GNUC__. # if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \ - && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600 + && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) \ + || (_MSC_VER >= 1600 && _MSC_VER < 1900) # define GTEST_ENV_HAS_TR1_TUPLE_ 1 # endif -- cgit v0.12 From 2641b021fc2ab12896cf868d90f19936ef4b4696 Mon Sep 17 00:00:00 2001 From: Arkadiy Shapkin Date: Wed, 3 May 2017 13:40:33 +0300 Subject: Fix tests with VS2015 and VS2017 --- .gitignore | 14 ++++++- googlemock/test/gmock-generated-matchers_test.cc | 8 ++-- googlemock/test/gmock-matchers_test.cc | 5 +++ googletest/cmake/internal_utils.cmake | 8 ++-- googletest/test/gtest-printers_test.cc | 51 +++++++++++++++++++----- googletest/test/gtest_catch_exceptions_test_.cc | 2 +- 6 files changed, 68 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 8f89b80..4cea432 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,16 @@ bazel-googletest bazel-out bazel-testlogs # python -*.pyc \ No newline at end of file +*.pyc + +# Visual Studio files +*.sdf +*.opensdf +*.VC.opendb +*.suo +*.user +_ReSharper.Caches/ +Win32-Debug/ +Win32-Release/ +x64-Debug/ +x64-Release/ diff --git a/googlemock/test/gmock-generated-matchers_test.cc b/googlemock/test/gmock-generated-matchers_test.cc index 8234858..6cba726 100644 --- a/googlemock/test/gmock-generated-matchers_test.cc +++ b/googlemock/test/gmock-generated-matchers_test.cc @@ -120,7 +120,7 @@ TEST(ArgsTest, AcceptsOneTemplateArg) { } TEST(ArgsTest, AcceptsTwoTemplateArgs) { - const tuple t(4, 5, 6L); // NOLINT + const tuple t(static_cast(4), 5, 6L); // NOLINT EXPECT_THAT(t, (Args<0, 1>(Lt()))); EXPECT_THAT(t, (Args<1, 2>(Lt()))); @@ -128,13 +128,13 @@ TEST(ArgsTest, AcceptsTwoTemplateArgs) { } TEST(ArgsTest, AcceptsRepeatedTemplateArgs) { - const tuple t(4, 5, 6L); // NOLINT + const tuple t(static_cast(4), 5, 6L); // NOLINT EXPECT_THAT(t, (Args<0, 0>(Eq()))); EXPECT_THAT(t, Not(Args<1, 1>(Ne()))); } TEST(ArgsTest, AcceptsDecreasingTemplateArgs) { - const tuple t(4, 5, 6L); // NOLINT + const tuple t(static_cast(4), 5, 6L); // NOLINT EXPECT_THAT(t, (Args<2, 0>(Gt()))); EXPECT_THAT(t, Not(Args<2, 1>(Lt()))); } @@ -159,7 +159,7 @@ TEST(ArgsTest, AcceptsMoreTemplateArgsThanArityOfOriginalTuple) { } TEST(ArgsTest, CanBeNested) { - const tuple t(4, 5, 6L, 6); // NOLINT + const tuple t(static_cast(4), 5, 6L, 6); // NOLINT EXPECT_THAT(t, (Args<1, 2, 3>(Args<1, 2>(Eq())))); EXPECT_THAT(t, (Args<0, 1, 3>(Args<0, 2>(Lt())))); } diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index fc86748..207c6fd 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -58,6 +58,11 @@ # include // NOLINT #endif +// Disable MSVC2015 warning for std::pair: "decorated name length exceeded, name was truncated". +#if defined(_MSC_VER) && (_MSC_VER == 1900) +# pragma warning(disable:4503) +#endif + namespace testing { namespace internal { diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 9915c11..c54bc94 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -87,10 +87,6 @@ macro(config_compiler_and_linker) # http://stackoverflow.com/questions/3232669 explains the issue. set(cxx_base_flags "${cxx_base_flags} -wd4702") endif() - if (NOT (MSVC_VERSION GREATER 1900)) # 1900 is Visual Studio 2015 - # BigObj required for tests. - set(cxx_base_flags "${cxx_base_flags} -bigobj") - endif() set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32") set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN") @@ -187,6 +183,10 @@ endfunction() # is built from the given source files with the given compiler flags. function(cxx_executable_with_flags name cxx_flags libs) add_executable(${name} ${ARGN}) + if (MSVC AND (NOT (MSVC_VERSION LESS 1700))) # 1700 is Visual Studio 2012. + # BigObj required for tests. + set(cxx_flags "${cxx_flags} -bigobj") + endif() if (cxx_flags) set_target_properties(${name} PROPERTIES diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc index 487d3cb..2a6c017 100644 --- a/googletest/test/gtest-printers_test.cc +++ b/googletest/test/gtest-printers_test.cc @@ -51,10 +51,15 @@ #include "gtest/gtest.h" // hash_map and hash_set are available under Visual C++, or on Linux. -#if GTEST_HAS_HASH_MAP_ +#if GTEST_HAS_UNORDERED_MAP_ +# include // NOLINT +#elif GTEST_HAS_HASH_MAP_ # include // NOLINT #endif // GTEST_HAS_HASH_MAP_ -#if GTEST_HAS_HASH_SET_ + +#if GTEST_HAS_UNORDERED_SET_ +# include // NOLINT +#elif GTEST_HAS_HASH_SET_ # include // NOLINT #endif // GTEST_HAS_HASH_SET_ @@ -239,21 +244,47 @@ using ::testing::internal::UniversalTersePrintTupleFieldsToStrings; #endif using ::testing::internal::string; -#if GTEST_HAS_HASH_MAP_ // The hash_* classes are not part of the C++ standard. STLport // defines them in namespace std. MSVC defines them in ::stdext. GCC // defines them in ::. +#if GTEST_HAS_UNORDERED_MAP_ + +#define GTEST_HAS_HASH_MAP_ 1 +template +using hash_map = ::std::unordered_map; +template +using hash_multimap = ::std::unordered_multimap; + +#elif GTEST_HAS_HASH_MAP_ + #ifdef _STLP_HASH_MAP // We got from STLport. using ::std::hash_map; -using ::std::hash_set; using ::std::hash_multimap; -using ::std::hash_multiset; #elif _MSC_VER using ::stdext::hash_map; -using ::stdext::hash_set; using ::stdext::hash_multimap; +#endif + +#endif + +#if GTEST_HAS_UNORDERED_SET_ + +#define GTEST_HAS_HASH_SET_ 1 +template +using hash_set = ::std::unordered_set; +template +using hash_multiset = ::std::unordered_multiset; + +#elif GTEST_HAS_HASH_SET_ + +#ifdef _STLP_HASH_MAP // We got from STLport. +using ::std::hash_set; +using ::std::hash_multiset; +#elif _MSC_VER +using ::stdext::hash_set; using ::stdext::hash_multiset; #endif + #endif // Prints a value to a string using the universal value printer. This @@ -1061,8 +1092,8 @@ TEST(PrintTr1TupleTest, VariousSizes) { ::std::tr1::tuple - t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_(NULL), - "10"); + t10(false, 'a', static_cast(3), 4, 5, 1.5F, -2.5, str, + ImplicitCast_(NULL), "10"); EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + " pointing to \"8\", NULL, \"10\")", Print(t10)); @@ -1121,8 +1152,8 @@ TEST(PrintStdTupleTest, VariousSizes) { ::std::tuple - t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_(NULL), - "10"); + t10(false, 'a', static_cast(3), 4, 5, 1.5F, -2.5, str, + ImplicitCast_(NULL), "10"); EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + " pointing to \"8\", NULL, \"10\")", Print(t10)); diff --git a/googletest/test/gtest_catch_exceptions_test_.cc b/googletest/test/gtest_catch_exceptions_test_.cc index b42637e..c6d953c 100644 --- a/googletest/test/gtest_catch_exceptions_test_.cc +++ b/googletest/test/gtest_catch_exceptions_test_.cc @@ -138,7 +138,7 @@ TEST_F(CxxExceptionInConstructorTest, ThrowsExceptionInConstructor) { } // Exceptions in destructors are not supported in C++11. -#if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L && _MSC_VER < 1900 +#if !GTEST_LANG_CXX11 class CxxExceptionInDestructorTest : public Test { public: static void TearDownTestCase() { -- cgit v0.12 From 840c711e7bd7240b3f451821473c759ad3578412 Mon Sep 17 00:00:00 2001 From: Arkady Shapkin Date: Thu, 8 Jun 2017 02:28:17 +0300 Subject: Fix gmock tests when std::unary_function unavailable --- googlemock/test/gmock-matchers_test.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 207c6fd..4beaec4 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -3936,8 +3936,11 @@ TEST(ResultOfTest, WorksForFunctionReferences) { // Tests that ResultOf(f, ...) compiles and works as expected when f is a // function object. -struct Functor : public ::std::unary_function { - result_type operator()(argument_type input) const { +struct Functor { + typedef std::string result_type; + typedef int argument_type; + + std::string operator()(int input) const { return IntToStringFunction(input); } }; -- cgit v0.12 From 20e2de7d8bba9f3735c9a67b000f04853927a0f8 Mon Sep 17 00:00:00 2001 From: Romain Geissler Date: Fri, 21 Oct 2016 17:42:48 +0200 Subject: Remove gcc 6 misleading indentations. --- .../include/gmock/gmock-generated-matchers.h | 36 ++++++++++++++-------- .../include/gmock/gmock-generated-matchers.h.pump | 3 +- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/googlemock/include/gmock/gmock-generated-matchers.h b/googlemock/include/gmock/gmock-generated-matchers.h index 525f8a7..1655bcd 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h +++ b/googlemock/include/gmock/gmock-generated-matchers.h @@ -1376,7 +1376,8 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { // ================ // // To learn more about using these macros, please search for 'MATCHER' -// on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md +// on https://github.com/google/googletest/blob/master/googlemock/docs/ +// CookBook.md #define MATCHER(name, description)\ class name##Matcher {\ @@ -1397,8 +1398,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ @@ -1446,8 +1448,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ @@ -1499,8 +1502,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ @@ -1557,8 +1561,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ @@ -1620,8 +1625,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ @@ -1691,8 +1697,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ @@ -1765,8 +1772,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ @@ -1843,8 +1851,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ @@ -1928,8 +1937,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ @@ -2019,8 +2029,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ @@ -2115,8 +2126,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index f91b1ea..25d2da9 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -639,8 +639,9 @@ $var param_field_decls2 = [[$for j private:\ ::testing::internal::string FormatDescription(bool negation) const {\ const ::testing::internal::string gmock_description = (description);\ - if (!gmock_description.empty())\ + if (!gmock_description.empty()) {\ return gmock_description;\ + }\ return ::testing::internal::FormatMatcherDescription(\ negation, #name, \ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ -- cgit v0.12 From b153bfd8f50385c2fbe714e967ae503e5cd85a9a Mon Sep 17 00:00:00 2001 From: Arkady Shapkin Date: Wed, 25 Oct 2017 18:37:57 +0300 Subject: Enable CI for VS2017 --- appveyor.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index f129d7c..4e8d6f6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,6 +4,14 @@ os: Visual Studio 2015 environment: matrix: + - compiler: msvc-15-seh + generator: "Visual Studio 15 2017" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + + - compiler: msvc-15-seh + generator: "Visual Studio 15 2017 Win64" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + - compiler: msvc-14-seh generator: "Visual Studio 14 2015" -- cgit v0.12 From 1ae4096b9c5de4429663e6b0c09bf00e5fb46b16 Mon Sep 17 00:00:00 2001 From: Bryan Zimmerman Date: Fri, 27 Oct 2017 14:01:16 -0400 Subject: fix for VS2017 deprecation of ::tr1::tuple change static_cast to ImplicitCast_ for consitency fixes for building with path names containing spaces --- googlemock/CMakeLists.txt | 12 +++++++----- googlemock/test/gmock-generated-matchers_test.cc | 9 +++++---- googletest/CMakeLists.txt | 18 ++++++++++-------- googletest/cmake/internal_utils.cmake | 3 ++- googletest/include/gtest/internal/gtest-port.h | 5 ++++- googletest/test/gtest-printers_test.cc | 6 +++--- 6 files changed, 31 insertions(+), 22 deletions(-) diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt index 724fdd5..2051f15 100644 --- a/googlemock/CMakeLists.txt +++ b/googlemock/CMakeLists.txt @@ -74,6 +74,8 @@ include_directories("${gmock_SOURCE_DIR}/include" # <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple. # VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10 # VS 2013 12 1800 std::tr1::tuple +# VS 2015 14 1900 std::tuple +# VS 2017 15 1910 std::tuple if (MSVC AND MSVC_VERSION EQUAL 1700) add_definitions(/D _VARIADIC_MAX=10) endif() @@ -110,11 +112,11 @@ endif() # Install rules if(INSTALL_GMOCK) install(TARGETS gmock gmock_main - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install(DIRECTORY ${gmock_SOURCE_DIR}/include/gmock - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install(DIRECTORY "${gmock_SOURCE_DIR}/include/gmock" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") # configure and install pkgconfig files configure_file( diff --git a/googlemock/test/gmock-generated-matchers_test.cc b/googlemock/test/gmock-generated-matchers_test.cc index 6cba726..9eb4b25 100644 --- a/googlemock/test/gmock-generated-matchers_test.cc +++ b/googlemock/test/gmock-generated-matchers_test.cc @@ -64,6 +64,7 @@ using testing::ElementsAreArray; using testing::Eq; using testing::Ge; using testing::Gt; +using testing::internal::ImplicitCast_; using testing::Le; using testing::Lt; using testing::MakeMatcher; @@ -120,7 +121,7 @@ TEST(ArgsTest, AcceptsOneTemplateArg) { } TEST(ArgsTest, AcceptsTwoTemplateArgs) { - const tuple t(static_cast(4), 5, 6L); // NOLINT + const tuple t(ImplicitCast_(4), 5, 6L); // NOLINT EXPECT_THAT(t, (Args<0, 1>(Lt()))); EXPECT_THAT(t, (Args<1, 2>(Lt()))); @@ -128,13 +129,13 @@ TEST(ArgsTest, AcceptsTwoTemplateArgs) { } TEST(ArgsTest, AcceptsRepeatedTemplateArgs) { - const tuple t(static_cast(4), 5, 6L); // NOLINT + const tuple t(ImplicitCast_(4), 5, 6L); // NOLINT EXPECT_THAT(t, (Args<0, 0>(Eq()))); EXPECT_THAT(t, Not(Args<1, 1>(Ne()))); } TEST(ArgsTest, AcceptsDecreasingTemplateArgs) { - const tuple t(static_cast(4), 5, 6L); // NOLINT + const tuple t(ImplicitCast_(4), 5, 6L); // NOLINT EXPECT_THAT(t, (Args<2, 0>(Gt()))); EXPECT_THAT(t, Not(Args<2, 1>(Lt()))); } @@ -159,7 +160,7 @@ TEST(ArgsTest, AcceptsMoreTemplateArgsThanArityOfOriginalTuple) { } TEST(ArgsTest, CanBeNested) { - const tuple t(static_cast(4), 5, 6L, 6); // NOLINT + const tuple t(ImplicitCast_(4), 5, 6L, 6); // NOLINT EXPECT_THAT(t, (Args<1, 2, 3>(Args<1, 2>(Eq())))); EXPECT_THAT(t, (Args<0, 1, 3>(Args<0, 2>(Lt())))); } diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index b9a920b..8d4ab40 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -74,8 +74,8 @@ config_compiler_and_linker() # Defined in internal_utils.cmake. # Where Google Test's .h files can be found. include_directories( - ${gtest_SOURCE_DIR}/include - ${gtest_SOURCE_DIR}) + "${gtest_SOURCE_DIR}/include" + "${gtest_SOURCE_DIR}") # Summary of tuple support for Microsoft Visual Studio: # Compiler version(MS) version(cmake) Support @@ -83,10 +83,12 @@ include_directories( # <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple. # VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10 # VS 2013 12 1800 std::tr1::tuple +# VS 2015 14 1900 std::tuple +# VS 2017 15 1910 std::tuple if (MSVC AND MSVC_VERSION EQUAL 1700) add_definitions(/D _VARIADIC_MAX=10) endif() - + ######################################################################## # # Defines the gtest & gtest_main libraries. User tests should link @@ -112,11 +114,11 @@ endif() # Install rules if(INSTALL_GTEST) install(TARGETS gtest gtest_main - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install(DIRECTORY "${gtest_SOURCE_DIR}/include/gtest" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") # configure and install pkgconfig files configure_file( diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index c54bc94..d1f81e6 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -62,7 +62,8 @@ macro(config_compiler_and_linker) if (MSVC) # Newlines inside flags variables break CMake's NMake generator. # TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds. - set(cxx_base_flags "-GS -W4 -WX -wd4251 -wd4275 -nologo -J -Zi") + # -J does not set path correctly for pdb with spaces + set(cxx_base_flags "-GS -W4 -WX -wd4251 -wd4275 -nologo -Zi") if (MSVC_VERSION LESS 1400) # 1400 is Visual Studio 2005 # Suppress spurious warnings MSVC 7.1 sometimes issues. # Forcing value to bool. diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 0c36007..55f9237 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -642,8 +642,11 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) // STLport, provided with the Android NDK, has neither or . # define GTEST_HAS_TR1_TUPLE 0 +# elif _MSC_VER >= 1910 + // VS2017 deprecated ::tr1::tuple +# define GTEST_HAS_TR1_TUPLE 0 # else -// The user didn't tell us not to do it, so we assume it's OK. + // The user didn't tell us not to do it, so we assume it's OK. # define GTEST_HAS_TR1_TUPLE 1 # endif #endif // GTEST_HAS_TR1_TUPLE diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc index 2a6c017..d922ba6 100644 --- a/googletest/test/gtest-printers_test.cc +++ b/googletest/test/gtest-printers_test.cc @@ -1092,8 +1092,8 @@ TEST(PrintTr1TupleTest, VariousSizes) { ::std::tr1::tuple - t10(false, 'a', static_cast(3), 4, 5, 1.5F, -2.5, str, - ImplicitCast_(NULL), "10"); + t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_(NULL), + "10"); EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + " pointing to \"8\", NULL, \"10\")", Print(t10)); @@ -1152,7 +1152,7 @@ TEST(PrintStdTupleTest, VariousSizes) { ::std::tuple - t10(false, 'a', static_cast(3), 4, 5, 1.5F, -2.5, str, + t10(false, 'a', ImplicitCast_(3), 4, 5, 1.5F, -2.5, str, ImplicitCast_(NULL), "10"); EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + " pointing to \"8\", NULL, \"10\")", -- cgit v0.12 From 8866af0386d73cddec01918f9448dd8bfebe4452 Mon Sep 17 00:00:00 2001 From: Herbert Thielen Date: Sun, 29 Oct 2017 17:12:00 +0100 Subject: remove markdown stars (bold) from code examples --- googletest/docs/FAQ.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/googletest/docs/FAQ.md b/googletest/docs/FAQ.md index c39b625..1a216a1 100644 --- a/googletest/docs/FAQ.md +++ b/googletest/docs/FAQ.md @@ -494,7 +494,7 @@ EXPECT_PRED1(IsPositive, 5); However, this will work: ``` cpp -EXPECT_PRED1(*static_cast*(IsPositive), 5); +EXPECT_PRED1(static_cast(IsPositive), 5); ``` (The stuff inside the angled brackets for the `static_cast` operator is the @@ -512,14 +512,14 @@ bool IsNegative(T x) { you can use it in a predicate assertion like this: ``` cpp -ASSERT_PRED1(IsNegative**, -5); +ASSERT_PRED1(IsNegative, -5); ``` Things are more interesting if your template has more than one parameters. The following won't compile: ``` cpp -ASSERT_PRED2(*GreaterThan*, 5, 0); +ASSERT_PRED2(GreaterThan, 5, 0); ``` @@ -528,7 +528,7 @@ which is one more than expected. The workaround is to wrap the predicate function in parentheses: ``` cpp -ASSERT_PRED2(*(GreaterThan)*, 5, 0); +ASSERT_PRED2((GreaterThan), 5, 0); ``` -- cgit v0.12 From 82447f23be9474bee8d883128b3f93dde9697334 Mon Sep 17 00:00:00 2001 From: whame Date: Tue, 7 Nov 2017 15:22:50 +0100 Subject: Fixes issue #826 by treating MinGW as "non-Windows" when determining colored output --- googletest/src/gtest.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index d77f676..749e829 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -2884,7 +2884,7 @@ enum GTestColor { }; #if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \ - !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT + !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW // Returns the character attribute for the given color. WORD GetColorAttribute(GTestColor color) { @@ -2943,7 +2943,7 @@ bool ShouldUseColor(bool stdout_is_tty) { const char* const gtest_color = GTEST_FLAG(color).c_str(); if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) { -#if GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW // On Windows the TERM variable is usually not set, but the // console there does support colors. return stdout_is_tty; @@ -3001,7 +3001,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) { } #if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \ - !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT + !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); // Gets the current text color. -- cgit v0.12 From a7269e24acaa3fe301c1fc34a56a1012a45f77b9 Mon Sep 17 00:00:00 2001 From: Bryan Zimmerman Date: Wed, 22 Nov 2017 09:40:48 -0500 Subject: replaced back accidently removed static_cast with consistent ImplicitCast_ --- googletest/test/gtest-printers_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc index d922ba6..a48489c 100644 --- a/googletest/test/gtest-printers_test.cc +++ b/googletest/test/gtest-printers_test.cc @@ -1092,7 +1092,7 @@ TEST(PrintTr1TupleTest, VariousSizes) { ::std::tr1::tuple - t10(false, 'a', 3, 4, 5, 1.5F, -2.5, str, ImplicitCast_(NULL), + t10(false, 'a', ImplicitCast_(3), 4, 5, 1.5F, -2.5, str, ImplicitCast_(NULL), "10"); EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + " pointing to \"8\", NULL, \"10\")", -- cgit v0.12 From f46bd00e369ea9948e485ae8f65bef658637dc61 Mon Sep 17 00:00:00 2001 From: Sam Lunt Date: Mon, 27 Nov 2017 17:07:56 -0600 Subject: make includes system --- googlemock/CMakeLists.txt | 4 ++-- googletest/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt index 724fdd5..a4e98af 100644 --- a/googlemock/CMakeLists.txt +++ b/googlemock/CMakeLists.txt @@ -101,8 +101,8 @@ cxx_library(gmock_main # to the targets for when we are part of a parent build (ie being pulled # in via add_subdirectory() rather than being a standalone build). if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") - target_include_directories(gmock INTERFACE "${gmock_SOURCE_DIR}/include") - target_include_directories(gmock_main INTERFACE "${gmock_SOURCE_DIR}/include") + target_include_directories(gmock SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") + target_include_directories(gmock_main SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") endif() ######################################################################## diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index b9a920b..f94d939 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -103,8 +103,8 @@ target_link_libraries(gtest_main gtest) # to the targets for when we are part of a parent build (ie being pulled # in via add_subdirectory() rather than being a standalone build). if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") - target_include_directories(gtest INTERFACE "${gtest_SOURCE_DIR}/include") - target_include_directories(gtest_main INTERFACE "${gtest_SOURCE_DIR}/include") + target_include_directories(gtest SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include") + target_include_directories(gtest_main SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include") endif() ######################################################################## -- cgit v0.12 From aea8580ecf448bc9d783181996139cae60ce44c9 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Sun, 3 Dec 2017 14:07:35 -0500 Subject: Run autoconf from top-level directory. This is part (hopefully all) of the fixes for #776. The top-level configure.ac configures googletest first and then googlemock. With this changes it is possible to embed googletest into another project that uses autoconf. For an example (though it is WIP), see the commits (and soon PR) referenced from google/protobuf#236. --- .gitignore | 16 +++++++++ Makefile.am | 14 ++++++++ configure.ac | 16 +++++++++ googlemock/configure.ac | 2 +- googletest/Makefile.am | 89 ++++++++++++++++++++++++++++++++----------------- 5 files changed, 106 insertions(+), 31 deletions(-) create mode 100644 Makefile.am create mode 100644 configure.ac diff --git a/.gitignore b/.gitignore index 4cea432..b294d3b 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,19 @@ Win32-Debug/ Win32-Release/ x64-Debug/ x64-Release/ + +# Ignore autoconf / automake files +Makefile.in +aclocal.m4 +configure +build-aux/ +autom4te.cache/ +googletest/m4/libtool.m4 +googletest/m4/ltoptions.m4 +googletest/m4/ltsugar.m4 +googletest/m4/ltversion.m4 +googletest/m4/lt~obsolete.m4 + +# Ignore generated directories. +googlemock/fused-src/ +googletest/fused-src/ diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..433eefe --- /dev/null +++ b/Makefile.am @@ -0,0 +1,14 @@ +## Process this file with automake to produce Makefile.in +ACLOCAL_AMFLAGS = -I m4 + +AUTOMAKE_OPTIONS = foreign + +# Build . before src so that our all-local and clean-local hooks kicks in at +# the right time. +SUBDIRS = googletest googlemock + +EXTRA_DIST = \ + BUILD.bazel \ + CMakeLists.txt \ + README.md \ + WORKSPACE diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..751b9ba --- /dev/null +++ b/configure.ac @@ -0,0 +1,16 @@ +AC_INIT([Google C++ Mocking and Testing Frameworks], + [1.8.0], + [googlemock@googlegroups.com], + [googletest]) + +# Provide various options to initialize the Autoconf and configure processes. +AC_PREREQ([2.59]) +AC_CONFIG_SRCDIR([./README.md]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_SUBDIRS([googletest googlemock]) + +AM_INIT_AUTOMAKE + +# Output the generated files. No further autoconf macros may be used. +AC_OUTPUT diff --git a/googlemock/configure.ac b/googlemock/configure.ac index c23ed45..cb5e1a6 100644 --- a/googlemock/configure.ac +++ b/googlemock/configure.ac @@ -129,7 +129,7 @@ AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"], GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags` GTEST_LIBS=`${GTEST_CONFIG} --libs` GTEST_VERSION=`${GTEST_CONFIG} --version`], - [AC_CONFIG_SUBDIRS([../googletest]) + [ # GTEST_CONFIG needs to be executable both in a Makefile environment and # in a shell script environment, so resolve an absolute path for it here. GTEST_CONFIG="`pwd -P`/../googletest/scripts/gtest-config" diff --git a/googletest/Makefile.am b/googletest/Makefile.am index dbc004d..b6c7232 100644 --- a/googletest/Makefile.am +++ b/googletest/Makefile.am @@ -34,6 +34,7 @@ EXTRA_DIST += $(GTEST_SRC) # Sample files that we don't compile. EXTRA_DIST += \ samples/prime_tables.h \ + samples/sample1_unittest.cc \ samples/sample2_unittest.cc \ samples/sample3_unittest.cc \ samples/sample4_unittest.cc \ @@ -120,16 +121,16 @@ EXTRA_DIST += \ # MSVC project files EXTRA_DIST += \ - msvc/gtest-md.sln \ - msvc/gtest-md.vcproj \ - msvc/gtest.sln \ - msvc/gtest.vcproj \ - msvc/gtest_main-md.vcproj \ - msvc/gtest_main.vcproj \ - msvc/gtest_prod_test-md.vcproj \ - msvc/gtest_prod_test.vcproj \ - msvc/gtest_unittest-md.vcproj \ - msvc/gtest_unittest.vcproj + msvc/2010/gtest-md.sln \ + msvc/2010/gtest-md.vcxproj \ + msvc/2010/gtest.sln \ + msvc/2010/gtest.vcxproj \ + msvc/2010/gtest_main-md.vcxproj \ + msvc/2010/gtest_main.vcxproj \ + msvc/2010/gtest_prod_test-md.vcxproj \ + msvc/2010/gtest_prod_test.vcxproj \ + msvc/2010/gtest_unittest-md.vcxproj \ + msvc/2010/gtest_unittest.vcxproj # xcode project files EXTRA_DIST += \ @@ -223,33 +224,61 @@ lib_libgtest_main_la_LIBADD = lib/libgtest.la # TESTS -- Programs run automatically by "make check" # check_PROGRAMS -- Programs built by "make check" but not necessarily run -noinst_LTLIBRARIES = samples/libsamples.la - -samples_libsamples_la_SOURCES = \ - samples/sample1.cc \ - samples/sample1.h \ - samples/sample2.cc \ - samples/sample2.h \ - samples/sample3-inl.h \ - samples/sample4.cc \ - samples/sample4.h - TESTS= TESTS_ENVIRONMENT = GTEST_SOURCE_DIR="$(srcdir)/test" \ GTEST_BUILD_DIR="$(top_builddir)/test" check_PROGRAMS= # A simple sample on using gtest. -TESTS += samples/sample1_unittest -check_PROGRAMS += samples/sample1_unittest -samples_sample1_unittest_SOURCES = samples/sample1_unittest.cc +TESTS += samples/sample1_unittest \ + samples/sample2_unittest \ + samples/sample3_unittest \ + samples/sample4_unittest \ + samples/sample5_unittest \ + samples/sample6_unittest \ + samples/sample7_unittest \ + samples/sample8_unittest \ + samples/sample9_unittest \ + samples/sample10_unittest +check_PROGRAMS += samples/sample1_unittest \ + samples/sample2_unittest \ + samples/sample3_unittest \ + samples/sample4_unittest \ + samples/sample5_unittest \ + samples/sample6_unittest \ + samples/sample7_unittest \ + samples/sample8_unittest \ + samples/sample9_unittest \ + samples/sample10_unittest + +samples_sample1_unittest_SOURCES = samples/sample1_unittest.cc samples/sample1.cc samples_sample1_unittest_LDADD = lib/libgtest_main.la \ - lib/libgtest.la \ - samples/libsamples.la - -# Another sample. It also verifies that libgtest works. -TESTS += samples/sample10_unittest -check_PROGRAMS += samples/sample10_unittest + lib/libgtest.la +samples_sample2_unittest_SOURCES = samples/sample2_unittest.cc samples/sample2.cc +samples_sample2_unittest_LDADD = lib/libgtest_main.la \ + lib/libgtest.la +samples_sample3_unittest_SOURCES = samples/sample3_unittest.cc +samples_sample3_unittest_LDADD = lib/libgtest_main.la \ + lib/libgtest.la +samples_sample4_unittest_SOURCES = samples/sample4_unittest.cc samples/sample4.cc +samples_sample4_unittest_LDADD = lib/libgtest_main.la \ + lib/libgtest.la +samples_sample5_unittest_SOURCES = samples/sample5_unittest.cc samples/sample1.cc +samples_sample5_unittest_LDADD = lib/libgtest_main.la \ + lib/libgtest.la +samples_sample6_unittest_SOURCES = samples/sample6_unittest.cc +samples_sample6_unittest_LDADD = lib/libgtest_main.la \ + lib/libgtest.la +samples_sample7_unittest_SOURCES = samples/sample7_unittest.cc +samples_sample7_unittest_LDADD = lib/libgtest_main.la \ + lib/libgtest.la +samples_sample8_unittest_SOURCES = samples/sample8_unittest.cc +samples_sample8_unittest_LDADD = lib/libgtest_main.la \ + lib/libgtest.la + +# Also verify that libgtest works by itself. +samples_sample9_unittest_SOURCES = samples/sample9_unittest.cc +samples_sample9_unittest_LDADD = lib/libgtest.la samples_sample10_unittest_SOURCES = samples/sample10_unittest.cc samples_sample10_unittest_LDADD = lib/libgtest.la -- cgit v0.12 From 4aa05bd4ffb8148787bbcaa8780c9c522eb61b13 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Wed, 6 Dec 2017 15:33:27 -0500 Subject: Only switch to g++-4.9 on Linux. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 68acbd3..797c289 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ install: # /usr/bin/gcc is 4.6 always, but gcc-X.Y is available. -- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi +- if [ "$CXX" = "g++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi # /usr/bin/clang is 3.4, lets override with modern one. - if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; ln -sf /usr/bin/ccache /$HOME/bin/$CXX; ln -sf /usr/bin/ccache /$HOME/bin/$CC; fi # ccache on OS X needs installation first -- cgit v0.12 From 8d9d6bb0a3751ef3a7159aa0c2f1efd769d56075 Mon Sep 17 00:00:00 2001 From: Wojciech Mamrak Date: Thu, 7 Dec 2017 18:17:43 +0100 Subject: Improved description of VS std::tuple support --- googletest/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index b9a920b..31fef2c 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -83,6 +83,8 @@ include_directories( # <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple. # VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10 # VS 2013 12 1800 std::tr1::tuple +# VS 2015 14 1900 std::tuple +# VS 2017 15 >= 1910 std::tuple if (MSVC AND MSVC_VERSION EQUAL 1700) add_definitions(/D _VARIADIC_MAX=10) endif() -- cgit v0.12 From 3464f76e890a7f130988ffa0196577487d582b76 Mon Sep 17 00:00:00 2001 From: Wojciech Mamrak Date: Thu, 7 Dec 2017 18:18:17 +0100 Subject: Improved description of VS std::tuple support --- googlemock/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt index 724fdd5..c474947 100644 --- a/googlemock/CMakeLists.txt +++ b/googlemock/CMakeLists.txt @@ -74,6 +74,8 @@ include_directories("${gmock_SOURCE_DIR}/include" # <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple. # VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10 # VS 2013 12 1800 std::tr1::tuple +# VS 2015 14 1900 std::tuple +# VS 2017 15 >= 1910 std::tuple if (MSVC AND MSVC_VERSION EQUAL 1700) add_definitions(/D _VARIADIC_MAX=10) endif() -- cgit v0.12 From 57bb0bbbf80b006f35a249951fe2e051221173ae Mon Sep 17 00:00:00 2001 From: Wojciech Mamrak Date: Thu, 7 Dec 2017 18:20:25 +0100 Subject: Remove C4996 warning in VS2017 --- googletest/include/gtest/internal/gtest-port.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 0c36007..0a0cd1d 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -642,6 +642,9 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) // STLport, provided with the Android NDK, has neither or . # define GTEST_HAS_TR1_TUPLE 0 +# elif defined(_MSC_VER) && (_MSC_VER >= 1910) +// Prevent `warning C4996: 'std::tr1': warning STL4002: The non-Standard std::tr1 namespace and TR1-only machinery are deprecated and will be REMOVED.` +# define GTEST_HAS_TR1_TUPLE 0 # else // The user didn't tell us not to do it, so we assume it's OK. # define GTEST_HAS_TR1_TUPLE 1 -- cgit v0.12 From cf3adad594b68caad7a4093dbcd29c6bd7693eb0 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Sun, 3 Dec 2017 14:24:13 -0500 Subject: Add licenses() directive for googlemock/tests. Without the directive embedding googletest into third_party breaks any //... target. --- googlemock/test/BUILD.bazel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/googlemock/test/BUILD.bazel b/googlemock/test/BUILD.bazel index 6e67f18..9f1a64d 100644 --- a/googlemock/test/BUILD.bazel +++ b/googlemock/test/BUILD.bazel @@ -32,6 +32,8 @@ # # Bazel Build for Google C++ Testing Framework(Google Test)-googlemock +licenses(["notice"]) + """ gmock own tests """ cc_test( -- cgit v0.12 From e22d344c51b4920af11706141b60f8f75828f11f Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Fri, 8 Dec 2017 17:24:23 -0500 Subject: Add Apache-2.0 LICENSE file. --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. -- cgit v0.12 From bc3320b7f1daab522685c67d79b47fd0baddb95c Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Fri, 8 Dec 2017 20:59:07 -0500 Subject: Implement bazel-based builds in Travis. This refactored test build scripts to enable bazel-build scripts in Travis. --- .travis.yml | 83 ++++++++++++++++++++++++++++++++----------------- ci/build-linux-bazel.sh | 35 +++++++++++++++++++++ ci/env-linux.sh | 41 ++++++++++++++++++++++++ ci/env-osx.sh | 40 ++++++++++++++++++++++++ ci/install-linux.sh | 49 +++++++++++++++++++++++++++++ ci/install-osx.sh | 39 +++++++++++++++++++++++ ci/log-config.sh | 51 ++++++++++++++++++++++++++++++ ci/travis.sh | 34 ++++++++++++++++++++ travis.sh | 34 -------------------- 9 files changed, 343 insertions(+), 63 deletions(-) create mode 100755 ci/build-linux-bazel.sh create mode 100755 ci/env-linux.sh create mode 100755 ci/env-osx.sh create mode 100755 ci/install-linux.sh create mode 100755 ci/install-osx.sh create mode 100755 ci/log-config.sh create mode 100755 ci/travis.sh delete mode 100755 travis.sh diff --git a/.travis.yml b/.travis.yml index 797c289..4afad4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,19 +3,60 @@ # This file can be validated on: # http://lint.travis-ci.org/ +sudo: false +language: cpp + +# Define the matrix explicitly, manually expanding the combinations of (os, compiler, env). +# It is more tedious, but grants us far more flexibility. +matrix: + include: + - os: linux + compiler: gcc + sudo: true + cache: + install: ./ci/install-linux.sh && ./ci/log-config.sh + script: ./ci/build-linux-bazel.sh + - os: linux + compiler: clang + sudo: true + cache: + install: ./ci/install-linux.sh && ./ci/log-config.sh + script: ./ci/build-linux-bazel.sh + - os: linux + compiler: gcc + env: BUILD_TYPE=Debug VERBOSE=1 + - os: linux + compiler: gcc + env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 + - os: linux + compiler: clang + env: BUILD_TYPE=Debug VERBOSE=1 + - os: linux + compiler: clang + env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 + - os: osx + compiler: gcc + env: BUILD_TYPE=Debug VERBOSE=1 + - os: osx + compiler: gcc + env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 + - os: osx + compiler: clang + env: BUILD_TYPE=Debug VERBOSE=1 + - os: osx + compiler: clang + env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 + +# These are the install and build (script) phases for the most common entries in the matrix. They could be included +# in each entry in the matrix, but that is just repetitive. install: -# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available. -- if [ "$CXX" = "g++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi -# /usr/bin/clang is 3.4, lets override with modern one. -- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; ln -sf /usr/bin/ccache /$HOME/bin/$CXX; ln -sf /usr/bin/ccache /$HOME/bin/$CC; fi -# ccache on OS X needs installation first -- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install ccache; export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi -# reset ccache statistics -- ccache --zero-stats -- echo ${PATH} -- echo ${CXX} -- ${CXX} --version -- ${CXX} -v + - ./ci/install-${TRAVIS_OS_NAME}.sh + - . ./ci/env-${TRAVIS_OS_NAME}.sh + - ./ci/log-config.sh + +script: ./ci/travis.sh + +# For sudo=false builds this section installs the necessary dependencies. addons: apt: # List of whitelisted in travis packages for ubuntu-precise can be found here: @@ -28,22 +69,6 @@ addons: packages: - g++-4.9 - clang-3.7 -os: - - linux - - osx -language: cpp -cache: ccache -before_cache: - # print statistics before uploading new cache - - ccache --show-stats -compiler: - - gcc - - clang -script: ./travis.sh -env: - matrix: - - BUILD_TYPE=Debug VERBOSE=1 - - BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 + notifications: email: false -sudo: false diff --git a/ci/build-linux-bazel.sh b/ci/build-linux-bazel.sh new file mode 100755 index 0000000..2f63896 --- /dev/null +++ b/ci/build-linux-bazel.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -e + +bazel build --curses=no //...:all +bazel test --curses=no //...:all diff --git a/ci/env-linux.sh b/ci/env-linux.sh new file mode 100755 index 0000000..9086b1f --- /dev/null +++ b/ci/env-linux.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# +# This file should be sourced, and not executed as a standalone script. +# + +# TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}. + +if [ "${TRAVIS_OS_NAME}" = "linux" ]; then + if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi + if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi +fi diff --git a/ci/env-osx.sh b/ci/env-osx.sh new file mode 100755 index 0000000..31c8835 --- /dev/null +++ b/ci/env-osx.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# +# This file should be sourced, and not executed as a standalone script. +# + +# TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}. + +if [ "${TRAVIS_OS_NAME}" = "linux" ]; then + if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi +fi diff --git a/ci/install-linux.sh b/ci/install-linux.sh new file mode 100755 index 0000000..02a1943 --- /dev/null +++ b/ci/install-linux.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -eu + +if [ "${TRAVIS_OS_NAME}" != linux ]; then + echo "Not a Linux build; skipping installation" + exit 0 +fi + + +if [ "${TRAVIS_SUDO}" = "true" ]; then + echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | \ + sudo tee /etc/apt/sources.list.d/bazel.list + curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - + sudo apt-get update && sudo apt-get install -y bazel gcc-4.9 g++-4.9 clang-3.7 +elif [ "${CXX}" = "clang++" ]; then + # Use ccache, assuming $HOME/bin is in the path, which is true in the Travis build environment. + ln -sf /usr/bin/ccache $HOME/bin/${CXX}; + ln -sf /usr/bin/ccache $HOME/bin/${CC}; +fi diff --git a/ci/install-osx.sh b/ci/install-osx.sh new file mode 100755 index 0000000..6550ff5 --- /dev/null +++ b/ci/install-osx.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -eu + +if [ "${TRAVIS_OS_NAME}" != "osx" ]; then + echo "Not a macOS build; skipping installation" + exit 0 +fi + +brew install ccache diff --git a/ci/log-config.sh b/ci/log-config.sh new file mode 100755 index 0000000..5fef119 --- /dev/null +++ b/ci/log-config.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -e + +# ccache on OS X needs installation first +# reset ccache statistics +ccache --zero-stats + +echo PATH=${PATH} + +echo "Compiler configuration:" +echo CXX=${CXX} +echo CC=${CC} +echo CXXFLAGS=${CXXFLAGS} + +echo "C++ compiler version:" +${CXX} --version || echo "${CXX} does not seem to support the --version flag" +${CXX} -v || echo "${CXX} does not seem to support the -v flag" + +echo "C compiler version:" +${CC} --version || echo "${CXX} does not seem to support the --version flag" +${CC} -v || echo "${CXX} does not seem to support the -v flag" diff --git a/ci/travis.sh b/ci/travis.sh new file mode 100755 index 0000000..24a557e --- /dev/null +++ b/ci/travis.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env sh +set -evx + +# if possible, ask for the precise number of processors, +# otherwise take 2 processors as reasonable default; see +# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization +if [ -x /usr/bin/getconf ]; then + NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN) +else + NPROCESSORS=2 +fi +# as of 2017-09-04 Travis CI reports 32 processors, but GCC build +# crashes if parallelized too much (maybe memory consumption problem), +# so limit to 4 processors for the time being. +if [ $NPROCESSORS -gt 4 ] ; then + echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4." + NPROCESSORS=4 +fi +# Tell make to use the processors. No preceding '-' required. +MAKEFLAGS="j${NPROCESSORS}" +export MAKEFLAGS + +env | sort + +mkdir build || true +cd build +cmake -Dgtest_build_samples=ON \ + -Dgtest_build_tests=ON \ + -Dgmock_build_tests=ON \ + -DCMAKE_CXX_FLAGS=$CXX_FLAGS \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + .. +make +CTEST_OUTPUT_ON_FAILURE=1 make test diff --git a/travis.sh b/travis.sh deleted file mode 100755 index 24a557e..0000000 --- a/travis.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env sh -set -evx - -# if possible, ask for the precise number of processors, -# otherwise take 2 processors as reasonable default; see -# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization -if [ -x /usr/bin/getconf ]; then - NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN) -else - NPROCESSORS=2 -fi -# as of 2017-09-04 Travis CI reports 32 processors, but GCC build -# crashes if parallelized too much (maybe memory consumption problem), -# so limit to 4 processors for the time being. -if [ $NPROCESSORS -gt 4 ] ; then - echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4." - NPROCESSORS=4 -fi -# Tell make to use the processors. No preceding '-' required. -MAKEFLAGS="j${NPROCESSORS}" -export MAKEFLAGS - -env | sort - -mkdir build || true -cd build -cmake -Dgtest_build_samples=ON \ - -Dgtest_build_tests=ON \ - -Dgmock_build_tests=ON \ - -DCMAKE_CXX_FLAGS=$CXX_FLAGS \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ - .. -make -CTEST_OUTPUT_ON_FAILURE=1 make test -- cgit v0.12 From 11841175d8023203898e4168c49e80590a19795c Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Fri, 8 Dec 2017 23:16:24 -0500 Subject: Wrong LICENSE file, sorry. Corrected. [skip ci] --- LICENSE | 229 ++++++++-------------------------------------------------------- 1 file changed, 28 insertions(+), 201 deletions(-) diff --git a/LICENSE b/LICENSE index 261eeb9..1941a11 100644 --- a/LICENSE +++ b/LICENSE @@ -1,201 +1,28 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- cgit v0.12 From c82cd5e41e3755fc9ed65912ca3acaae69921dbb Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Fri, 8 Dec 2017 23:20:55 -0500 Subject: Also add documentation around becoming a contributor. --- CONTRIBUTING.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..0ac02f5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,37 @@ +# How to become a contributor and submit your own code + +## Contributor License Agreements + +We'd love to accept your patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement +(CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an + [individual CLA](https://developers.google.com/open-source/cla/individual). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a + [corporate CLA](https://developers.google.com/open-source/cla/corporate). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the sample to which + you are contributing. +1. Ensure that your code has an appropriate set of unit tests which all pass. +1. Submit a pull request. + +## Style + +Samples in this repository follow the [Google C++ Style Guide]( +https://google.github.io/styleguide/cppguide.html). -- cgit v0.12 From 3ea06317cd8b7e76596bdf84e591ae9414dc8d82 Mon Sep 17 00:00:00 2001 From: Bryan Zimmerman Date: Mon, 11 Dec 2017 12:19:56 -0500 Subject: remove implicit casts --- googlemock/test/gmock-generated-matchers_test.cc | 9 ++++----- googletest/CMakeLists.txt | 1 - googletest/include/gtest/internal/gtest-port.h | 2 +- googletest/test/gtest-printers_test.cc | 6 +++--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/googlemock/test/gmock-generated-matchers_test.cc b/googlemock/test/gmock-generated-matchers_test.cc index 9eb4b25..6cba726 100644 --- a/googlemock/test/gmock-generated-matchers_test.cc +++ b/googlemock/test/gmock-generated-matchers_test.cc @@ -64,7 +64,6 @@ using testing::ElementsAreArray; using testing::Eq; using testing::Ge; using testing::Gt; -using testing::internal::ImplicitCast_; using testing::Le; using testing::Lt; using testing::MakeMatcher; @@ -121,7 +120,7 @@ TEST(ArgsTest, AcceptsOneTemplateArg) { } TEST(ArgsTest, AcceptsTwoTemplateArgs) { - const tuple t(ImplicitCast_(4), 5, 6L); // NOLINT + const tuple t(static_cast(4), 5, 6L); // NOLINT EXPECT_THAT(t, (Args<0, 1>(Lt()))); EXPECT_THAT(t, (Args<1, 2>(Lt()))); @@ -129,13 +128,13 @@ TEST(ArgsTest, AcceptsTwoTemplateArgs) { } TEST(ArgsTest, AcceptsRepeatedTemplateArgs) { - const tuple t(ImplicitCast_(4), 5, 6L); // NOLINT + const tuple t(static_cast(4), 5, 6L); // NOLINT EXPECT_THAT(t, (Args<0, 0>(Eq()))); EXPECT_THAT(t, Not(Args<1, 1>(Ne()))); } TEST(ArgsTest, AcceptsDecreasingTemplateArgs) { - const tuple t(ImplicitCast_(4), 5, 6L); // NOLINT + const tuple t(static_cast(4), 5, 6L); // NOLINT EXPECT_THAT(t, (Args<2, 0>(Gt()))); EXPECT_THAT(t, Not(Args<2, 1>(Lt()))); } @@ -160,7 +159,7 @@ TEST(ArgsTest, AcceptsMoreTemplateArgsThanArityOfOriginalTuple) { } TEST(ArgsTest, CanBeNested) { - const tuple t(ImplicitCast_(4), 5, 6L, 6); // NOLINT + const tuple t(static_cast(4), 5, 6L, 6); // NOLINT EXPECT_THAT(t, (Args<1, 2, 3>(Args<1, 2>(Eq())))); EXPECT_THAT(t, (Args<0, 1, 3>(Args<0, 2>(Lt())))); } diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index cb2cbae..77b55ca 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -85,7 +85,6 @@ include_directories( # VS 2013 12 1800 std::tr1::tuple # VS 2015 14 1900 std::tuple # VS 2017 15 >= 1910 std::tuple - if (MSVC AND MSVC_VERSION EQUAL 1700) add_definitions(/D _VARIADIC_MAX=10) endif() diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 704dc02..0a0cd1d 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -646,7 +646,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // Prevent `warning C4996: 'std::tr1': warning STL4002: The non-Standard std::tr1 namespace and TR1-only machinery are deprecated and will be REMOVED.` # define GTEST_HAS_TR1_TUPLE 0 # else - // The user didn't tell us not to do it, so we assume it's OK. +// The user didn't tell us not to do it, so we assume it's OK. # define GTEST_HAS_TR1_TUPLE 1 # endif #endif // GTEST_HAS_TR1_TUPLE diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc index a48489c..2a6c017 100644 --- a/googletest/test/gtest-printers_test.cc +++ b/googletest/test/gtest-printers_test.cc @@ -1092,8 +1092,8 @@ TEST(PrintTr1TupleTest, VariousSizes) { ::std::tr1::tuple - t10(false, 'a', ImplicitCast_(3), 4, 5, 1.5F, -2.5, str, ImplicitCast_(NULL), - "10"); + t10(false, 'a', static_cast(3), 4, 5, 1.5F, -2.5, str, + ImplicitCast_(NULL), "10"); EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + " pointing to \"8\", NULL, \"10\")", Print(t10)); @@ -1152,7 +1152,7 @@ TEST(PrintStdTupleTest, VariousSizes) { ::std::tuple - t10(false, 'a', ImplicitCast_(3), 4, 5, 1.5F, -2.5, str, + t10(false, 'a', static_cast(3), 4, 5, 1.5F, -2.5, str, ImplicitCast_(NULL), "10"); EXPECT_EQ("(false, 'a' (97, 0x61), 3, 4, 5, 1.5, -2.5, " + PrintPointer(str) + " pointing to \"8\", NULL, \"10\")", -- cgit v0.12 From 74a53063133bc1d463a87c85227225690f2fe44d Mon Sep 17 00:00:00 2001 From: Bryan Zimmerman Date: Mon, 11 Dec 2017 12:21:35 -0500 Subject: remove extra line --- googlemock/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt index cc90378..21d61b1 100644 --- a/googlemock/CMakeLists.txt +++ b/googlemock/CMakeLists.txt @@ -76,7 +76,6 @@ include_directories("${gmock_SOURCE_DIR}/include" # VS 2013 12 1800 std::tr1::tuple # VS 2015 14 1900 std::tuple # VS 2017 15 >= 1910 std::tuple - if (MSVC AND MSVC_VERSION EQUAL 1700) add_definitions(/D _VARIADIC_MAX=10) endif() -- cgit v0.12 From 23a014ab578682ae11c3e68c77a1cde3b77f7a90 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Mon, 11 Dec 2017 19:33:27 -0500 Subject: Refactor docs about contributions to CONTRIBUTING.md. Per the review comments. --- CONTRIBUTING.md | 131 ++++++++++++++++++++++++++++++++++++-- README.md | 32 +--------- googlemock/README.md | 32 ---------- googlemock/docs/DevGuide.md | 132 --------------------------------------- googlemock/docs/Documentation.md | 2 +- googletest/README.md | 35 ----------- googletest/docs/DevGuide.md | 130 -------------------------------------- googletest/docs/Documentation.md | 2 +- 8 files changed, 132 insertions(+), 364 deletions(-) delete mode 100644 googlemock/docs/DevGuide.md delete mode 100644 googletest/docs/DevGuide.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0ac02f5..0ebdfcc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,8 +21,16 @@ accept your pull requests. ## Contributing A Patch -1. Submit an issue describing your proposed change to the repo in question. -1. The repo owner will respond to your issue promptly. +1. Submit an issue describing your proposed change to the + [issue tracker](https://github.com/google/googletest). +1. Please don't mix more than one logical change per submittal, + because it makes the history hard to follow. If you want to make a + change that doesn't have a corresponding issue in the issue + tracker, please create one. +1. Also, coordinate with team members that are listed on the issue in + question. This ensures that work isn't being duplicated and + communicating your plan early also generally leads to better + patches. 1. If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above). 1. Fork the desired repo, develop and test your code changes. @@ -31,7 +39,122 @@ accept your pull requests. 1. Ensure that your code has an appropriate set of unit tests which all pass. 1. Submit a pull request. +If you are a Googler, it is preferable to first create an internal change and +have it reviewed and submitted, and then create an upstreaming pull +request here. + +## The Google Test and Google Mock Communities ## + +The Google Test community exists primarily through the +[discussion group](http://groups.google.com/group/googletestframework) +and the GitHub repository. +Likewise, the Google Mock community exists primarily through their own +[discussion group](http://groups.google.com/group/googlemock). +You are definitely encouraged to contribute to the +discussion and you can also help us to keep the effectiveness of the +group high by following and promoting the guidelines listed here. + +### Please Be Friendly ### + +Showing courtesy and respect to others is a vital part of the Google +culture, and we strongly encourage everyone participating in Google +Test development to join us in accepting nothing less. Of course, +being courteous is not the same as failing to constructively disagree +with each other, but it does mean that we should be respectful of each +other when enumerating the 42 technical reasons that a particular +proposal may not be the best choice. There's never a reason to be +antagonistic or dismissive toward anyone who is sincerely trying to +contribute to a discussion. + +Sure, C++ testing is serious business and all that, but it's also +a lot of fun. Let's keep it that way. Let's strive to be one of the +friendliest communities in all of open source. + +As always, discuss Google Test in the official GoogleTest discussion group. +You don't have to actually submit code in order to sign up. Your participation +itself is a valuable contribution. + ## Style -Samples in this repository follow the [Google C++ Style Guide]( -https://google.github.io/styleguide/cppguide.html). +To keep the source consistent, readable, diffable and easy to merge, +we use a fairly rigid coding style, as defined by the [google-styleguide](https://github.com/google/styleguide) project. All patches will be expected +to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html). + +## Requirements for Contributors ### + +If you plan to contribute a patch, you need to build Google Test, +Google Mock, and their own tests from a git checkout, which has +further requirements: + + * [Python](https://www.python.org/) v2.3 or newer (for running some of + the tests and re-generating certain source files from templates) + * [CMake](https://cmake.org/) v2.6.4 or newer + * [GNU Build System](https://en.wikipedia.org/wiki/GNU_Build_System) + including automake (>= 1.9), autoconf (>= 2.59), and + libtool / libtoolize. + +## Developing Google Test ## + +This section discusses how to make your own changes to Google Test. + +### Testing Google Test Itself ### + +To make sure your changes work as intended and don't break existing +functionality, you'll want to compile and run Google Test's own tests. +For that you can use CMake: + + mkdir mybuild + cd mybuild + cmake -Dgtest_build_tests=ON ${GTEST_DIR} + +Make sure you have Python installed, as some of Google Test's tests +are written in Python. If the cmake command complains about not being +able to find Python (`Could NOT find PythonInterp (missing: +PYTHON_EXECUTABLE)`), try telling it explicitly where your Python +executable can be found: + + cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR} + +Next, you can build Google Test and all of its own tests. On \*nix, +this is usually done by 'make'. To run the tests, do + + make test + +All tests should pass. + +### Regenerating Source Files ## + +Some of Google Test's source files are generated from templates (not +in the C++ sense) using a script. +For example, the +file include/gtest/internal/gtest-type-util.h.pump is used to generate +gtest-type-util.h in the same directory. + +You don't need to worry about regenerating the source files +unless you need to modify them. You would then modify the +corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)' +generator script. See the [Pump Manual](googletest/docs/PumpManual.md). + +## Developing Google Mock ### + +This section discusses how to make your own changes to Google Mock. + +#### Testing Google Mock Itself #### + +To make sure your changes work as intended and don't break existing +functionality, you'll want to compile and run Google Test's own tests. +For that you'll need Autotools. First, make sure you have followed +the instructions above to configure Google Mock. +Then, create a build output directory and enter it. Next, + + ${GMOCK_DIR}/configure # try --help for more info + +Once you have successfully configured Google Mock, the build steps are +standard for GNU-style OSS packages. + + make # Standard makefile following GNU conventions + make check # Builds and runs all tests - all should pass. + +Note that when building your project against Google Mock, you are building +against Google Test as well. There is no need to configure Google Test +separately. diff --git a/README.md b/README.md index f858833..7936300 100644 --- a/README.md +++ b/README.md @@ -114,35 +114,9 @@ package (as described below): * Mac OS X v10.4 Tiger or newer * Xcode Developer Tools -### Requirements for Contributors ### +## Contributing change -We welcome patches. If you plan to contribute a patch, you need to -build Google Test and its own tests from a git checkout (described -below), which has further requirements: - - * [Python](https://www.python.org/) v2.3 or newer (for running some of - the tests and re-generating certain source files from templates) - * [CMake](https://cmake.org/) v2.6.4 or newer - -## Regenerating Source Files ## - -Some of Google Test's source files are generated from templates (not -in the C++ sense) using a script. -For example, the -file include/gtest/internal/gtest-type-util.h.pump is used to generate -gtest-type-util.h in the same directory. - -You don't need to worry about regenerating the source files -unless you need to modify them. You would then modify the -corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)' -generator script. See the [Pump Manual](googletest/docs/PumpManual.md). - -### Contributing Code ### - -We welcome patches. Please read the -[Developer's Guide](googletest/docs/DevGuide.md) -for how you can contribute. In particular, make sure you have signed -the Contributor License Agreement, or we won't be able to accept the -patch. +Please read the [`CONTRIBUTING.md`](CONTRIBUTING.md) for details on +how to contribute to this project. Happy testing! diff --git a/googlemock/README.md b/googlemock/README.md index f941f15..1170cfa 100644 --- a/googlemock/README.md +++ b/googlemock/README.md @@ -337,38 +337,6 @@ use the new matcher API ( [polymorphic](./docs/CookBook.md#writing-new-polymorphic-matchers)). Matchers defined using `MATCHER()` or `MATCHER_P*()` aren't affected. -### Developing Google Mock ### - -This section discusses how to make your own changes to Google Mock. - -#### Testing Google Mock Itself #### - -To make sure your changes work as intended and don't break existing -functionality, you'll want to compile and run Google Test's own tests. -For that you'll need Autotools. First, make sure you have followed -the instructions above to configure Google Mock. -Then, create a build output directory and enter it. Next, - - ${GMOCK_DIR}/configure # try --help for more info - -Once you have successfully configured Google Mock, the build steps are -standard for GNU-style OSS packages. - - make # Standard makefile following GNU conventions - make check # Builds and runs all tests - all should pass. - -Note that when building your project against Google Mock, you are building -against Google Test as well. There is no need to configure Google Test -separately. - -#### Contributing a Patch #### - -We welcome patches. -Please read the [Developer's Guide](docs/DevGuide.md) -for how you can contribute. In particular, make sure you have signed -the Contributor License Agreement, or we won't be able to accept the -patch. - Happy testing! [gtest_readme]: ../googletest/README.md "googletest" diff --git a/googlemock/docs/DevGuide.md b/googlemock/docs/DevGuide.md deleted file mode 100644 index cae07e7..0000000 --- a/googlemock/docs/DevGuide.md +++ /dev/null @@ -1,132 +0,0 @@ - - -If you are interested in understanding the internals of Google Mock, -building from source, or contributing ideas or modifications to the -project, then this document is for you. - -# Introduction # - -First, let's give you some background of the project. - -## Licensing ## - -All Google Mock source and pre-built packages are provided under the [New BSD License](http://www.opensource.org/licenses/bsd-license.php). - -## The Google Mock Community ## - -The Google Mock community exists primarily through the [discussion group](http://groups.google.com/group/googlemock), the -[issue tracker](https://github.com/google/googletest/issues) and, to a lesser extent, the [source control repository](../). You are definitely encouraged to contribute to the -discussion and you can also help us to keep the effectiveness of the -group high by following and promoting the guidelines listed here. - -### Please Be Friendly ### - -Showing courtesy and respect to others is a vital part of the Google -culture, and we strongly encourage everyone participating in Google -Mock development to join us in accepting nothing less. Of course, -being courteous is not the same as failing to constructively disagree -with each other, but it does mean that we should be respectful of each -other when enumerating the 42 technical reasons that a particular -proposal may not be the best choice. There's never a reason to be -antagonistic or dismissive toward anyone who is sincerely trying to -contribute to a discussion. - -Sure, C++ testing is serious business and all that, but it's also -a lot of fun. Let's keep it that way. Let's strive to be one of the -friendliest communities in all of open source. - -### Where to Discuss Google Mock ### - -As always, discuss Google Mock in the official [Google C++ Mocking Framework discussion group](http://groups.google.com/group/googlemock). You don't have to actually submit -code in order to sign up. Your participation itself is a valuable -contribution. - -# Working with the Code # - -If you want to get your hands dirty with the code inside Google Mock, -this is the section for you. - -## Checking Out the Source from Subversion ## - -Checking out the Google Mock source is most useful if you plan to -tweak it yourself. You check out the source for Google Mock using a -[Subversion](http://subversion.tigris.org/) client as you would for any -other project hosted on Google Code. Please see the instruction on -the [source code access page](../) for how to do it. - -## Compiling from Source ## - -Once you check out the code, you can find instructions on how to -compile it in the [README](../README.md) file. - -## Testing ## - -A mocking framework is of no good if itself is not thoroughly tested. -Tests should be written for any new code, and changes should be -verified to not break existing tests before they are submitted for -review. To perform the tests, follow the instructions in [README](../README.md) and -verify that there are no failures. - -# Contributing Code # - -We are excited that Google Mock is now open source, and hope to get -great patches from the community. Before you fire up your favorite IDE -and begin hammering away at that new feature, though, please take the -time to read this section and understand the process. While it seems -rigorous, we want to keep a high standard of quality in the code -base. - -## Contributor License Agreements ## - -You must sign a Contributor License Agreement (CLA) before we can -accept any code. The CLA protects you and us. - - * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). - * If you work for a company that wants to allow you to contribute your work to Google Mock, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html). - -Follow either of the two links above to access the appropriate CLA and -instructions for how to sign and return it. - -## Coding Style ## - -To keep the source consistent, readable, diffable and easy to merge, -we use a fairly rigid coding style, as defined by the [google-styleguide](https://github.com/google/styleguide) project. All patches will be expected -to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html). - -## Submitting Patches ## - -Please do submit code. Here's what you need to do: - - 1. Normally you should make your change against the SVN trunk instead of a branch or a tag, as the latter two are for release control and should be treated mostly as read-only. - 1. Decide which code you want to submit. A submission should be a set of changes that addresses one issue in the [Google Mock issue tracker](https://github.com/google/googletest/issues). Please don't mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn't have a corresponding issue in the issue tracker, please create one. - 1. Also, coordinate with team members that are listed on the issue in question. This ensures that work isn't being duplicated and communicating your plan early also generally leads to better patches. - 1. Ensure that your code adheres to the [Google Mock source code style](#Coding_Style.md). - 1. Ensure that there are unit tests for your code. - 1. Sign a Contributor License Agreement. - 1. Create a patch file using `svn diff`. - 1. We use [Rietveld](http://codereview.appspot.com/) to do web-based code reviews. You can read about the tool [here](https://github.com/rietveld-codereview/rietveld/wiki). When you are ready, upload your patch via Rietveld and notify `googlemock@googlegroups.com` to review it. There are several ways to upload the patch. We recommend using the [upload\_gmock.py](../scripts/upload_gmock.py) script, which you can find in the `scripts/` folder in the SVN trunk. - -## Google Mock Committers ## - -The current members of the Google Mock engineering team are the only -committers at present. In the great tradition of eating one's own -dogfood, we will be requiring each new Google Mock engineering team -member to earn the right to become a committer by following the -procedures in this document, writing consistently great code, and -demonstrating repeatedly that he or she truly gets the zen of Google -Mock. - -# Release Process # - -We follow the typical release process for Subversion-based projects: - - 1. A release branch named `release-X.Y` is created. - 1. Bugs are fixed and features are added in trunk; those individual patches are merged into the release branch until it's stable. - 1. An individual point release (the `Z` in `X.Y.Z`) is made by creating a tag from the branch. - 1. Repeat steps 2 and 3 throughout one release cycle (as determined by features or time). - 1. Go back to step 1 to create another release branch and so on. - - ---- - -This page is based on the [Making GWT Better](http://code.google.com/webtoolkit/makinggwtbetter.html) guide from the [Google Web Toolkit](http://code.google.com/webtoolkit/) project. Except as otherwise [noted](http://code.google.com/policies.html#restrictions), the content of this page is licensed under the [Creative Commons Attribution 2.5 License](http://creativecommons.org/licenses/by/2.5/). diff --git a/googlemock/docs/Documentation.md b/googlemock/docs/Documentation.md index a031187..16083e7 100644 --- a/googlemock/docs/Documentation.md +++ b/googlemock/docs/Documentation.md @@ -11,5 +11,5 @@ the respective git branch/tag).** To contribute code to Google Mock, read: - * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. + * [CONTRIBUTING](../CONTRIBUTING.md) -- read this _before_ writing your first patch. * [Pump Manual](../../googletest/docs/PumpManual.md) -- how we generate some of Google Mock's source files. diff --git a/googletest/README.md b/googletest/README.md index f273a7d..225aba2 100644 --- a/googletest/README.md +++ b/googletest/README.md @@ -358,38 +358,3 @@ instead of TEST(SomeTest, DoesThis) { ... } in order to define a test. - -## Developing Google Test ## - -This section discusses how to make your own changes to Google Test. - -### Testing Google Test Itself ### - -To make sure your changes work as intended and don't break existing -functionality, you'll want to compile and run Google Test's own tests. -For that you can use CMake: - - mkdir mybuild - cd mybuild - cmake -Dgtest_build_tests=ON ${GTEST_DIR} - -Make sure you have Python installed, as some of Google Test's tests -are written in Python. If the cmake command complains about not being -able to find Python (`Could NOT find PythonInterp (missing: -PYTHON_EXECUTABLE)`), try telling it explicitly where your Python -executable can be found: - - cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR} - -Next, you can build Google Test and all of its own tests. On \*nix, -this is usually done by 'make'. To run the tests, do - - make test - -All tests should pass. - -Normally you don't need to worry about regenerating the source files, -unless you need to modify them. In that case, you should modify the -corresponding .pump files instead and run the pump.py Python script to -regenerate them. You can find pump.py in the [scripts/](scripts/) directory. -Read the [Pump manual](docs/PumpManual.md) for how to use it. diff --git a/googletest/docs/DevGuide.md b/googletest/docs/DevGuide.md deleted file mode 100644 index 88a3de9..0000000 --- a/googletest/docs/DevGuide.md +++ /dev/null @@ -1,130 +0,0 @@ - - -If you are interested in understanding the internals of Google Test, -building from source, or contributing ideas or modifications to the -project, then this document is for you. - -# Introduction # - -First, let's give you some background of the project. - -## Licensing ## - -All Google Test source and pre-built packages are provided under the [New BSD License](http://www.opensource.org/licenses/bsd-license.php). - -## The Google Test Community ## - -The Google Test community exists primarily through the [discussion group](http://groups.google.com/group/googletestframework) and the GitHub repository. -You are definitely encouraged to contribute to the -discussion and you can also help us to keep the effectiveness of the -group high by following and promoting the guidelines listed here. - -### Please Be Friendly ### - -Showing courtesy and respect to others is a vital part of the Google -culture, and we strongly encourage everyone participating in Google -Test development to join us in accepting nothing less. Of course, -being courteous is not the same as failing to constructively disagree -with each other, but it does mean that we should be respectful of each -other when enumerating the 42 technical reasons that a particular -proposal may not be the best choice. There's never a reason to be -antagonistic or dismissive toward anyone who is sincerely trying to -contribute to a discussion. - -Sure, C++ testing is serious business and all that, but it's also -a lot of fun. Let's keep it that way. Let's strive to be one of the -friendliest communities in all of open source. - -As always, discuss Google Test in the official GoogleTest discussion group. -You don't have to actually submit code in order to sign up. Your participation -itself is a valuable contribution. - -# Working with the Code # - -If you want to get your hands dirty with the code inside Google Test, -this is the section for you. - -## Compiling from Source ## - -Once you check out the code, you can find instructions on how to -compile it in the [README](../README.md) file. - -## Testing ## - -A testing framework is of no good if itself is not thoroughly tested. -Tests should be written for any new code, and changes should be -verified to not break existing tests before they are submitted for -review. To perform the tests, follow the instructions in -[README](../README.md) and verify that there are no failures. - -# Contributing Code # - -We are excited that Google Test is now open source, and hope to get -great patches from the community. Before you fire up your favorite IDE -and begin hammering away at that new feature, though, please take the -time to read this section and understand the process. While it seems -rigorous, we want to keep a high standard of quality in the code -base. - -## Contributor License Agreements ## - -You must sign a Contributor License Agreement (CLA) before we can -accept any code. The CLA protects you and us. - - * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). - * If you work for a company that wants to allow you to contribute your work to Google Test, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html). - -Follow either of the two links above to access the appropriate CLA and -instructions for how to sign and return it. - -## Coding Style ## - -To keep the source consistent, readable, diffable and easy to merge, -we use a fairly rigid coding style, as defined by the [google-styleguide](https://github.com/google/styleguide) project. All patches will be expected -to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html). - -## Updating Generated Code ## - -Some of Google Test's source files are generated by the Pump tool (a -Python script). If you need to update such files, please modify the -source (`foo.h.pump`) and re-generate the C++ file using Pump. You -can read the PumpManual for details. - -## Submitting Patches ## - -Please do submit code. Here's what you need to do: - - 1. A submission should be a set of changes that addresses one issue in the [issue tracker](https://github.com/google/googletest/issues). Please don't mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn't have a corresponding issue in the issue tracker, please create one. - 1. Also, coordinate with team members that are listed on the issue in question. This ensures that work isn't being duplicated and communicating your plan early also generally leads to better patches. - 1. Ensure that your code adheres to the [Google Test source code style](#Coding_Style.md). - 1. Ensure that there are unit tests for your code. - 1. Sign a Contributor License Agreement. - 1. Create a Pull Request in the usual way. - -If you are a Googler, it is preferable to first create an internal change and -have it reviewed and submitted, and then create an upstreaming pull -request here. - -## Google Test Committers ## - -The current members of the Google Test engineering team are the only -committers at present. In the great tradition of eating one's own -dogfood, we will be requiring each new Google Test engineering team -member to earn the right to become a committer by following the -procedures in this document, writing consistently great code, and -demonstrating repeatedly that he or she truly gets the zen of Google -Test. - -# Release Process # - -We follow a typical release process: - - 1. A release branch named `release-X.Y` is created. - 1. Bugs are fixed and features are added in trunk; those individual patches are merged into the release branch until it's stable. - 1. An individual point release (the `Z` in `X.Y.Z`) is made by creating a tag from the branch. - 1. Repeat steps 2 and 3 throughout one release cycle (as determined by features or time). - 1. Go back to step 1 to create another release branch and so on. - ---- - -This page is based on the [Making GWT Better](http://code.google.com/webtoolkit/makinggwtbetter.html) guide from the [Google Web Toolkit](http://code.google.com/webtoolkit/) project. Except as otherwise [noted](http://code.google.com/policies.html#restrictions), the content of this page is licensed under the [Creative Commons Attribution 2.5 License](http://creativecommons.org/licenses/by/2.5/). diff --git a/googletest/docs/Documentation.md b/googletest/docs/Documentation.md index 1e4c5c5..3784c8f 100644 --- a/googletest/docs/Documentation.md +++ b/googletest/docs/Documentation.md @@ -12,5 +12,5 @@ the respective git branch/tag).** To contribute code to Google Test, read: - * [DevGuide](DevGuide.md) -- read this _before_ writing your first patch. + * [CONTRIBUTING](../CONTRIBUTING.md) -- read this _before_ writing your first patch. * [PumpManual](PumpManual.md) -- how we generate some of Google Test's source files. -- cgit v0.12 From 8a48f0ed4e0f275773b445e35ad8eb6f5f5d2d32 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Tue, 19 Dec 2017 10:55:49 -0500 Subject: Update gtest-param-test.h.pump --- googletest/include/gtest/gtest-param-test.h.pump | 3 +++ 1 file changed, 3 insertions(+) diff --git a/googletest/include/gtest/gtest-param-test.h.pump b/googletest/include/gtest/gtest-param-test.h.pump index 3377543..12654a4 100644 --- a/googletest/include/gtest/gtest-param-test.h.pump +++ b/googletest/include/gtest/gtest-param-test.h.pump @@ -184,6 +184,9 @@ TEST_P(DerivedTest, DoesBlah) { # include #endif +// scripts/fuse_gtest.py depends on gtest's own header being #included +// *unconditionally*. + #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util-generated.h" -- cgit v0.12 From a7fceb4a98a7b71f3b1c40c44972d5fab0ebde36 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Tue, 19 Dec 2017 10:58:37 -0500 Subject: Update gtest-param-test.h.pump --- googletest/include/gtest/gtest-param-test.h.pump | 3 --- 1 file changed, 3 deletions(-) diff --git a/googletest/include/gtest/gtest-param-test.h.pump b/googletest/include/gtest/gtest-param-test.h.pump index 12654a4..3377543 100644 --- a/googletest/include/gtest/gtest-param-test.h.pump +++ b/googletest/include/gtest/gtest-param-test.h.pump @@ -184,9 +184,6 @@ TEST_P(DerivedTest, DoesBlah) { # include #endif -// scripts/fuse_gtest.py depends on gtest's own header being #included -// *unconditionally*. - #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-param-util-generated.h" -- cgit v0.12 From e17907da8039d6491f951434f71677490176f72f Mon Sep 17 00:00:00 2001 From: bryanzim Date: Wed, 20 Dec 2017 10:06:20 -0500 Subject: Update internal_utils.cmake --- googletest/cmake/internal_utils.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index d1f81e6..c54bc94 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -62,8 +62,7 @@ macro(config_compiler_and_linker) if (MSVC) # Newlines inside flags variables break CMake's NMake generator. # TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds. - # -J does not set path correctly for pdb with spaces - set(cxx_base_flags "-GS -W4 -WX -wd4251 -wd4275 -nologo -Zi") + set(cxx_base_flags "-GS -W4 -WX -wd4251 -wd4275 -nologo -J -Zi") if (MSVC_VERSION LESS 1400) # 1400 is Visual Studio 2005 # Suppress spurious warnings MSVC 7.1 sometimes issues. # Forcing value to bool. -- cgit v0.12 From 7990f56637d68573358c22369ec5f1f540cc9532 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Wed, 18 May 2016 13:16:21 +0200 Subject: Re-enable MSVC++ C4389 warning in CmdHelperEq() C4389 was inhibited in commit 4b83461 making behavior inconsistent with other compilers. --- googletest/include/gtest/gtest.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index 1b55677..a19625f 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -1386,11 +1386,9 @@ AssertionResult CmpHelperEQ(const char* lhs_expression, const char* rhs_expression, const T1& lhs, const T2& rhs) { -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4389 /* signed/unsigned mismatch */) if (lhs == rhs) { return AssertionSuccess(); } -GTEST_DISABLE_MSC_WARNINGS_POP_() return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs); } -- cgit v0.12 From 75b85d5382958cb719736c0b82863c7148be2526 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Sun, 24 Dec 2017 10:34:56 -0500 Subject: Create a autotools-based build for Travis. When this build works, we know the autoconf support is working. --- .travis.yml | 5 +++-- ci/build-linux-autotools.sh | 46 +++++++++++++++++++++++++++++++++++++++++++ ci/get-nprocessors.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++ ci/travis.sh | 2 ++ 4 files changed, 99 insertions(+), 2 deletions(-) create mode 100755 ci/build-linux-autotools.sh create mode 100755 ci/get-nprocessors.sh diff --git a/.travis.yml b/.travis.yml index 4afad4a..95f8dff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,10 +24,11 @@ matrix: script: ./ci/build-linux-bazel.sh - os: linux compiler: gcc - env: BUILD_TYPE=Debug VERBOSE=1 + install: ./ci/install-linux.sh && ./ci/log-config.sh + script: ./ci/build-linux-autotools.sh - os: linux compiler: gcc - env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 + env: BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c++11 - os: linux compiler: clang env: BUILD_TYPE=Debug VERBOSE=1 diff --git a/ci/build-linux-autotools.sh b/ci/build-linux-autotools.sh new file mode 100755 index 0000000..aa92a32 --- /dev/null +++ b/ci/build-linux-autotools.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -e + +. ci/get-nprocessors.sh + +cd googlemock + +# Create the configuration script +autoreconf -i + +# Run in a subdirectory to keep the sources clean +mkdir build || true +cd build +../configure + +make -j ${NPROCESSORS:-2} diff --git a/ci/get-nprocessors.sh b/ci/get-nprocessors.sh new file mode 100755 index 0000000..43635e7 --- /dev/null +++ b/ci/get-nprocessors.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# Copyright 2017 Google Inc. +# All Rights Reserved. +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# This file is typically sourced by another script. +# if possible, ask for the precise number of processors, +# otherwise take 2 processors as reasonable default; see +# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization +if [ -x /usr/bin/getconf ]; then + NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN) +else + NPROCESSORS=2 +fi + +# as of 2017-09-04 Travis CI reports 32 processors, but GCC build +# crashes if parallelized too much (maybe memory consumption problem), +# so limit to 4 processors for the time being. +if [ $NPROCESSORS -gt 4 ] ; then + echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4." + NPROCESSORS=4 +fi diff --git a/ci/travis.sh b/ci/travis.sh index 24a557e..2dda68f 100755 --- a/ci/travis.sh +++ b/ci/travis.sh @@ -1,6 +1,8 @@ #!/usr/bin/env sh set -evx +. ci/get-nprocessors.sh + # if possible, ask for the precise number of processors, # otherwise take 2 processors as reasonable default; see # https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization -- cgit v0.12 From ec2b0c391261497048940c2fa4b19dcddf66b9ea Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Sun, 24 Dec 2017 12:22:46 -0500 Subject: Build both googletest and googlemock. --- ci/build-linux-autotools.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/build-linux-autotools.sh b/ci/build-linux-autotools.sh index aa92a32..cc404e9 100755 --- a/ci/build-linux-autotools.sh +++ b/ci/build-linux-autotools.sh @@ -33,8 +33,6 @@ set -e . ci/get-nprocessors.sh -cd googlemock - # Create the configuration script autoreconf -i -- cgit v0.12 From bcd35523cd7cc376927173ce5621b544c122bacb Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Sat, 6 May 2017 10:22:12 -0400 Subject: Avoid warning C4619 in MSVC 2017. C4800 has since been removed in MSVC 2017, so trying to silence it throws warning C4619 when enabled. --- googletest/include/gtest/gtest.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index a19625f..2ad5a0c 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -259,7 +259,9 @@ class GTEST_API_ AssertionResult { // Used in EXPECT_TRUE/FALSE(assertion_result). AssertionResult(const AssertionResult& other); +#if defined(_MSC_VER) && _MSC_VER < 1910 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */) +#endif // Used in the EXPECT_TRUE/FALSE(bool_expression). // @@ -276,7 +278,9 @@ class GTEST_API_ AssertionResult { /*enabler*/ = NULL) : success_(success) {} +#if defined(_MSC_VER) && _MSC_VER < 1910 GTEST_DISABLE_MSC_WARNINGS_POP_() +#endif // Assignment operator. AssertionResult& operator=(AssertionResult other) { -- cgit v0.12 From 90244a6aef73d28b7d300c5b3e9d7c94bd6f437a Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Tue, 2 Jan 2018 12:55:44 -0500 Subject: Fix testing::Combine on MSVC 2017. On platforms with std::tuple and not std::tr1::tuple, GTEST_HAS_COMBINE gets turned off when it works fine (due to GTEST_TUPLE_NAMESPACE_). Elsewhere in the project, several GTEST_HAS_TR1_TUPLE checks additionally check GTEST_HAS_STD_TUPLE_, so use that formulation. (The ones that don't are specific to std::tr1::tuple and are followed by an identical GTEST_HAS_STD_TUPLE_ version underneath it.) In particular, this fixes testing::Combine on MSVC 2017, which regressed here: https://github.com/google/googletest/pull/1348#issuecomment-353879010 --- googletest/include/gtest/internal/gtest-port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 5d1b141..8778bdd 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -827,7 +827,7 @@ using ::std::tuple_size; // Determines whether to support Combine(). // The implementation doesn't work on Sun Studio since it doesn't // understand templated conversion operators. -#if GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC) +#if (GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_) && !defined(__SUNPRO_CC) # define GTEST_HAS_COMBINE 1 #endif -- cgit v0.12 From e7734fb80cac5dd1f7c9845d5530d80b664a9f3e Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 2 Jan 2018 14:42:09 -0500 Subject: OSS Sync, cl 163329677 --- googletest/samples/prime_tables.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/googletest/samples/prime_tables.h b/googletest/samples/prime_tables.h index 92ce16a..55a3b44 100644 --- a/googletest/samples/prime_tables.h +++ b/googletest/samples/prime_tables.h @@ -103,11 +103,15 @@ class PreCalculatedPrimeTable : public PrimeTable { ::std::fill(is_prime_, is_prime_ + is_prime_size_, true); is_prime_[0] = is_prime_[1] = false; - for (int i = 2; i <= max; i++) { + // Checks every candidate for prime number (we know that 2 is the only even + // prime). + for (int i = 2; i*i <= max; i += i%2+1) { if (!is_prime_[i]) continue; // Marks all multiples of i (except i itself) as non-prime. - for (int j = 2*i; j <= max; j += i) { + // We are starting here from i-th multiplier, because all smaller + // complex numbers were already marked. + for (int j = i*i; j <= max; j += i) { is_prime_[j] = false; } } -- cgit v0.12 From b3d9be5c1d969dfdbf1f1ff924b9fd1be5eaecc9 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Fri, 10 Feb 2017 19:19:54 -0500 Subject: Pass the -Wmissing-declarations warning. This makes it easier to use GTest in projects that build with the -Wmissing-declarations warning. This fixes the warning in headers and source files, though not GTest's own tests as it is rather noisy there. --- googlemock/include/gmock/gmock-matchers.h | 4 +++ googlemock/src/gmock-spec-builders.cc | 2 +- googlemock/test/gmock-matchers_test.cc | 4 --- googletest/include/gtest/gtest-param-test.h | 12 +++---- googletest/include/gtest/gtest-param-test.h.pump | 6 ++-- googletest/src/gtest-death-test.cc | 21 ++++++----- googletest/src/gtest-port.cc | 8 +++-- googletest/src/gtest.cc | 45 +++++++++++++----------- 8 files changed, 55 insertions(+), 47 deletions(-) diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index c446bf7..3367a0b 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -3615,6 +3615,10 @@ BoundSecondMatcher MatcherBindSecond( return BoundSecondMatcher(tm, second); } +// Joins a vector of strings as if they are fields of a tuple; returns +// the joined string. This function is exported for testing. +GTEST_API_ string JoinAsTuple(const Strings& fields); + // Returns the description for a matcher defined using the MATCHER*() // macro where the user-supplied description string is "", if // 'negation' is false; otherwise returns the description of the diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index fc4968b..93a83ae 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -508,7 +508,7 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked() return expectations_met; } -CallReaction intToCallReaction(int mock_behavior) { +static CallReaction intToCallReaction(int mock_behavior) { if (mock_behavior >= kAllow && mock_behavior <= kFail) { return static_cast(mock_behavior); } diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 4beaec4..5c764eb 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -65,10 +65,6 @@ namespace testing { -namespace internal { -GTEST_API_ string JoinAsTuple(const Strings& fields); -} // namespace internal - namespace gmock_matchers_test { using std::greater; diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h index 7548a7c..83dd8da 100644 --- a/googletest/include/gtest/gtest-param-test.h +++ b/googletest/include/gtest/gtest-param-test.h @@ -1407,21 +1407,21 @@ internal::CartesianProductHolder10, and return std::string. // // testing::PrintToStringParamName is a builtin test suffix generator that -// returns the value of testing::PrintToString(GetParam()). It does not work -// for std::string or C strings. +// returns the value of testing::PrintToString(GetParam()). // // Note: test names must be non-empty, unique, and may only contain ASCII -// alphanumeric characters or underscore. +// alphanumeric characters or underscore. Because PrintToString adds quotes +// to std::string and C strings, it won't work for these types. # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ - ::testing::internal::ParamGenerator \ + static ::testing::internal::ParamGenerator \ gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \ - ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ + static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ const ::testing::TestParamInfo& info) { \ return ::testing::internal::GetParamNameGen \ (__VA_ARGS__)(info); \ } \ - int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ + static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ GetTestCasePatternHolder(\ #test_case_name, \ diff --git a/googletest/include/gtest/gtest-param-test.h.pump b/googletest/include/gtest/gtest-param-test.h.pump index 3377543..504b7d1 100644 --- a/googletest/include/gtest/gtest-param-test.h.pump +++ b/googletest/include/gtest/gtest-param-test.h.pump @@ -480,14 +480,14 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine( // to std::string and C strings, it won't work for these types. # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ - ::testing::internal::ParamGenerator \ + static ::testing::internal::ParamGenerator \ gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \ - ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ + static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ const ::testing::TestParamInfo& info) { \ return ::testing::internal::GetParamNameGen \ (__VA_ARGS__)(info); \ } \ - int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ + static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ GetTestCasePatternHolder(\ #test_case_name, \ diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc index fca1035..609f50d 100644 --- a/googletest/src/gtest-death-test.cc +++ b/googletest/src/gtest-death-test.cc @@ -259,7 +259,7 @@ enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW }; // message is propagated back to the parent process. Otherwise, the // message is simply printed to stderr. In either case, the program // then exits with status 1. -void DeathTestAbort(const std::string& message) { +static void DeathTestAbort(const std::string& message) { // On a POSIX system, this function may be called from a threadsafe-style // death test child process, which operates on a very small stack. Use // the heap for any additional non-minuscule memory requirements. @@ -985,6 +985,7 @@ static int ExecDeathTestChildMain(void* child_arg) { } # endif // !GTEST_OS_QNX +# if GTEST_HAS_CLONE // Two utility routines that together determine the direction the stack // grows. // This could be accomplished more elegantly by a single recursive @@ -994,20 +995,22 @@ static int ExecDeathTestChildMain(void* child_arg) { // GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining // StackLowerThanAddress into StackGrowsDown, which then doesn't give // correct answer. -void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_; -void StackLowerThanAddress(const void* ptr, bool* result) { +static void StackLowerThanAddress(const void* ptr, + bool* result) GTEST_NO_INLINE_; +static void StackLowerThanAddress(const void* ptr, bool* result) { int dummy; *result = (&dummy < ptr); } // Make sure AddressSanitizer does not tamper with the stack here. GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -bool StackGrowsDown() { +static bool StackGrowsDown() { int dummy; bool result; StackLowerThanAddress(&dummy, &result); return result; } +# endif // GTEST_HAS_CLONE // Spawns a child process with the same executable as the current process in // a thread-safe manner and instructs it to run the death test. The @@ -1223,12 +1226,12 @@ bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex, // Recreates the pipe and event handles from the provided parameters, // signals the event, and returns a file descriptor wrapped around the pipe // handle. This function is called in the child process only. -int GetStatusFileDescriptor(unsigned int parent_process_id, - size_t write_handle_as_size_t, - size_t event_handle_as_size_t) { +static int GetStatusFileDescriptor(unsigned int parent_process_id, + size_t write_handle_as_size_t, + size_t event_handle_as_size_t) { AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE, - FALSE, // Non-inheritable. - parent_process_id)); + FALSE, // Non-inheritable. + parent_process_id)); if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) { DeathTestAbort("Unable to open parent process " + StreamableToString(parent_process_id)); diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index 5a6eb87..403784a 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -671,7 +671,7 @@ bool AtomMatchesChar(bool escaped, char pattern_char, char ch) { } // Helper function used by ValidateRegex() to format error messages. -std::string FormatRegexSyntaxError(const char* regex, int index) { +static std::string FormatRegexSyntaxError(const char* regex, int index) { return (Message() << "Syntax error at index " << index << " in simple regular expression \"" << regex << "\": ").GetString(); } @@ -1015,7 +1015,9 @@ static CapturedStream* g_captured_stderr = NULL; static CapturedStream* g_captured_stdout = NULL; // Starts capturing an output stream (stdout/stderr). -void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) { +static void CaptureStream(int fd, + const char* stream_name, + CapturedStream** stream) { if (*stream != NULL) { GTEST_LOG_(FATAL) << "Only one " << stream_name << " capturer can exist at a time."; @@ -1024,7 +1026,7 @@ void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) { } // Stops capturing the output stream and returns the captured string. -std::string GetCapturedStream(CapturedStream** captured_stream) { +static std::string GetCapturedStream(CapturedStream** captured_stream) { const std::string content = (*captured_stream)->GetCapturedString(); delete *captured_stream; diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 90eea80..f75c729 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -629,12 +629,12 @@ extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId(); // This predicate-formatter checks that 'results' contains a test part // failure of the given type and that the failure message contains the // given substring. -AssertionResult HasOneFailure(const char* /* results_expr */, - const char* /* type_expr */, - const char* /* substr_expr */, - const TestPartResultArray& results, - TestPartResult::Type type, - const std::string& substr) { +static AssertionResult HasOneFailure(const char* /* results_expr */, + const char* /* type_expr */, + const char* /* substr_expr */, + const TestPartResultArray& results, + TestPartResult::Type type, + const std::string& substr) { const std::string expected(type == TestPartResult::kFatalFailure ? "1 fatal failure" : "1 non-fatal failure"); @@ -2137,8 +2137,9 @@ static std::string FormatWordList(const std::vector& words) { return word_list.GetString(); } -bool ValidateTestPropertyName(const std::string& property_name, - const std::vector& reserved_names) { +static bool ValidateTestPropertyName( + const std::string& property_name, + const std::vector& reserved_names) { if (std::find(reserved_names.begin(), reserved_names.end(), property_name) != reserved_names.end()) { ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name @@ -2883,7 +2884,7 @@ enum GTestColor { !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW // Returns the character attribute for the given color. -WORD GetColorAttribute(GTestColor color) { +static WORD GetColorAttribute(GTestColor color) { switch (color) { case COLOR_RED: return FOREGROUND_RED; case COLOR_GREEN: return FOREGROUND_GREEN; @@ -2892,7 +2893,7 @@ WORD GetColorAttribute(GTestColor color) { } } -int GetBitOffset(WORD color_mask) { +static int GetBitOffset(WORD color_mask) { if (color_mask == 0) return 0; int bitOffset = 0; @@ -2903,7 +2904,7 @@ int GetBitOffset(WORD color_mask) { return bitOffset; } -WORD GetNewColor(GTestColor color, WORD old_color_attrs) { +static WORD GetNewColor(GTestColor color, WORD old_color_attrs) { // Let's reuse the BG static const WORD background_mask = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY; static const WORD foreground_mask = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY; @@ -2923,7 +2924,7 @@ WORD GetNewColor(GTestColor color, WORD old_color_attrs) { // Returns the ANSI color code for the given color. COLOR_DEFAULT is // an invalid input. -const char* GetAnsiColorCode(GTestColor color) { +static const char* GetAnsiColorCode(GTestColor color) { switch (color) { case COLOR_RED: return "1"; case COLOR_GREEN: return "2"; @@ -2976,7 +2977,7 @@ bool ShouldUseColor(bool stdout_is_tty) { // This routine must actually emit the characters rather than return a string // that would be colored when printed, as can be done on Linux. GTEST_ATTRIBUTE_PRINTF_(2, 3) -void ColoredPrintf(GTestColor color, const char* fmt, ...) { +static void ColoredPrintf(GTestColor color, const char* fmt, ...) { va_list args; va_start(args, fmt); @@ -3030,7 +3031,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) { static const char kTypeParamLabel[] = "TypeParam"; static const char kValueParamLabel[] = "GetParam()"; -void PrintFullTestCommentIfPresent(const TestInfo& test_info) { +static void PrintFullTestCommentIfPresent(const TestInfo& test_info) { const char* const type_param = test_info.type_param(); const char* const value_param = test_info.value_param(); @@ -5028,9 +5029,9 @@ bool SkipPrefix(const char* prefix, const char** pstr) { // part can be omitted. // // Returns the value of the flag, or NULL if the parsing failed. -const char* ParseFlagValue(const char* str, - const char* flag, - bool def_optional) { +static const char* ParseFlagValue(const char* str, + const char* flag, + bool def_optional) { // str and flag must not be NULL. if (str == NULL || flag == NULL) return NULL; @@ -5066,7 +5067,7 @@ const char* ParseFlagValue(const char* str, // // On success, stores the value of the flag in *value, and returns // true. On failure, returns false without changing *value. -bool ParseBoolFlag(const char* str, const char* flag, bool* value) { +static bool ParseBoolFlag(const char* str, const char* flag, bool* value) { // Gets the value of the flag as a string. const char* const value_str = ParseFlagValue(str, flag, true); @@ -5100,7 +5101,9 @@ bool ParseInt32Flag(const char* str, const char* flag, Int32* value) { // // On success, stores the value of the flag in *value, and returns // true. On failure, returns false without changing *value. -bool ParseStringFlag(const char* str, const char* flag, std::string* value) { +static bool ParseStringFlag(const char* str, + const char* flag, + std::string* value) { // Gets the value of the flag as a string. const char* const value_str = ParseFlagValue(str, flag, false); @@ -5236,7 +5239,7 @@ static const char kColorEncodedHelpMessage[] = "(not one in your own code or tests), please report it to\n" "@G<" GTEST_DEV_EMAIL_ ">@D.\n"; -bool ParseGoogleTestFlag(const char* const arg) { +static bool ParseGoogleTestFlag(const char* const arg) { return ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag, >EST_FLAG(also_run_disabled_tests)) || ParseBoolFlag(arg, kBreakOnFailureFlag, @@ -5266,7 +5269,7 @@ bool ParseGoogleTestFlag(const char* const arg) { } #if GTEST_USE_OWN_FLAGFILE_FLAG_ -void LoadFlagsFromFile(const std::string& path) { +static void LoadFlagsFromFile(const std::string& path) { FILE* flagfile = posix::FOpen(path.c_str(), "r"); if (!flagfile) { GTEST_LOG_(FATAL) << "Unable to open file \"" -- cgit v0.12 From 1acf8c752ee8e20888e5ae887846f034b09c5ca9 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Wed, 3 Jan 2018 14:55:52 -0500 Subject: Also define GTEST_ATTRIBUTE_PRINTF_ in clang-cl. clang-cl is clang for Windows running in MSVC mode. Chromium uses it for Windows builds. clang-cl is weird in that it defines __clang__ and _MSC_VER, but *NOT* __GNUC__. This is vaguely analogous to how normal clang defines __clang__ (what it is) and __GNUC__ (what it is compatible with). However, clang-cl still implements most GCC extensions, being clang. Notably, the way to control -Wformat-literal is still with __attribute__((__format__)). For better error-checking and strict -Wformatl-literal compatibility (see 53c478d639b8eebd2942e88266610ebc79c541f6), define GTEST_ATTRIBUTE_PRINTF_ in clang-cl too. --- googletest/include/gtest/internal/gtest-port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 8778bdd..58ab7fd 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -879,7 +879,7 @@ using ::std::tuple_size; #endif // Use this annotation before a function that takes a printf format string. -#if defined(__GNUC__) && !defined(COMPILER_ICC) +#if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC) # if defined(__MINGW_PRINTF_FORMAT) // MinGW has two different printf implementations. Ensure the format macro // matches the selected implementation. See -- cgit v0.12 From 1c09831acc69d6d77af5d5aa45feee6f52dc1a76 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Wed, 3 Jan 2018 16:57:05 -0500 Subject: upstreaming cl 124976692 --- googlemock/test/gmock-internal-utils_test.cc | 8 -------- googletest/src/gtest-death-test.cc | 8 -------- googletest/src/gtest-internal-inl.h | 8 -------- googletest/src/gtest-port.cc | 8 -------- googletest/src/gtest-test-part.cc | 8 -------- googletest/src/gtest.cc | 29 +++++++++++----------------- googletest/test/gtest-death-test_test.cc | 8 -------- googletest/test/gtest-filepath_test.cc | 8 -------- googletest/test/gtest-options_test.cc | 7 ------- googletest/test/gtest-param-test_test.cc | 4 ---- googletest/test/gtest-port_test.cc | 8 -------- googletest/test/gtest_color_test_.cc | 8 -------- googletest/test/gtest_env_var_test_.cc | 3 --- googletest/test/gtest_environment_test.cc | 3 --- googletest/test/gtest_output_test_.cc | 8 -------- googletest/test/gtest_repeat_test.cc | 8 -------- googletest/test/gtest_stress_test.cc | 5 ----- googletest/test/gtest_unittest.cc | 8 -------- 18 files changed, 11 insertions(+), 136 deletions(-) diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc index 72d9a85..c7893ae 100644 --- a/googlemock/test/gmock-internal-utils_test.cc +++ b/googlemock/test/gmock-internal-utils_test.cc @@ -44,15 +44,7 @@ #include "gmock/internal/gmock-port.h" #include "gtest/gtest.h" #include "gtest/gtest-spi.h" - -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick is to -// prevent a user from accidentally including gtest-internal-inl.h in -// their code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ #if GTEST_OS_CYGWIN # include // For ssize_t. NOLINT diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc index fca1035..07b5447 100644 --- a/googletest/src/gtest-death-test.cc +++ b/googletest/src/gtest-death-test.cc @@ -66,15 +66,7 @@ #include "gtest/gtest-message.h" #include "gtest/internal/gtest-string.h" - -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick exists to -// prevent the accidental inclusion of gtest-internal-inl.h in the -// user's code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ namespace testing { diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index 1437293..5ec0af9 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -37,14 +37,6 @@ #ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_ #define GTEST_SRC_GTEST_INTERNAL_INL_H_ -// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is -// part of Google Test's implementation; otherwise it's undefined. -#if !GTEST_IMPLEMENTATION_ -// If this file is included from the user's code, just say no. -# error "gtest-internal-inl.h is part of Google Test's internal implementation." -# error "It must not be included except by Google Test itself." -#endif // GTEST_IMPLEMENTATION_ - #ifndef _WIN32_WCE # include #endif // !_WIN32_WCE diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index 5a6eb87..717a2c3 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -67,15 +67,7 @@ #include "gtest/gtest-message.h" #include "gtest/internal/gtest-internal.h" #include "gtest/internal/gtest-string.h" - -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick exists to -// prevent the accidental inclusion of gtest-internal-inl.h in the -// user's code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ namespace testing { namespace internal { diff --git a/googletest/src/gtest-test-part.cc b/googletest/src/gtest-test-part.cc index fb0e354..c3926c8 100644 --- a/googletest/src/gtest-test-part.cc +++ b/googletest/src/gtest-test-part.cc @@ -32,15 +32,7 @@ // The Google C++ Testing Framework (Google Test) #include "gtest/gtest-test-part.h" - -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick exists to -// prevent the accidental inclusion of gtest-internal-inl.h in the -// user's code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ namespace testing { diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 90eea80..6864323 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -133,14 +133,7 @@ # include // NOLINT #endif -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick is to -// prevent a user from accidentally including gtest-internal-inl.h in -// their code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ #if GTEST_OS_WINDOWS # define vsnprintf _vsnprintf @@ -2569,7 +2562,7 @@ void ReportInvalidTestCaseType(const char* test_case_name, << "probably rename one of the classes to put the tests into different\n" << "test cases."; - GTEST_LOG_(ERROR) + GTEST_LOG_(ERROR) << FormatFileLocation(code_location.file.c_str(), code_location.line) << " " << errors.GetString(); @@ -2918,7 +2911,7 @@ WORD GetNewColor(GTestColor color, WORD old_color_attrs) { } return new_color; } - + #else // Returns the ANSI color code for the given color. COLOR_DEFAULT is @@ -3005,7 +2998,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) { GetConsoleScreenBufferInfo(stdout_handle, &buffer_info); const WORD old_color_attrs = buffer_info.wAttributes; const WORD new_color = GetNewColor(color, old_color_attrs); - + // We need to flush the stream buffers into the console before each // SetConsoleTextAttribute call lest it affect the text that is already // printed but has not yet reached the console. @@ -3471,7 +3464,7 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, // 3. To interpret the meaning of errno in a thread-safe way, // we need the strerror_r() function, which is not available on // Windows. - GTEST_LOG_(FATAL) << "Unable to open file \"" + GTEST_LOG_(FATAL) << "Unable to open file \"" << output_file_ << "\""; } std::stringstream stream; @@ -4419,8 +4412,8 @@ void UnitTestImpl::ConfigureXmlOutput() { listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter( UnitTestOptions::GetAbsolutePathToOutputFile().c_str())); } else if (output_format != "") { - GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \"" - << output_format + GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \"" + << output_format << "\" ignored."; } } @@ -4436,8 +4429,8 @@ void UnitTestImpl::ConfigureStreamingOutput() { listeners()->Append(new StreamingListener(target.substr(0, pos), target.substr(pos+1))); } else { - GTEST_LOG_(WARNING) << "unrecognized streaming target \"" - << target + GTEST_LOG_(WARNING) << "unrecognized streaming target \"" + << target << "\" ignored."; } } @@ -4567,7 +4560,7 @@ static void TearDownEnvironment(Environment* env) { env->TearDown(); } bool UnitTestImpl::RunAllTests() { // Makes sure InitGoogleTest() was called. if (!GTestIsInitialized()) { - GTEST_LOG_(ERROR) << + GTEST_LOG_(ERROR) << "\nThis test program did NOT call ::testing::InitGoogleTest " "before calling RUN_ALL_TESTS(). Please fix it."; return false; @@ -5269,8 +5262,8 @@ bool ParseGoogleTestFlag(const char* const arg) { void LoadFlagsFromFile(const std::string& path) { FILE* flagfile = posix::FOpen(path.c_str(), "r"); if (!flagfile) { - GTEST_LOG_(FATAL) << "Unable to open file \"" - << GTEST_FLAG(flagfile) + GTEST_LOG_(FATAL) << "Unable to open file \"" + << GTEST_FLAG(flagfile) << "\""; } std::string contents(ReadEntireFile(flagfile)); diff --git a/googletest/test/gtest-death-test_test.cc b/googletest/test/gtest-death-test_test.cc index 85021e3..0e1e87b 100644 --- a/googletest/test/gtest-death-test_test.cc +++ b/googletest/test/gtest-death-test_test.cc @@ -56,15 +56,7 @@ using testing::internal::AlwaysTrue; # endif // GTEST_OS_LINUX # include "gtest/gtest-spi.h" - -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick is to -// prevent a user from accidentally including gtest-internal-inl.h in -// their code. -# define GTEST_IMPLEMENTATION_ 1 # include "src/gtest-internal-inl.h" -# undef GTEST_IMPLEMENTATION_ namespace posix = ::testing::internal::posix; diff --git a/googletest/test/gtest-filepath_test.cc b/googletest/test/gtest-filepath_test.cc index 22f4ed6..cc4883b 100644 --- a/googletest/test/gtest-filepath_test.cc +++ b/googletest/test/gtest-filepath_test.cc @@ -40,15 +40,7 @@ #include "gtest/internal/gtest-filepath.h" #include "gtest/gtest.h" - -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick is to -// prevent a user from accidentally including gtest-internal-inl.h in -// their code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ #if GTEST_OS_WINDOWS_MOBILE # include // NOLINT diff --git a/googletest/test/gtest-options_test.cc b/googletest/test/gtest-options_test.cc index 88c6e9a..70f3ce9 100644 --- a/googletest/test/gtest-options_test.cc +++ b/googletest/test/gtest-options_test.cc @@ -46,14 +46,7 @@ # include #endif // GTEST_OS_WINDOWS_MOBILE -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick is to -// prevent a user from accidentally including gtest-internal-inl.h in -// their code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ namespace testing { namespace internal { diff --git a/googletest/test/gtest-param-test_test.cc b/googletest/test/gtest-param-test_test.cc index 7d23e49..b0aa4f9 100644 --- a/googletest/test/gtest-param-test_test.cc +++ b/googletest/test/gtest-param-test_test.cc @@ -41,11 +41,7 @@ # include # include # include - -// To include gtest-internal-inl.h. -# define GTEST_IMPLEMENTATION_ 1 # include "src/gtest-internal-inl.h" // for UnitTestOptions -# undef GTEST_IMPLEMENTATION_ # include "test/gtest-param-test_test.h" diff --git a/googletest/test/gtest-port_test.cc b/googletest/test/gtest-port_test.cc index 62ee11b..2c59edc 100644 --- a/googletest/test/gtest-port_test.cc +++ b/googletest/test/gtest-port_test.cc @@ -45,15 +45,7 @@ #include "gtest/gtest.h" #include "gtest/gtest-spi.h" - -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick is to -// prevent a user from accidentally including gtest-internal-inl.h in -// their code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ using std::make_pair; using std::pair; diff --git a/googletest/test/gtest_color_test_.cc b/googletest/test/gtest_color_test_.cc index 672069c..f9a21e2 100644 --- a/googletest/test/gtest_color_test_.cc +++ b/googletest/test/gtest_color_test_.cc @@ -36,15 +36,7 @@ #include #include "gtest/gtest.h" - -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick is to -// prevent a user from accidentally including gtest-internal-inl.h in -// their code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ using testing::internal::ShouldUseColor; diff --git a/googletest/test/gtest_env_var_test_.cc b/googletest/test/gtest_env_var_test_.cc index 539afc9..ed62372 100644 --- a/googletest/test/gtest_env_var_test_.cc +++ b/googletest/test/gtest_env_var_test_.cc @@ -35,10 +35,7 @@ #include "gtest/gtest.h" #include - -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ using ::std::cout; diff --git a/googletest/test/gtest_environment_test.cc b/googletest/test/gtest_environment_test.cc index 3cff19e..1d6dc12 100644 --- a/googletest/test/gtest_environment_test.cc +++ b/googletest/test/gtest_environment_test.cc @@ -34,10 +34,7 @@ #include #include #include "gtest/gtest.h" - -#define GTEST_IMPLEMENTATION_ 1 // Required for the next #include. #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ namespace testing { GTEST_DECLARE_string_(filter); diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc index 0856cc7..6aaba97 100644 --- a/googletest/test/gtest_output_test_.cc +++ b/googletest/test/gtest_output_test_.cc @@ -37,15 +37,7 @@ #include "gtest/gtest-spi.h" #include "gtest/gtest.h" - -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick is to -// prevent a user from accidentally including gtest-internal-inl.h in -// their code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ #include diff --git a/googletest/test/gtest_repeat_test.cc b/googletest/test/gtest_repeat_test.cc index 7a36164..dcaadd7 100644 --- a/googletest/test/gtest_repeat_test.cc +++ b/googletest/test/gtest_repeat_test.cc @@ -34,15 +34,7 @@ #include #include #include "gtest/gtest.h" - -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick is to -// prevent a user from accidentally including gtest-internal-inl.h in -// their code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ namespace testing { diff --git a/googletest/test/gtest_stress_test.cc b/googletest/test/gtest_stress_test.cc index e7daa43..59a1b62 100644 --- a/googletest/test/gtest_stress_test.cc +++ b/googletest/test/gtest_stress_test.cc @@ -37,12 +37,7 @@ #include #include -// We must define this macro in order to #include -// gtest-internal-inl.h. This is how Google Test prevents a user from -// accidentally depending on its internal implementation. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ #if GTEST_IS_THREADSAFE diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index e4f743b..5394562 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -66,15 +66,7 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) { #include #include "gtest/gtest-spi.h" - -// Indicates that this translation unit is part of Google Test's -// implementation. It must come before gtest-internal-inl.h is -// included, or there will be a compiler error. This trick is to -// prevent a user from accidentally including gtest-internal-inl.h in -// their code. -#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION_ namespace testing { namespace internal { -- cgit v0.12 From 9cee677ce40d2412afcb9aa43244ccbe68b772a5 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Thu, 4 Jan 2018 13:04:31 -0500 Subject: Optimize build matrix (#1) Disable expensive builds on pull requests. --- .travis.yml | 4 ++++ appveyor.yml | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 95f8dff..8142575 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,15 +38,19 @@ matrix: - os: osx compiler: gcc env: BUILD_TYPE=Debug VERBOSE=1 + if: event != pull_request - os: osx compiler: gcc env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 + if: event != pull_request - os: osx compiler: clang env: BUILD_TYPE=Debug VERBOSE=1 + if: event != pull_request - os: osx compiler: clang env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 + if: event != pull_request # These are the install and build (script) phases for the most common entries in the matrix. They could be included # in each entry in the matrix, but that is just repetitive. diff --git a/appveyor.yml b/appveyor.yml index 4e8d6f6..804e3ec 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,6 +11,7 @@ environment: - compiler: msvc-15-seh generator: "Visual Studio 15 2017 Win64" APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + enabled_on_pr: yes - compiler: msvc-14-seh generator: "Visual Studio 14 2015" @@ -43,7 +44,6 @@ environment: configuration: - Debug - #- Release build: verbosity: minimal @@ -52,6 +52,16 @@ install: - ps: | Write-Output "Compiler: $env:compiler" Write-Output "Generator: $env:generator" + Write-Output "Pull Request: <$env:APPVEYOR_PULL_REQUEST_NUMBER>" + Write-Output "Enabled on PR: <$env:enabled_on_pr>" + if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) { + Write-Output "This is a pull request build" + if (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes") { + Write-Output "PR builds are *NOT* explicitly enabled" + } + } else { + Write-Output "This is *NOT* a pull request build" + } # git bash conflicts with MinGW makefiles if ($env:generator -eq "MinGW Makefiles") { @@ -63,6 +73,10 @@ install: build_script: - ps: | + # Only enable some builds for pull requests, the AppVeyor queue is too long. + if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "")) { + return + } md _build -Force | Out-Null cd _build @@ -81,6 +95,10 @@ build_script: test_script: - ps: | + # Only enable some builds for pull requests, the AppVeyor queue is too long. + if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "")) { + return + } if ($env:generator -eq "MinGW Makefiles") { return # No test available for MinGW } -- cgit v0.12 From 19b5774ccf6c20d7a8d076de9e791629e72ffc0d Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 4 Jan 2018 21:49:27 -0500 Subject: code cleanup in preparation for merges, cl 180857299 --- googletest/test/gtest-death-test_test.cc | 4 ++-- googletest/test/gtest-filepath_test.cc | 6 ++---- googletest/test/gtest-options_test.cc | 1 - googletest/test/gtest-param-test2_test.cc | 1 + googletest/test/gtest-port_test.cc | 4 ++-- googletest/test/gtest_break_on_failure_unittest_.cc | 3 +-- googletest/test/gtest_output_test_.cc | 10 ++++++++++ googletest/test/gtest_repeat_test.cc | 1 + googletest/test/gtest_stress_test.cc | 1 - googletest/test/gtest_xml_outfile1_test_.cc | 1 - googletest/test/gtest_xml_outfile2_test_.cc | 1 - googletest/test/gtest_xml_output_unittest_.cc | 2 -- 12 files changed, 19 insertions(+), 16 deletions(-) diff --git a/googletest/test/gtest-death-test_test.cc b/googletest/test/gtest-death-test_test.cc index 0e1e87b..b7846b2 100644 --- a/googletest/test/gtest-death-test_test.cc +++ b/googletest/test/gtest-death-test_test.cc @@ -305,14 +305,14 @@ void DieWithEmbeddedNul() { } # if GTEST_USES_PCRE + // Tests that EXPECT_DEATH and ASSERT_DEATH work when the error // message has a NUL character in it. TEST_F(TestForDeathTest, EmbeddedNulInMessage) { - // TODO(wan@google.com): doesn't support matching strings - // with embedded NUL characters - find a way to workaround it. EXPECT_DEATH(DieWithEmbeddedNul(), "my null world"); ASSERT_DEATH(DieWithEmbeddedNul(), "my null world"); } + # endif // GTEST_USES_PCRE // Tests that death test macros expand to code which interacts well with switch diff --git a/googletest/test/gtest-filepath_test.cc b/googletest/test/gtest-filepath_test.cc index cc4883b..29cea3d 100644 --- a/googletest/test/gtest-filepath_test.cc +++ b/googletest/test/gtest-filepath_test.cc @@ -27,16 +27,14 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Authors: keith.ray@gmail.com (Keith Ray) // // Google Test filepath utilities // // This file tests classes and functions used internally by // Google Test. They are subject to change without notice. // -// This file is #included from gtest_unittest.cc, to avoid changing -// build or make-files for some existing Google Test clients. Do not -// #include this file anywhere else! +// This file is #included from gtest-internal.h. +// Do not #include this file anywhere else! #include "gtest/internal/gtest-filepath.h" #include "gtest/gtest.h" diff --git a/googletest/test/gtest-options_test.cc b/googletest/test/gtest-options_test.cc index 70f3ce9..25c9f39 100644 --- a/googletest/test/gtest-options_test.cc +++ b/googletest/test/gtest-options_test.cc @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Authors: keith.ray@gmail.com (Keith Ray) // // Google Test UnitTestOptions tests // diff --git a/googletest/test/gtest-param-test2_test.cc b/googletest/test/gtest-param-test2_test.cc index e7afdc3..0c09b27 100644 --- a/googletest/test/gtest-param-test2_test.cc +++ b/googletest/test/gtest-param-test2_test.cc @@ -59,3 +59,4 @@ INSTANTIATE_TEST_CASE_P(MultiplesOf33, INSTANTIATE_TEST_CASE_P(Sequence2, InstantiationInMultipleTranslaionUnitsTest, Values(42*3, 42*4, 42*5)); + diff --git a/googletest/test/gtest-port_test.cc b/googletest/test/gtest-port_test.cc index 2c59edc..4ed4afc 100644 --- a/googletest/test/gtest-port_test.cc +++ b/googletest/test/gtest-port_test.cc @@ -67,8 +67,8 @@ TEST(IsXDigitTest, WorksForNarrowAscii) { } TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) { - EXPECT_FALSE(IsXDigit('\x80')); - EXPECT_FALSE(IsXDigit(static_cast('0' | '\x80'))); + EXPECT_FALSE(IsXDigit(static_cast(0x80))); + EXPECT_FALSE(IsXDigit(static_cast('0' | 0x80))); } TEST(IsXDigitTest, WorksForWideAscii) { diff --git a/googletest/test/gtest_break_on_failure_unittest_.cc b/googletest/test/gtest_break_on_failure_unittest_.cc index dd07478..1231ec2 100644 --- a/googletest/test/gtest_break_on_failure_unittest_.cc +++ b/googletest/test/gtest_break_on_failure_unittest_.cc @@ -80,8 +80,7 @@ int main(int argc, char **argv) { SetUnhandledExceptionFilter(ExitWithExceptionCode); # endif -#endif - +#endif // GTEST_OS_WINDOWS testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc index 6aaba97..c7ccc21 100644 --- a/googletest/test/gtest_output_test_.cc +++ b/googletest/test/gtest_output_test_.cc @@ -168,6 +168,16 @@ void SubWithTrace(int n) { SubWithoutTrace(n); } +TEST(SCOPED_TRACETest, AcceptedValues) { + SCOPED_TRACE("literal string"); + SCOPED_TRACE(std::string("std::string")); + SCOPED_TRACE(1337); // streamable type + const char* null_value = NULL; + SCOPED_TRACE(null_value); + + ADD_FAILURE() << "Just checking that all these values work fine."; +} + // Tests that SCOPED_TRACE() obeys lexical scopes. TEST(SCOPED_TRACETest, ObeysScopes) { printf("(expected to fail)\n"); diff --git a/googletest/test/gtest_repeat_test.cc b/googletest/test/gtest_repeat_test.cc index dcaadd7..b9e65e4 100644 --- a/googletest/test/gtest_repeat_test.cc +++ b/googletest/test/gtest_repeat_test.cc @@ -210,6 +210,7 @@ void TestRepeatWithFilterForFailedTests(int repeat) { int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); + testing::AddGlobalTestEnvironment(new MyEnvironment); TestRepeatUnspecified(); diff --git a/googletest/test/gtest_stress_test.cc b/googletest/test/gtest_stress_test.cc index 59a1b62..cac405f 100644 --- a/googletest/test/gtest_stress_test.cc +++ b/googletest/test/gtest_stress_test.cc @@ -34,7 +34,6 @@ #include "gtest/gtest.h" -#include #include #include "src/gtest-internal-inl.h" diff --git a/googletest/test/gtest_xml_outfile1_test_.cc b/googletest/test/gtest_xml_outfile1_test_.cc index 531ced4..e3d1dd1 100644 --- a/googletest/test/gtest_xml_outfile1_test_.cc +++ b/googletest/test/gtest_xml_outfile1_test_.cc @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Author: keith.ray@gmail.com (Keith Ray) // // gtest_xml_outfile1_test_ writes some xml via TestProperty used by // gtest_xml_outfiles_test.py diff --git a/googletest/test/gtest_xml_outfile2_test_.cc b/googletest/test/gtest_xml_outfile2_test_.cc index 7b400b2..55eb8f3 100644 --- a/googletest/test/gtest_xml_outfile2_test_.cc +++ b/googletest/test/gtest_xml_outfile2_test_.cc @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Author: keith.ray@gmail.com (Keith Ray) // // gtest_xml_outfile2_test_ writes some xml via TestProperty used by // gtest_xml_outfiles_test.py diff --git a/googletest/test/gtest_xml_output_unittest_.cc b/googletest/test/gtest_xml_output_unittest_.cc index 48b8771..2ee8838 100644 --- a/googletest/test/gtest_xml_output_unittest_.cc +++ b/googletest/test/gtest_xml_output_unittest_.cc @@ -27,8 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Author: eefacm@gmail.com (Sean Mcafee) - // Unit test for Google Test XML output. // // A user can specify XML output in a Google Test program to run via -- cgit v0.12 From d3acb4ba18a545b168c106d264dd54c591c11cc7 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Fri, 5 Jan 2018 09:32:50 -0500 Subject: Fixed output and test for 'enabled_on_pr' --- appveyor.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 804e3ec..f2cde6d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -52,15 +52,13 @@ install: - ps: | Write-Output "Compiler: $env:compiler" Write-Output "Generator: $env:generator" - Write-Output "Pull Request: <$env:APPVEYOR_PULL_REQUEST_NUMBER>" - Write-Output "Enabled on PR: <$env:enabled_on_pr>" if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) { + Write-Output "This is *NOT* a pull request build" + } else { Write-Output "This is a pull request build" if (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes") { Write-Output "PR builds are *NOT* explicitly enabled" } - } else { - Write-Output "This is *NOT* a pull request build" } # git bash conflicts with MinGW makefiles @@ -74,7 +72,7 @@ install: build_script: - ps: | # Only enable some builds for pull requests, the AppVeyor queue is too long. - if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "")) { + if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { return } md _build -Force | Out-Null @@ -96,7 +94,7 @@ build_script: test_script: - ps: | # Only enable some builds for pull requests, the AppVeyor queue is too long. - if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "")) { + if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { return } if ($env:generator -eq "MinGW Makefiles") { -- cgit v0.12 From adfdc65ca7ed813cfb72f290f9aa2f2a1ca5bc26 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Fri, 5 Jan 2018 11:01:37 -0500 Subject: Fixed test for pull request. --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f2cde6d..f73f413 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -72,7 +72,7 @@ install: build_script: - ps: | # Only enable some builds for pull requests, the AppVeyor queue is too long. - if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { + if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { return } md _build -Force | Out-Null @@ -94,7 +94,7 @@ build_script: test_script: - ps: | # Only enable some builds for pull requests, the AppVeyor queue is too long. - if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { + if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { return } if ($env:generator -eq "MinGW Makefiles") { -- cgit v0.12 From 67476c1426dc520f1ff0eb16e6c00d050d489721 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 5 Jan 2018 12:35:41 -0500 Subject: Revert one file for now --- googletest/test/gtest_output_test_.cc | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc index c7ccc21..6aaba97 100644 --- a/googletest/test/gtest_output_test_.cc +++ b/googletest/test/gtest_output_test_.cc @@ -168,16 +168,6 @@ void SubWithTrace(int n) { SubWithoutTrace(n); } -TEST(SCOPED_TRACETest, AcceptedValues) { - SCOPED_TRACE("literal string"); - SCOPED_TRACE(std::string("std::string")); - SCOPED_TRACE(1337); // streamable type - const char* null_value = NULL; - SCOPED_TRACE(null_value); - - ADD_FAILURE() << "Just checking that all these values work fine."; -} - // Tests that SCOPED_TRACE() obeys lexical scopes. TEST(SCOPED_TRACETest, ObeysScopes) { printf("(expected to fail)\n"); -- cgit v0.12 From 67d6e467285d7765d3df60093d23ba3b86838470 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Fri, 5 Jan 2018 14:58:48 -0500 Subject: Use correct name for build event types. --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8142575..180728a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,19 +38,19 @@ matrix: - os: osx compiler: gcc env: BUILD_TYPE=Debug VERBOSE=1 - if: event != pull_request + if: type != pull_request - os: osx compiler: gcc env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 - if: event != pull_request + if: type != pull_request - os: osx compiler: clang env: BUILD_TYPE=Debug VERBOSE=1 - if: event != pull_request + if: type != pull_request - os: osx compiler: clang env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 - if: event != pull_request + if: type != pull_request # These are the install and build (script) phases for the most common entries in the matrix. They could be included # in each entry in the matrix, but that is just repetitive. -- cgit v0.12 From 91ba05cc360a81a64cea53be1fe752944249d14c Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Mon, 8 Jan 2018 16:14:06 -0500 Subject: Small cleanups, merge --- googletest/samples/sample4_unittest.cc | 5 ++++- googletest/samples/sample5_unittest.cc | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/googletest/samples/sample4_unittest.cc b/googletest/samples/sample4_unittest.cc index 948266e..7bf9ea3 100644 --- a/googletest/samples/sample4_unittest.cc +++ b/googletest/samples/sample4_unittest.cc @@ -29,10 +29,12 @@ // // Author: wan@google.com (Zhanyong Wan) -#include "gtest/gtest.h" #include "sample4.h" +#include "gtest/gtest.h" + namespace { // Tests the Increment() method. + TEST(Counter, Increment) { Counter c; @@ -43,4 +45,5 @@ TEST(Counter, Increment) { EXPECT_EQ(1, c.Increment()); EXPECT_EQ(2, c.Increment()); } + } // namespace diff --git a/googletest/samples/sample5_unittest.cc b/googletest/samples/sample5_unittest.cc index 3099930..401a58a 100644 --- a/googletest/samples/sample5_unittest.cc +++ b/googletest/samples/sample5_unittest.cc @@ -46,9 +46,9 @@ #include #include -#include "sample3-inl.h" #include "gtest/gtest.h" #include "sample1.h" +#include "sample3-inl.h" namespace { // In this sample, we want to ensure that every test finishes within // ~5 seconds. If a test takes longer to run, we consider it a -- cgit v0.12 From cbd15d417e9a9b8dfbac4483d49b4e0c6664b940 Mon Sep 17 00:00:00 2001 From: Loo Rong Jie Date: Sun, 7 Jan 2018 22:52:52 +0800 Subject: [Bazel] Detect Windows with cpu value x64_windows and x64_windows_msvc and x64_windows_msvc --- BUILD.bazel | 13 ++++++++++--- googlemock/test/BUILD.bazel | 3 ++- googletest/test/BUILD.bazel | 9 ++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 922ce04..7d2e9d2 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -37,7 +37,12 @@ package(default_visibility = ["//visibility:public"]) licenses(["notice"]) config_setting( - name = "win", + name = "windows", + values = { "cpu": "x64_windows" }, +) + +config_setting( + name = "windows_msvc", values = {"cpu": "x64_windows_msvc"}, ) @@ -65,7 +70,8 @@ cc_library( ]), copts = select( { - ":win": [], + ":windows": [], + ":windows_msvc": [], "//conditions:default": ["-pthread"], }, ), @@ -76,7 +82,8 @@ cc_library( "googletest/include", ], linkopts = select({ - ":win": [], + ":windows": [], + ":windows_msvc": [], "//conditions:default": [ "-pthread", ], diff --git a/googlemock/test/BUILD.bazel b/googlemock/test/BUILD.bazel index 9f1a64d..4c2df9e 100644 --- a/googlemock/test/BUILD.bazel +++ b/googlemock/test/BUILD.bazel @@ -45,7 +45,8 @@ cc_test( ], ), linkopts = select({ - "//:win": [], + "//:windows": [], + "//:windows_msvc": [], "//conditions:default": [ "-pthread", ], diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 5daa154..62b88da 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -57,13 +57,15 @@ cc_test( "gtest-param-test_test.cc", ], ) + select({ - "//:win": [], + "//:windows": [], + "//:windows_msvc": [], "//conditions:default": [ "gtest-tuple_test.cc", ], }), copts = select({ - "//:win": ["-DGTEST_USE_OWN_TR1_TUPLE=0"], + "//:windows": ["-DGTEST_USE_OWN_TR1_TUPLE=0"], + "//:windows_msvc": ["-DGTEST_USE_OWN_TR1_TUPLE=0"], "//conditions:default": ["-DGTEST_USE_OWN_TR1_TUPLE=1"], }), includes = [ @@ -73,7 +75,8 @@ cc_test( "googletest/test", ], linkopts = select({ - "//:win": [], + "//:windows": [], + "//:windows_msvc": [], "//conditions:default": [ "-pthread", ], -- cgit v0.12 From 258fd6e16820ea6c3d9a1ccd4c7d7ffc8ec38e40 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Tue, 9 Jan 2018 13:59:27 -0500 Subject: cleanup, merge --- googletest/include/gtest/internal/custom/gtest-port.h | 3 +++ googletest/include/gtest/internal/custom/gtest.h | 2 +- googletest/include/gtest/internal/gtest-death-test-internal.h | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/googletest/include/gtest/internal/custom/gtest-port.h b/googletest/include/gtest/internal/custom/gtest-port.h index c85f5d5..94884c1 100644 --- a/googletest/include/gtest/internal/custom/gtest-port.h +++ b/googletest/include/gtest/internal/custom/gtest-port.h @@ -61,6 +61,9 @@ // GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) // GTEST_LOCK_EXCLUDED_(locks) // +// Underlying library support features: +// GTEST_HAS_CXXABI_H_ +// // Exporting API symbols: // GTEST_API_ - Specifier for exported symbols. // diff --git a/googletest/include/gtest/internal/custom/gtest.h b/googletest/include/gtest/internal/custom/gtest.h index a7a1c0b..6f7c5e4 100644 --- a/googletest/include/gtest/internal/custom/gtest.h +++ b/googletest/include/gtest/internal/custom/gtest.h @@ -36,7 +36,7 @@ // GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir(). // See testing::TempDir for semantics and // signature. -// +// // ** Custom implementation starts here ** #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ diff --git a/googletest/include/gtest/internal/gtest-death-test-internal.h b/googletest/include/gtest/internal/gtest-death-test-internal.h index 2b3a78f..8907f6f 100644 --- a/googletest/include/gtest/internal/gtest-death-test-internal.h +++ b/googletest/include/gtest/internal/gtest-death-test-internal.h @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee) // // The Google C++ Testing Framework (Google Test) // -- cgit v0.12