From a609a0d5e82a15ee43f71f0a19218c59e9556575 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Sat, 27 Jun 2020 10:23:57 +0200 Subject: aktiviere Code-Coverage-Test --- csv-test.c | 4 ++-- makefile | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/csv-test.c b/csv-test.c index ecf55cd..99325af 100644 --- a/csv-test.c +++ b/csv-test.c @@ -1,3 +1,5 @@ +#undef NDEBUG + #include #include #include @@ -6,8 +8,6 @@ #include "csv.h" -#undef NDEBUG - #define FMEMOPEN(f, data) \ f = fmemopen(data, sizeof(data)-1, "r"); \ assert(f != NULL) diff --git a/makefile b/makefile index 38134b1..acf3564 100644 --- a/makefile +++ b/makefile @@ -2,9 +2,13 @@ include config.mk all: csv-test csv-perf seq-read -csv-test: csv-test.c csv.o csv.h - $(CC) $(CFLAGS) -o $@ csv-test.c csv.o - ./csv-test +csv-test: csv-test.c csv.c csv.h + $(CC) $(CFLAGS) -fprofile-instr-generate -fcoverage-mapping -DNDEBUG -o $@ csv-test.c csv.c + ./$@ + +coverage: csv-test + llvm-profdata merge -sparse default.profraw -o csv-test.profdata + llvm-cov show ./csv-test -instr-profile=csv-test.profdata csv-perf: csv-perf.c csv.o csv.h $(CC) $(CFLAGS) -o $@ csv-perf.c csv.o @@ -18,4 +22,4 @@ csv.o: csv.c csv.h clean: rm csv-test csv-perf seq-read csv.o -.PHONY: all clean +.PHONY: all clean coverage -- cgit v1.3