Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add checking with valgrind #67

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pipeline {
}
steps {
sh 'ccache --zero-stats'
sh 'rm -rf build && mkdir -p build && cd build && cmake -D CMAKE_INSTALL_PREFIX=$ARBORX_DIR -D CMAKE_BUILD_TYPE=Debug -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER=$KOKKOS_DIR/bin/nvcc_wrapper -D CMAKE_PREFIX_PATH="$KOKKOS_DIR;$BOOST_DIR;$BENCHMARK_DIR" -D ArborX_ENABLE_MPI=ON -D MPIEXEC_PREFLAGS="--allow-run-as-root" .. && make -j8 VERBOSE=1 && ctest --no-compress-output -T Test'
sh 'rm -rf build && mkdir -p build && cd build && cmake -D CMAKE_INSTALL_PREFIX=$ARBORX_DIR -D CMAKE_BUILD_TYPE=Debug -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER=$KOKKOS_DIR/bin/nvcc_wrapper -D CMAKE_PREFIX_PATH="$KOKKOS_DIR;$BOOST_DIR;$BENCHMARK_DIR" -D ArborX_ENABLE_MPI=ON -D ArborX_TEST_MEMORY=ON -D MPIEXEC_PREFLAGS="--allow-run-as-root" .. && make -j8 VERBOSE=1 && ctest --no-compress-output -T Test && ctest --no-compress-output -T memcheck'
}
post {
always {
Expand All @@ -47,7 +47,7 @@ pipeline {
}
steps {
sh 'ccache --zero-stats'
sh 'rm -rf build && mkdir -p build && cd build && cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_PREFIX_PATH="$KOKKOS_DIR;$BOOST_DIR;$BENCHMARK_DIR" -D ArborX_ENABLE_MPI=ON -D MPIEXEC_PREFLAGS="--allow-run-as-root" .. && make -j8 VERBOSE=1 && ctest --no-compress-output -T Test'
sh 'rm -rf build && mkdir -p build && cd build && cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_PREFIX_PATH="$KOKKOS_DIR;$BOOST_DIR;$BENCHMARK_DIR" -D ArborX_ENABLE_MPI=ON -D ArborX_TEST_MEMORY=ON -D MPIEXEC_PREFLAGS="--allow-run-as-root" .. && make -j8 VERBOSE=1 && ctest --no-compress-output -T Test && ctest --no-compress-output -T memcheck'
}
post {
always {
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ install(DIRECTORY ${PROJECT_BINARY_DIR}/include/ DESTINATION include

option(ArborX_ENABLE_TESTS "Enable tests" ON)
option(ArborX_ENABLE_EXAMPLES "Enable examples" ON)
option(ArborX_TEST_MEMORY "Enable memory checks in tests" OFF)

if(${ArborX_ENABLE_TESTS} OR ${ArborX_ENABLE_EXAMPLES})
enable_testing()
include(CTest)
endif()

if(${ArborX_ENABLE_TESTS})
Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN apt-get update && apt-get install -y \
libicu-dev \
python-dev \
autotools-dev \
valgrind \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
Expand Down
9 changes: 9 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
IF(ArborX_TEST_MEMORY)
FIND_PROGRAM(MEMORYCHECK_COMMAND NAMES valgrind)
IF(MEMORYCOMMAND MATCHES "-NOTFOUND")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo. You'd have caught it if you did if(VAR)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also use lowercase for CMake calls for consistency

MESSAGE(FATAL_ERROR
"Memory checking in tests enabled but could not find the valgrind "
"executable. Please install valgrind.")
ENDIF()
SET(CTEST_MEMORYCHECK_COMMAND "${MEMORYCHECK_COMMAND}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this variable is needed at all if we do ctest -T MemCheck?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so, but it seems to run without it as well now.

ENDIF()

set(ARBORX_DEVICE_TYPES)
if(Kokkos_DEVICES MATCHES "Serial")
Expand Down