diff options
| author | jvoisin | 2023-05-30 21:19:56 +0200 |
|---|---|---|
| committer | jvoisin | 2023-05-30 21:42:35 +0200 |
| commit | c4247e4389b765179aa1fd0b010f50e8d6bddf4d (patch) | |
| tree | 41c83ed2eddc0617fb81e61b6f9007130162b0f0 /tests | |
| parent | 37d8733dc522c44f9cdb9247f4a59e23bf0a9659 (diff) | |
Add code coverage
And make it available at https://jvoisin.github.io/fortify-headers/include/index.html
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Makefile | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile index 8eded26..2c4e067 100644 --- a/tests/Makefile +++ b/tests/Makefile | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | CC=../x86_64-linux-musl-native/bin/gcc | 1 | CC=../x86_64-linux-musl-native/bin/gcc |
| 2 | GCOV=../x86_64-linux-musl-native/bin/gcov | ||
| 2 | CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 | 3 | CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2 |
| 3 | 4 | ||
| 4 | TARGETS=test_memcpy_static_write \ | 5 | TARGETS=test_memcpy_static_write \ |
| @@ -21,6 +22,12 @@ TARGETS=test_memcpy_static_write \ | |||
| 21 | 22 | ||
| 22 | all: $(TARGETS) run | 23 | all: $(TARGETS) run |
| 23 | 24 | ||
| 25 | coverage: CFLAGS += -fprofile-arcs -ftest-coverage | ||
| 26 | coverage: all | ||
| 27 | $(GCOV) *.c | ||
| 28 | lcov --capture --directory . --output-file coverage.info | ||
| 29 | genhtml coverage.info --output-directory coverage | ||
| 30 | |||
| 24 | $(TARGETS): %: %.c | 31 | $(TARGETS): %: %.c |
| 25 | $(CC) $(CFLAGS) -o $@ $< | 32 | $(CC) $(CFLAGS) -o $@ $< |
| 26 | 33 | ||
| @@ -33,4 +40,5 @@ clean: | |||
| 33 | $(foreach EXE, $(TARGETS), \ | 40 | $(foreach EXE, $(TARGETS), \ |
| 34 | rm -f ./$(EXE) \ | 41 | rm -f ./$(EXE) \ |
| 35 | ) | 42 | ) |
| 43 | rm -rf ./*.gcno ./*.gcda ./*.gcov ./coverage.info ./coverage | ||
| 36 | 44 | ||
