Skip to content

Commit 7d2a12a

Browse files
committed
setpointer test: disable LeakSanitizer for the nocmodl codegen step
Under an AddressSanitizer build, running nocmodl to generate ptrtest.cpp tripped LeakSanitizer (nocmodl leaks) and failed the custom command. Add NRN_NOCMODL_SANITIZER_ENVIRONMENT before the nocmodl invocation, the same way cmake/MacroHelper.cmake's nocmodl_mod_to_cpp does for built-in mods.
1 parent f69b8b6 commit 7d2a12a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

test/api/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ endforeach()
2525

2626
# The nrn_setpointer test needs a mechanism with a POINTER, which no built-in provides. Generate one
2727
# from ptrtest.mod with nocmodl and compile it into the test executable, the same codegen path nrniv
28-
# uses for its built-in mechanisms.
28+
# uses for its built-in mechanisms. NRN_NOCMODL_SANITIZER_ENVIRONMENT disables LeakSanitizer for the
29+
# nocmodl run (nocmodl leaks, which would otherwise fail the generation step under an asan build),
30+
# matching nocmodl_mod_to_cpp in cmake/MacroHelper.cmake.
2931
set(setpointer_mod "${CMAKE_CURRENT_SOURCE_DIR}/ptrtest.mod")
3032
set(setpointer_mod_copy "${CMAKE_CURRENT_BINARY_DIR}/ptrtest.mod")
3133
set(setpointer_gen "${CMAKE_CURRENT_BINARY_DIR}/ptrtest.cpp")
@@ -34,8 +36,9 @@ add_custom_command(
3436
OUTPUT ${setpointer_gen}
3537
COMMAND
3638
${CMAKE_COMMAND} -E env "MODLUNIT=${PROJECT_BINARY_DIR}/share/nrn/lib/nrnunits.lib"
37-
"NMODLHOME=${PROJECT_BINARY_DIR}" $<TARGET_FILE:${NRN_CODEGENERATOR_TARGET}>
38-
${setpointer_mod_copy} ${NRN_NMODL_--neuron} -o ${CMAKE_CURRENT_BINARY_DIR}
39+
"NMODLHOME=${PROJECT_BINARY_DIR}" ${NRN_NOCMODL_SANITIZER_ENVIRONMENT}
40+
$<TARGET_FILE:${NRN_CODEGENERATOR_TARGET}> ${setpointer_mod_copy} ${NRN_NMODL_--neuron} -o
41+
${CMAKE_CURRENT_BINARY_DIR}
3942
DEPENDS ${NRN_CODEGENERATOR_TARGET} ${setpointer_mod}
4043
${PROJECT_BINARY_DIR}/share/nrn/lib/nrnunits.lib
4144
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

0 commit comments

Comments
 (0)