Skip to content

Commit

Permalink
Add ASAN to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Sep 10, 2023
1 parent 193225d commit 033f1d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/linux-cmake-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ jobs:
linux-build:
name: Build and run tests on Linux using CMake
runs-on: ubuntu-latest
strategy:
matrix:
asan: ["ON", "OFF"]

steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -25,7 +29,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DSPIRV_REFLECT_BUILD_TESTS=ON
cmake .. -DCMAKE_BUILD_TYPE=Release -DSPIRV_REFLECT_BUILD_TESTS=ON -DSPIRV_REFLECT_ENABLE_ASAN=${{matrix.asan}}
make -j $(nproc)
- name: Run unit tests
run: |
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ OPTION(SPIRV_REFLECT_STRIPPER "Build stripper utility" OFF)
OPTION(SPIRV_REFLECT_STATIC_LIB "Build a SPIRV-Reflect static library" OFF)
OPTION(SPIRV_REFLECT_BUILD_TESTS "Build the SPIRV-Reflect test suite" OFF)
OPTION(SPIRV_REFLECT_ENABLE_ASSERTS "Enable asserts for debugging" OFF)
OPTION(SPIRV_REFLECT_ENABLE_ASAN "Use address sanitization" OFF)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 14)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")

if (SPIRV_REFLECT_ENABLE_ASAN)
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
add_link_options(-fsanitize=address)
endif()

if (SPIRV_REFLECT_EXECUTABLE)
# ==========================================================================
# Compile spirv_reflect.c as C
Expand Down

0 comments on commit 033f1d9

Please sign in to comment.