Commit 99749b16 authored by Baptiste Esteban's avatar Baptiste Esteban
Browse files

WIP pipeline memory checking

parent 354b1f1f
Pipeline #25919 canceled with stages
in 1 minute and 18 seconds
......@@ -128,8 +128,11 @@ distcheck-linux-clang10-debug:
PYLENE_CONFIGURATION: "Debug"
CXX: "clang++"
CC: "clang"
CCFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
CXXFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
ASAN: "ON"
MSAN: "OFF"
UBSAN: "ON"
#CCFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
#CXXFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
CONAN_PROFILE: "clang-10"
distcheck-linux-gcc10-release:
......@@ -152,8 +155,11 @@ distcheck-linux-gcc10-debug:
PYLENE_CONFIGURATION: "Debug"
CXX: "g++"
CC: "gcc"
CCFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
CXXFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
#CCFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
#CXXFLAGS: -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
ASAN: "ON"
MSAN: "OFF"
UBSAN: "ON"
CONAN_PROFILE: "gcc-10"
......
......@@ -4,5 +4,5 @@ pybind11_add_module(pylena)
target_link_libraries(pylena PRIVATE Pylene)
target_include_directories(pylena PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_sources(pylena PRIVATE src/module.cpp
src/core/image_cast.cpp
src/core/numpy_format.cpp)
\ No newline at end of file
src/core/image_cast.cpp
src/core/numpy_format.cpp)
\ No newline at end of file
......@@ -8,6 +8,18 @@ pybind11_add_module(pylena_test pylena_test.cpp
${PYTHON_PYLENE_SRC}/core/numpy_format.cpp)
target_link_libraries(pylena_test PRIVATE Pylene)
target_include_directories(pylena_test PRIVATE ${CMAKE_SOURCE_DIR}/pylene-python/include)
# Sanitizer (clang linked statically asan by default unlike gcc)
if ((SANITIZE_ADDRESS OR SANITIZE_UNDEFINED OR SANITIZE_MEMORY OR SANITIZE_THREAD))
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/python-suppression.supp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
target_compile_options(pylena_test PRIVATE -shared-libasan)
target_link_options(pylena_test PRIVATE -shared-libasan)
endif()
add_sanitizers(pylena_test)
file(COPY asan-pylena-test DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
set(SANITIZE_SCRIPT asan-pylena-test)
endif()
add_dependencies(build-tests pylena_test)
function(add_python_test filename)
......@@ -18,6 +30,6 @@ endfunction(add_python_test)
add_python_test(test_pylena_numpy.py)
add_test(NAME test_python
COMMAND ${PYTHON_EXECUTABLE} -m unittest discover
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
COMMAND ${SANITIZE_SCRIPT} ${PYTHON_EXECUTABLE} -m unittest discover
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_tests_properties(test_python PROPERTIES LABELS UnitTests)
\ No newline at end of file
#!/bin/sh
# Based on asan-wrapper script from RWTH Aachen University and Matthew Arsenault, for our specific usage
lib=$(echo pylena_test*.so)
libasan=$(ldd $lib | grep libasan | sed "s/^[[:space:]]//" | cut -d' ' -f1)
libasan_filename=$($CC --print-file-name=$libasan)
if [ -n "$libasan" ]
then
if [ -n "$LD_PRELOAD" ]
then
export LD_PRELOAD="$libasan_filename:$LD_PRELOAD"
else
export LD_PRELOAD="$libasan_filename"
fi
export PYTHONMALLOC=malloc
export LSAN_OPTIONS="suppressions=python-suppression.supp:print_suppressions=0"
fi
exec $@
\ No newline at end of file
leak:_PyObject_GC_NewVar
leak:PyCode_NewWithPosOnlyArgs
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment