From c5db64788069abdea1ee5b05d0638263d9868196 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 7 Jul 2022 15:10:57 +0200 Subject: Add coverage test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- .gitignore | 3 +++ Makefile | 3 ++- config-coverage-gcc.mk | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 config-coverage-gcc.mk diff --git a/.gitignore b/.gitignore index 49bee63..b2a397c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,7 @@ *.su *.a *.lo +*.gcda +*.gcno +*.gcov /test diff --git a/Makefile b/Makefile index dbd2592..bc47b8c 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,7 @@ MAN3 =\ libsha2_update.3 LOBJ = $(OBJ:.o=.lo) +SRC = $(OBJ:.o=.c) all: libsha2.a libsha2.$(LIBEXT) test @@ -112,7 +113,7 @@ uninstall: -cd -- "$(DESTDIR)$(MANPREFIX)/man3" && rm -f -- $(MAN3) clean: - -rm -f -- *.o *.lo *.su *.a *.$(LIBEXT) test + -rm -f -- *.o *.lo *.su *.a *.$(LIBEXT) *.gcda *.gcno *.gcov test .SUFFIXES: .SUFFIXES: .lo .o .c diff --git a/config-coverage-gcc.mk b/config-coverage-gcc.mk new file mode 100644 index 0000000..18de147 --- /dev/null +++ b/config-coverage-gcc.mk @@ -0,0 +1,11 @@ +CONFIGFILE_PROPER = config.mk +include $(CONFIGFILE_PROPER) + +CC = $(CC_PREFIX)gcc -std=c99 +GCOV = gcov + +CFLAGS = -g -O0 -pedantic -fprofile-arcs -ftest-coverage +LDFLAGS = -lgcov -fprofile-arcs + +coverage: check + $(GCOV) -pr $(SRC) 2>&1 -- cgit v1.2.3-70-g09d2