Skip to content

Commit 3b2e065

Browse files
committed
Use address sanitizer in unit tests
1 parent 9280487 commit 3b2e065

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.github/workflows/utests-minimal.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ jobs:
1919
submodules: true
2020

2121
- name: Configure CMake
22-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DLIBSCRATCHCPP_BUILD_UNIT_TESTS=ON -DLIBSCRATCHCPP_AUDIO_SUPPORT=OFF -DLIBSCRATCHCPP_NETWORK_SUPPORT=OFF
22+
run: |
23+
export CFLAGS="-fsanitize=address -static-libasan"
24+
export CXXFLAGS="-fsanitize=address -static-libasan"
25+
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DLIBSCRATCHCPP_BUILD_UNIT_TESTS=ON -DLIBSCRATCHCPP_AUDIO_SUPPORT=OFF -DLIBSCRATCHCPP_NETWORK_SUPPORT=OFF
2326
2427
- name: Build
2528
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j$(nproc --all)

.github/workflows/utests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ jobs:
2424
sudo apt-get install -y nlohmann-json3-dev libutfcpp-dev
2525
shell: bash
2626
- name: Configure CMake
27-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DLIBSCRATCHCPP_BUILD_UNIT_TESTS=ON
27+
run: |
28+
export CFLAGS="-fsanitize=address -static-libasan"
29+
export CXXFLAGS="-fsanitize=address -static-libasan"
30+
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DLIBSCRATCHCPP_BUILD_UNIT_TESTS=ON
2831
2932
- name: Build
3033
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j$(nproc --all)

0 commit comments

Comments
 (0)