Add option for address sanitizer in tests, fixes valgrind in drone
continuous-integration/drone/push Build encountered an error Details

This commit is contained in:
Deukhoofd 2022-03-22 18:16:00 +01:00
parent 47cc77f0e5
commit 0acc1a2c8e
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 15 additions and 3 deletions

View File

@ -28,6 +28,15 @@ steps:
- cmake --build build-release --target all -- -j 4
- build-release/CreatureLibTests -s --duration=true --force-colors=true
- valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --leak-resolution=med --track-origins=yes --vgdb=no --error-exitcode=1 build-release/CreatureLibTests ~\[Exception\]
- name: test-release-linux
image: deukhoofd/linux64builder
environment:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
commands:
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ . -B build-release_valgrind -DSTATICC=ON -DCREATURELIB_TESTS=ON -DSANITIZER_TESTS=OFF
- cmake --build build-release_valgrind --target all -- -j 4
- valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --leak-resolution=med --track-origins=yes --vgdb=no --error-exitcode=1 build-release_valgrind/CreatureLibTests ~\[Exception\]
- name: test-release-windows
image: deukhoofd/windowsbuilder
commands:
@ -54,6 +63,6 @@ steps:
- ( cat Doxyfile ; echo "OUTPUT_DIRECTORY=/docs"; echo "GENERATE_TAGFILE=/docs/html/CreatureLib.tag" ) | doxygen -
---
kind: signature
hmac: 898d10cca3267eb3643779b10100aeccef4f5066b7895fdb8758448641ff4705
hmac: e77a3d4ab7ab136185b738a362354081ae86a7909e7f5c6c2610a06c1b3f568a
...

View File

@ -12,6 +12,7 @@ set(CMAKE_CXX_STANDARD 20)
option(WINDOWS "Whether the build target is Windows or not." OFF)
option(SHARED "Whether we should build a shared library, instead of a static one." OFF)
option(CREATURELIB_TESTS "Whether the test executable should be build as well." OFF)
option(SANITIZER_TESTS "Whether the test executable should be built using address sanitizer." ON)
option(STATICC "Whether gcc and stdc++ should be linked statically to the library." OFF)
set(LEVEL_SIZE "8" CACHE STRING "Number of bits to store the level as. Currently reserved, and can only be 8")
@ -125,6 +126,8 @@ if (CREATURELIB_TESTS)
# Add a definition for the test library
target_compile_definitions(CreatureLibTests PRIVATE TESTS_BUILD)
target_compile_options(CreatureLibTests PRIVATE -fsanitize=address)
target_link_options(CreatureLibTests PRIVATE -fsanitize=address)
if (SANITIZER_TESTS AND NOT WINDOWS)
target_compile_options(CreatureLibTests PRIVATE -fsanitize=address)
target_link_options(CreatureLibTests PRIVATE -fsanitize=address)
endif ()
endif ()