Skip to content

Commit c472517

Browse files
committed
Sanitize ci
1 parent cffdd6b commit c472517

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

.github/workflows/c.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,13 @@ jobs:
1818
run: make example
1919
- name: Check dirty single-header
2020
run: git diff --exit-code ffc.h
21+
22+
sanitize:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
- name: Install dependencies
28+
run: sudo apt-get update && sudo apt-get install -y clang gcc make python3
29+
- name: make sanitize
30+
run: make sanitize

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: test example
1+
.PHONY: test sanitize example
22

33
# Detect linux and define _DEFAULT_SOURCE if so
44
UNAME_S := $(shell uname -s)
@@ -7,6 +7,7 @@ ifeq ($(UNAME_S),Linux)
77
endif
88

99
CLANG_FLAGS := -xc -Wall -Wextra -Wpedantic -O3 -g -std=c99 $(EXTRA_CFLAGS)
10+
SANITIZE_FLAGS := -xc -Wall -Wextra -Wpedantic -O1 -g -std=c99 -fno-omit-frame-pointer -fsanitize=address,undefined $(EXTRA_CFLAGS)
1011

1112
out/test_runner: ffc.h test_src/test.c | out
1213
gcc -xc -Wall -Wextra -Wpedantic ffc.h -fsyntax-only
@@ -16,9 +17,19 @@ test: out/test_runner out/test_int_runner
1617
./out/test_runner
1718
./out/test_int_runner
1819

20+
sanitize: out/test_runner_sanitize out/test_int_runner_sanitize
21+
./out/test_runner_sanitize
22+
./out/test_int_runner_sanitize
23+
1924
out/test_int_runner: ffc.h test_src/test_int.c | out
2025
clang $(CLANG_FLAGS) -I. -Itest_src test_src/test_int.c -o out/test_int_runner -lm
2126

27+
out/test_runner_sanitize: ffc.h test_src/test.c | out
28+
clang $(SANITIZE_FLAGS) -I. -Itest_src test_src/test.c -o out/test_runner_sanitize -lm
29+
30+
out/test_int_runner_sanitize: ffc.h test_src/test_int.c | out
31+
clang $(SANITIZE_FLAGS) -I. -Itest_src test_src/test_int.c -o out/test_int_runner_sanitize -lm
32+
2233
ffc.h: src/ffc.h src/common.h src/parse.h src/digit_comparison.h src/api.h src/bigint.h amalgamate.py
2334
python3 amalgamate.py > ffc.h
2435

@@ -30,4 +41,3 @@ example: out/example
3041

3142
out:
3243
mkdir -p out
33-

0 commit comments

Comments
 (0)