Skip to content

Commit b157371

Browse files
committed
Add address sanitizer for msvc and in the ci.
1 parent daca757 commit b157371

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.github/workflows/windows-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
cd "$METACALL_PATH\build"
4848
cmd.exe /c "powershell ..\tools\metacall-configure.ps1 $Env:METACALL_BUILD_OPTIONS"
4949
env:
50-
METACALL_BUILD_OPTIONS: ${{ matrix.buildtype }} scripts ports tests python nodejs # ruby # netcore5 typescript file rpc wasm java c cobol rust examples dynamic install pack benchmarks # v8 coverage
50+
METACALL_BUILD_OPTIONS: ${{ matrix.buildtype }} scripts ports tests python nodejs sanitizer # ruby # netcore5 typescript file rpc wasm java c cobol rust examples dynamic install pack benchmarks # v8 coverage
5151

5252
- name: Build
5353
working-directory: ./build

cmake/CompileOptions.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,15 @@ if(WIN32 AND MSVC)
212212
add_compile_options(/Z7)
213213
endif()
214214
endif()
215+
216+
# Sanitizers
217+
if(OPTION_BUILD_THREAD_SANITIZER AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
218+
add_compile_options(/fsanitize=thread)
219+
elseif(OPTION_BUILD_SANITIZER AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
220+
add_compile_options(/fsanitize=address)
221+
elseif(OPTION_BUILD_MEMORY_SANITIZER AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
222+
add_compile_options(/fsanitize=memory)
223+
endif()
215224
endif()
216225

217226
if (PROJECT_OS_FAMILY MATCHES "unix")

0 commit comments

Comments
 (0)