Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:

- name: Build tests
run: |
cmake -S tests -B tests/build
# TODO: Use UBSan as well
cmake -DYEETMOUSETESTS_ASAN=ON -DYEETMOUSETESTS_NO_SANITIZE_RECOVER=ON -S tests -B tests/build
cmake --build tests/build
if: ${{ !cancelled() }}

Expand Down
1 change: 1 addition & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
23 changes: 23 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ project(YeetMouseTests)

set(CMAKE_CXX_STANDARD 17)

option(YEETMOUSETESTS_ASAN "Build YeetMouseTests with ASan enabled" OFF)
option(YEETMOUSETESTS_UBSAN "Build YeetMouseTests with UBSan enabled" OFF)
option(YEETMOUSETESTS_NO_SANITIZE_RECOVER "Exit immediately on all sanitizer errors" OFF)

# Add flags based on build type
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Configuring with debug flags.")
Expand All @@ -25,6 +29,25 @@ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
add_compile_definitions(__ppc64le__)
endif()


if(YEETMOUSETESTS_ASAN)
message(STATUS "Building with ASan enabled")
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
add_link_options(-fsanitize=address -fno-omit-frame-pointer)
endif()

if(YEETMOUSETESTS_UBSAN)
message(STATUS "Building with UBSan enabled")
add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer)
add_link_options(-fsanitize=undefined -fno-omit-frame-pointer)
endif()

if(YEETMOUSETESTS_NO_SANITIZE_RECOVER)
message(STATUS "Enabled -fno-sanitize-recover=all")
add_compile_options(-fno-sanitize-recover=all)
add_link_options(-fno-sanitize-recover=all)
endif()

add_executable(YeetMouseTests main.cpp
TestManager.cpp
Tests.cpp
Expand Down
Loading