From: Kefu Chai Date: Mon, 7 Jun 2021 07:09:42 +0000 (+0800) Subject: cmake: do not print warning in each cmake run X-Git-Tag: v17.1.0~1727^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F41725%2Fhead;p=ceph.git cmake: do not print warning in each cmake run 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 --- diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 0d64ae7f762..28d1f7849de 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -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()