From 30c0e16cddf93e662a9a00cb917386a538858ab1 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Fri, 29 Apr 2022 13:31:01 -0700 Subject: [PATCH 1/2] Disable test on prometheus-cpp which not need --- CMakeLists.txt | 6 +++++- exporters/prometheus/test/CMakeLists.txt | 24 +++++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09c21fd678..dcf97a6f4b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,7 +274,10 @@ if(WITH_PROMETHEUS) if(NOT prometheus-cpp_FOUND) message("Trying to use local prometheus-cpp from submodule") if(EXISTS ${PROJECT_SOURCE_DIR}/third_party/prometheus-cpp/.git) + set(SAVED_ENABLE_TESTING ${ENABLE_TESTING}) + set(ENABLE_TESTING OFF) add_subdirectory(third_party/prometheus-cpp) + set(ENABLE_TESTING ${SAVED_ENABLE_TESTING}) else() message( FATAL_ERROR @@ -361,7 +364,8 @@ if(BUILD_TESTING) ${CMAKE_BINARY_DIR}/lib/libgmock.a) elseif(WIN32) # Make sure we are always bootsrapped with vcpkg on Windows - find_package(GTest) + # set(CMAKE_FIND_DEBUG_MODE TRUE) + find_package(GTest REQUIRED) if(NOT (GTEST_FOUND OR GTest_FOUND)) install_windows_deps() find_package(GTest REQUIRED) diff --git a/exporters/prometheus/test/CMakeLists.txt b/exporters/prometheus/test/CMakeLists.txt index 6c45e9299c..1a22469792 100644 --- a/exporters/prometheus/test/CMakeLists.txt +++ b/exporters/prometheus/test/CMakeLists.txt @@ -1,11 +1,13 @@ -foreach(testname prometheus_exporter_test prometheus_collector_test - prometheus_exporter_utils_test) - add_executable(${testname} "${testname}.cc") - target_link_libraries( - ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - prometheus_exporter_deprecated prometheus-cpp::pull) - gtest_add_tests( - TARGET ${testname} - TEST_PREFIX exporter. - TEST_LIST ${testname}) -endforeach() +if(WITH_METRICS_PREVIEW) + foreach(testname prometheus_exporter_test prometheus_collector_test + prometheus_exporter_utils_test) + add_executable(${testname} "${testname}.cc") + target_link_libraries( + ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + prometheus_exporter_deprecated prometheus-cpp::pull) + gtest_add_tests( + TARGET ${testname} + TEST_PREFIX exporter. + TEST_LIST ${testname}) + endforeach() +endif() From c21f0e3d9571a6b18a762899411ed7185e73660c Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Mon, 2 May 2022 11:25:13 -0700 Subject: [PATCH 2/2] Remove debug comment --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dcf97a6f4b..9840aa19a6 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,7 +364,6 @@ if(BUILD_TESTING) ${CMAKE_BINARY_DIR}/lib/libgmock.a) elseif(WIN32) # Make sure we are always bootsrapped with vcpkg on Windows - # set(CMAKE_FIND_DEBUG_MODE TRUE) find_package(GTest REQUIRED) if(NOT (GTEST_FOUND OR GTest_FOUND)) install_windows_deps()