diff --git a/CMakeLists.txt b/CMakeLists.txt index 352618fa5..e57d8c142 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,6 +188,8 @@ int main(void) } " HAVE___SYNC_VAL_COMPARE_AND_SWAP) +cmake_push_check_state (RESET) +set (CMAKE_REQUIRED_LIBRARIES Threads::Threads) check_cxx_source_compiles (" #define _XOPEN_SOURCE 500 #include @@ -199,6 +201,7 @@ int main(void) return 0; } " HAVE_RWLOCK) +cmake_pop_check_state () check_cxx_source_compiles (" __declspec(selectany) int a; @@ -830,7 +833,7 @@ if (BUILD_TESTING) set_tests_properties (logging PROPERTIES TIMEOUT 30) -# FIXME: Skip flaky test + # FIXME: Skip flaky test set_tests_properties (logging PROPERTIES SKIP_REGULAR_EXPRESSION "Check failed: time_ns within LogTimes::LOG_PERIOD_TOL_NS of LogTimes::LOG_PERIOD_NS") @@ -855,6 +858,17 @@ if (BUILD_TESTING) add_test (NAME symbolize COMMAND symbolize_unittest) endif (TARGET symbolize_unittest) + if (HAVE_LIB_GMOCK) + add_executable (mock-log_unittest + src/mock-log_unittest.cc + src/mock-log.h + ) + + target_link_libraries (mock-log_unittest PRIVATE ${_GLOG_TEST_LIBS}) + + add_test (NAME mock-log COMMAND mock-log_unittest) + endif (HAVE_LIB_GMOCK) + # Generate an initial cache get_cache_variables (_CACHEVARS) diff --git a/src/mock-log.h b/src/mock-log.h index 5b0ea0af8..f172e0cd4 100644 --- a/src/mock-log.h +++ b/src/mock-log.h @@ -72,7 +72,7 @@ class ScopedMockLog : public GOOGLE_NAMESPACE::LogSink { ScopedMockLog() { AddLogSink(this); } // When the object is destructed, it stops intercepting logs. - virtual ~ScopedMockLog() { RemoveLogSink(this); } + ~ScopedMockLog() { RemoveLogSink(this); } // Implements the mock method: // diff --git a/src/mock-log_test.cc b/src/mock-log_unittest.cc similarity index 97% rename from src/mock-log_test.cc rename to src/mock-log_unittest.cc index 7d58a307c..88f6996c5 100644 --- a/src/mock-log_test.cc +++ b/src/mock-log_unittest.cc @@ -55,7 +55,7 @@ TEST(ScopedMockLogTest, InterceptsLog) { ScopedMockLog log; InSequence s; - EXPECT_CALL(log, Log(WARNING, HasSubstr("/mock-log_test.cc"), "Fishy.")); + EXPECT_CALL(log, Log(WARNING, HasSubstr("/mock-log_unittest.cc"), "Fishy.")); EXPECT_CALL(log, Log(INFO, _, "Working...")) .Times(2); EXPECT_CALL(log, Log(ERROR, _, "Bad!!"));