Skip to content

Commit

Permalink
Remove Valgrind build dependency for profiling tests (#4986)
Browse files Browse the repository at this point in the history
* Refs #21219: Always build profilling tests executable if CMake option is set

Signed-off-by: eduponz <eduardoponz@eprosima.com>

* Refs #21219: Do not install Valgrind for profilling tests building in CI

Signed-off-by: eduponz <eduardoponz@eprosima.com>

---------

Signed-off-by: eduponz <eduardoponz@eprosima.com>
  • Loading branch information
EduPonz authored Jun 24, 2024
1 parent 869fee3 commit ab47069
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/reusable-ubuntu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ jobs:
- name: Install apt dependencies
uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0
with:
packages: libasio-dev libtinyxml2-dev libssl-dev valgrind
packages: libasio-dev libtinyxml2-dev libssl-dev
update: false
upgrade: false

Expand Down
5 changes: 1 addition & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ endif()
# Profiling tests using valgrind
###############################################################################
if(NOT ((MSVC OR MSVC_IDE)) AND PROFILING_TESTS)
find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
if(CTEST_MEMORYCHECK_COMMAND)
add_subdirectory(profiling)
endif()
add_subdirectory(profiling)
endif()

###############################################################################
Expand Down
12 changes: 10 additions & 2 deletions test/profiling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ if(Python3_Interpreter_FOUND)
###############################################################################
# MemoryTest
###############################################################################
find_program(VALGRIND_PROGRAM NAMES valgrind)

# If valgrind is not found, set it to "valgrind" so that the test can be run with
# the appropriate environment set at runtime.
if (${VALGRIND_PROGRAM} STREQUAL "valgrind-NOTFOUND")
set(VALGRIND_PROGRAM "valgrind")
endif()

add_test(NAME MemoryTest
COMMAND ${Python3_EXECUTABLE} memory_tests.py)

Expand All @@ -67,7 +75,7 @@ if(Python3_Interpreter_FOUND)
set_property(TEST MemoryTest APPEND PROPERTY ENVIRONMENT
"PROFILING_BINS=$<TARGET_FILE:MemoryTest>")
set_property(TEST MemoryTest APPEND PROPERTY ENVIRONMENT
"VALGRIND_BIN=${CTEST_MEMORYCHECK_COMMAND}")
"VALGRIND_BIN=${VALGRIND_PROGRAM}")
if(SECURITY)
set_property(TEST MemoryTest APPEND PROPERTY ENVIRONMENT
"CERTS_PATH=${PROJECT_SOURCE_DIR}/test/certs")
Expand All @@ -89,7 +97,7 @@ if(Python3_Interpreter_FOUND)
set_property(TEST CyclesTest APPEND PROPERTY ENVIRONMENT
"PROFILING_BINS=$<TARGET_FILE:MemoryTest>")
set_property(TEST CyclesTest APPEND PROPERTY ENVIRONMENT
"VALGRIND_BIN=valgrind")
"VALGRIND_BIN=${VALGRIND_PROGRAM}")
if(SECURITY)
set_property(TEST CyclesTest APPEND PROPERTY ENVIRONMENT
"CERTS_PATH=${PROJECT_SOURCE_DIR}/test/certs")
Expand Down

0 comments on commit ab47069

Please sign in to comment.