Skip to content

Commit 0d6c046

Browse files
author
Roberto Di Remigio
committed
Valgrind and sanitizers in place. Have to test on stallo
Former-commit-id: 759e452
1 parent e4fe261 commit 0d6c046

17 files changed

+318
-560
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ list(APPEND CMAKE_MODULE_PATH
1313

1414
# Options
1515
option(ENABLE_BOUNDS_CHECK "Enable bounds check" OFF)
16-
option(ENABLE_CODE_COVERAGE "Enable code coverage" OFF)
1716
option(ENABLE_MPI "Enable MPI parallelization" OFF)
1817
option(ENABLE_OMP "Enable OpenMP parallelization" ON)
1918
option(ENABLE_UNIT_TESTS "Enable compilation of unit test suite" OFF)
@@ -29,6 +28,13 @@ option(ENABLE_GPU_DFCC "Enable GPU-DFCC plugin" OFF)
2928
option(ENABLE_PLUGINS "Enable plugins" ON)
3029
option(ENABLE_DUMMY_PLUGIN "Enable dummy plugin" OFF)
3130
option(ENABLE_CXX11_SUPPORT "Enable C++11 compiler support" ON)
31+
# Options for dashboard builds
32+
option(ENABLE_CODE_COVERAGE "Enable code coverage" OFF)
33+
option(ENABLE_MEMCHECK "Enable Valgrind memory check" OFF)
34+
option(ENABLE_ASAN "Enable address sanitizer" OFF)
35+
option(ENABLE_MSAN "Enable memory sanitizer" OFF)
36+
option(ENABLE_TSAN "Enable thread sanitizer" OFF)
37+
option(ENABLE_UBSAN "Enable undefined behaviour sanitizer" OFF)
3238

3339
set(EXTERNAL_LIBS)
3440

CTestCustom.cmake.in

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# vim:ft=cmake
2+
3+
set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full")
4+
set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE
5+
@CMAKE_BINARY_DIR@/valgrind-suppressions.txt)
6+
7+
set(CTEST_CUSTOM_WARNING_EXCEPTION
8+
${CTEST_CUSTOM_WARNING_EXCEPTION}
9+
"unused parameter"
10+
"warning: feupdateenv is not implemented"
11+
)
12+
13+
# Ignore the following tests
14+
#set(CTEST_CUSTOM_MEMCHECK_IGNORE
15+
# ${CTEST_CUSTOM_MEMCHECK_IGNORE}
16+
# TestFoo
17+
# )
18+
19+
#set (CTEST_CUSTOM_COVERAGE_EXCLUDE
20+
# ${CTEST_CUSTOM_COVERAGE_EXCLUDE}
21+
# Rabof.cpp
22+
# )

boost/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ add_custom_command(
100100
# Clean-up
101101
add_custom_command(
102102
OUTPUT boost.cleanedup
103-
COMMAND ${CMAKE_COMMAND} -E remove ${BOOST_BUILD_DIR}
103+
COMMAND ${CMAKE_COMMAND} -E remove_directory ${BOOST_BUILD_DIR}
104104
COMMAND ${CMAKE_COMMAND} -E touch ${PROJECT_BINARY_DIR}/boost/boost.cleanedup
105105
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/boost
106106
DEPENDS boost.installed

cdash/CDashASan.cmake

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# CTest script for address sanitizer (ASan) memcheck build and submission to dashboard
3+
# Warning: the correct flags are to be set through a separate (and prior) call to
4+
# the setup script!
5+
#
6+
# Written by Roberto Di Remigio November 2014
7+
#
8+
9+
find_program(HOSTNAME_COMMAND NAMES hostname)
10+
execute_process(COMMAND ${HOSTNAME_COMMAND}
11+
OUTPUT_VARIABLE CTEST_SITE
12+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
13+
14+
include(ProcessorCount)
15+
ProcessorCount(NCORES)
16+
if(NOT NCORES EQUAL 0)
17+
set(CTEST_BUILD_FLAGS -j${NCORES})
18+
else()
19+
set(NCORES 1)
20+
endif()
21+
22+
set(CTEST_MEMORYCHECK_TYPE "AddressSanitizer")
23+
ctest_start(Experimental)
24+
ctest_configure()
25+
ctest_build()
26+
ctest_test(PARALLEL_LEVEL ${NCORES})
27+
ctest_memcheck(PARALLEL_LEVEL ${NCORES})
28+
ctest_submit()
29+
30+
# vim:et:sw=4:ts=4:

cdash/CDashMSan.cmake

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# CTest script for memory sanitizer (MSan) memcheck build and submission to dashboard
3+
# Warning: the correct flags are to be set through a separate (and prior) call to
4+
# the setup script!
5+
#
6+
# Written by Roberto Di Remigio November 2014
7+
#
8+
9+
find_program(HOSTNAME_COMMAND NAMES hostname)
10+
execute_process(COMMAND ${HOSTNAME_COMMAND}
11+
OUTPUT_VARIABLE CTEST_SITE
12+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
13+
14+
include(ProcessorCount)
15+
ProcessorCount(NCORES)
16+
if(NOT NCORES EQUAL 0)
17+
set(CTEST_BUILD_FLAGS -j${NCORES})
18+
else()
19+
set(NCORES 1)
20+
endif()
21+
22+
set(CTEST_MEMORYCHECK_TYPE "MemorySanitizer")
23+
ctest_start(Experimental)
24+
ctest_configure()
25+
ctest_build()
26+
ctest_test(PARALLEL_LEVEL ${NCORES})
27+
ctest_memcheck(PARALLEL_LEVEL ${NCORES})
28+
ctest_submit()
29+
30+
# vim:et:sw=4:ts=4:

cdash/CDashTSan.cmake

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# CTest script for thread sanitizer (TSan) memcheck build and submission to dashboard
3+
# Warning: the correct flags are to be set through a separate (and prior) call to
4+
# the setup script!
5+
#
6+
# Written by Roberto Di Remigio November 2014
7+
#
8+
9+
find_program(HOSTNAME_COMMAND NAMES hostname)
10+
execute_process(COMMAND ${HOSTNAME_COMMAND}
11+
OUTPUT_VARIABLE CTEST_SITE
12+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
13+
14+
include(ProcessorCount)
15+
ProcessorCount(NCORES)
16+
if(NOT NCORES EQUAL 0)
17+
set(CTEST_BUILD_FLAGS -j${NCORES})
18+
else()
19+
set(NCORES 1)
20+
endif()
21+
22+
set(CTEST_MEMORYCHECK_TYPE "ThreadSanitizer")
23+
ctest_start(Experimental)
24+
ctest_configure()
25+
ctest_build()
26+
ctest_test(PARALLEL_LEVEL ${NCORES})
27+
ctest_memcheck(PARALLEL_LEVEL ${NCORES})
28+
ctest_submit()
29+
30+
# vim:et:sw=4:ts=4:

0 commit comments

Comments
 (0)