]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: do not print warning in each cmake run 41725/head
authorKefu Chai <kchai@redhat.com>
Mon, 7 Jun 2021 07:09:42 +0000 (15:09 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 7 Jun 2021 07:13:12 +0000 (15:13 +0800)
cmake prints the warning of

> run-promtool-unittests is skipped due to missing promtool

everytime if the test is skipped per the test. but we only need to
get this message the first time cmake is executed. more importantly,
the value of `PROMTOOL_EXECUTABLE` is cached. so the new error message
does not provide updated information, so just stop doing so if the
cached variable is found.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/CMakeLists.txt

index 0d64ae7f7621b6ecfe7bc6d44a014a66463c82d2..28d1f7849de3c54863bb2e780a037914541be103 100644 (file)
@@ -606,6 +606,10 @@ add_ceph_test(run-cli-tests ${CMAKE_CURRENT_SOURCE_DIR}/run-cli-tests)
 
 add_ceph_test(smoke.sh ${CMAKE_CURRENT_SOURCE_DIR}/smoke.sh)
 
+if(DEFINED PROMTOOL_EXECUTABLE)
+  set(promtool_executable_checked TRUE)
+endif()
+
 find_program(PROMTOOL_EXECUTABLE promtool)
 if(PROMTOOL_EXECUTABLE)
   execute_process(
@@ -615,11 +619,11 @@ if(PROMTOOL_EXECUTABLE)
   if(NOT rc)
     add_ceph_test(run-promtool-unittests
       ${PROMTOOL_EXECUTABLE} test rules ${CMAKE_SOURCE_DIR}/monitoring/prometheus/alerts/test_alerts.yml)
-  else()
+  elseif(NOT promtool_executable_checked)
     message(WARNING "'${PROMTOOL_EXECUTABLE} test rules' does not work, "
       "please use a newer prometheus")
   endif()
-else()
+elseif(NOT promtool_executable_checked)
   message(WARNING "run-promtool-unittests is skipped due to missing promtool")
 endif()