Skip to content

Commit 784fc33

Browse files
authored
Merge pull request #218 from JacobBarthelmeh/asan
add ASAN option to examples build and CI
2 parents 11cb442 + 65cb329 commit 784fc33

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

.github/workflows/build-and-run-examples.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
transport: [ 'tcp', 'shm', 'dma' ]
14+
asan: [ 'ASAN=1', 'ASAN=0' ]
1415
runs-on: ubuntu-latest
1516
timeout-minutes: 5
1617

@@ -28,16 +29,16 @@ jobs:
2829
- name: Build POSIX server
2930
run: |
3031
if [ "${{ matrix.transport }}" = "dma" ]; then
31-
cd examples/posix/wh_posix_server && DMA=1 make -j WOLFSSL_DIR=../../../wolfssl
32+
cd examples/posix/wh_posix_server && ${{ matrix.asan }} DMA=1 make -j WOLFSSL_DIR=../../../wolfssl
3233
else
33-
cd examples/posix/wh_posix_server && make -j WOLFSSL_DIR=../../../wolfssl
34+
cd examples/posix/wh_posix_server && ${{ matrix.asan }} make -j WOLFSSL_DIR=../../../wolfssl
3435
fi
3536
- name: Build POSIX client
3637
run: |
3738
if [ "${{ matrix.transport }}" = "dma" ]; then
38-
cd examples/posix/wh_posix_client && DMA=1 make -j WOLFSSL_DIR=../../../wolfssl
39+
cd examples/posix/wh_posix_client && ${{ matrix.asan }} DMA=1 make -j WOLFSSL_DIR=../../../wolfssl
3940
else
40-
cd examples/posix/wh_posix_client && make -j WOLFSSL_DIR=../../../wolfssl
41+
cd examples/posix/wh_posix_client && ${{ matrix.asan }} make -j WOLFSSL_DIR=../../../wolfssl
4142
fi
4243
4344
# Start the server in the background

examples/posix/wh_posix_client/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ ifeq ($(DEBUG),1)
7575
LDFLAGS += $(DBGFLAGS)
7676
endif
7777

78+
# Add address sanitizer option
79+
ifeq ($(ASAN),1)
80+
CFLAGS += -fsanitize=address
81+
LDFLAGS += -fsanitize=address
82+
endif
83+
7884
## Source files
7985
# Assembly source files
8086
SRC_ASM +=

examples/posix/wh_posix_server/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ ifeq ($(DEBUG),1)
6666
LDFLAGS += $(DBGFLAGS)
6767
endif
6868

69+
# Add address sanitizer option
70+
ifeq ($(ASAN),1)
71+
CFLAGS += -fsanitize=address
72+
LDFLAGS += -fsanitize=address
73+
endif
74+
6975
# Support a SHE-capable build
7076
ifeq ($(SHE),1)
7177
CFLAGS += -DWOLFHSM_CFG_SHE_EXTENSION

0 commit comments

Comments
 (0)