Skip to content

Commit

Permalink
Add asan+ubsan sanitized builder
Browse files Browse the repository at this point in the history
  • Loading branch information
PiJoules committed Dec 11, 2023
1 parent 7bc5ec9 commit 7a8b1f4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build-sanitized.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build + Test (Sanitized)

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
merge_group:
branches: [ "main" ]
workflow_dispatch:

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get googletest
run: |
wget https://github.com/google/googletest/archive/refs/tags/release-1.12.1.zip
unzip release-1.12.1.zip
cd googletest-release-1.12.1
mkdir build
cd build
cmake ..
make
- name: Build main executable
run: make EXTRA_CPPFLAGS="-fsanitize=address -fsanitize=undefined"
- name: Build test executable
run: make test GTEST_HDR=googletest-release-1.12.1/googletest/include GTEST_LIB=googletest-release-1.12.1/build/lib EXTRA_CPPFLAGS="-fsanitize=address -fsanitize=undefined"
- name: Run test executable
run: ./test
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ $ make
./main
```

Define `EXTRA_CPPFLAGS` to pass flags to the build. For example, to build with
sanitizers:

```
$ make EXTRA_CPPFLAGS="-fsanitize=address -fsanitize=undefined"
```

## Testing

```sh
Expand Down

0 comments on commit 7a8b1f4

Please sign in to comment.