Skip to content

Commit

Permalink
CI, make: enable ASAN for tests
Browse files Browse the repository at this point in the history
and document it
  • Loading branch information
black-sliver committed Nov 3, 2024
1 parent 0318254 commit a901f53
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ jobs:
with:
submodules: recursive
- name: Build DEBUG
run: make native CONF=DEBUG ${{ matrix.extra_make_args }} -j4
run: make native CONF=DEBUG WITH_ASAN=true ${{ matrix.extra_make_args }} -j4
- name: Run tests
run: make test CONF=DEBUG ${{ matrix.extra_make_args }}
run: make test CONF=DEBUG WITH_ASAN=true ${{ matrix.extra_make_args }} -j4
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ See [scan-build.yaml](../.github/workflows/scan-build.yaml).

### Address Sanitizer

Consider testing with ASAN.
Consider testing with ASAN by passing WITH_ASAN=true to make.

### Spell Checker

Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ ifeq ($(CONF), DEBUG) # DEBUG
CPP_FLAGS = -Wall -Wnon-virtual-dtor -Wno-unused-function -Wno-deprecated-declarations -fstack-protector-all -g -Og -ffunction-sections -fdata-sections -pthread -fno-omit-frame-pointer
LD_FLAGS = -Wl,--gc-sections -fstack-protector-all -pthread -fno-omit-frame-pointer
endif
#CPP_FLAGS += -fsanitize=address
#LD_FLAGS += -fsanitize=address
else # RELEASE or DIST
C_FLAGS += -O2 -fno-stack-protector -fno-common
LUA_CFALGS += -O2 -fno-stack-protector -fno-common
Expand All @@ -185,6 +183,11 @@ else # RELEASE or DIST
endif
endif

ifdef WITH_ASAN
CPP_FLAGS += -fsanitize=address
LD_FLAGS += -fsanitize=address
endif

CPP_FLAGS += -DLUA_CPP

# os-specific tool config
Expand Down

0 comments on commit a901f53

Please sign in to comment.