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>
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(
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()