tests: Only run valgrind tests if valgrind was found

valgrind is not present on all architectures (eg riscv64) and might
not be installed even on supported architectures.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
This commit is contained in:
Richard W.M. Jones 2024-02-14 12:12:39 +00:00 committed by Milo Yip
parent 3f73edae00
commit 68afb49287
2 changed files with 3 additions and 1 deletions

View File

@ -66,6 +66,8 @@ if(CCACHE_FOUND)
endif() endif()
endif(CCACHE_FOUND) endif(CCACHE_FOUND)
find_program(VALGRIND_FOUND valgrind)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(RAPIDJSON_ENABLE_INSTRUMENTATION_OPT AND NOT CMAKE_CROSSCOMPILING) if(RAPIDJSON_ENABLE_INSTRUMENTATION_OPT AND NOT CMAKE_CROSSCOMPILING)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le") if(CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")

View File

@ -80,7 +80,7 @@ add_test(NAME unittest
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
if(NOT MSVC) if(NOT MSVC AND VALGRIND_FOUND)
# Not running SIMD.* unit test cases for Valgrind # Not running SIMD.* unit test cases for Valgrind
add_test(NAME valgrind_unittest add_test(NAME valgrind_unittest
COMMAND valgrind --suppressions=${CMAKE_SOURCE_DIR}/test/valgrind.supp --leak-check=full --error-exitcode=1 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest --gtest_filter=-SIMD.* COMMAND valgrind --suppressions=${CMAKE_SOURCE_DIR}/test/valgrind.supp --leak-check=full --error-exitcode=1 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest --gtest_filter=-SIMD.*