aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-07-07 10:59:00 +0200
committerMattias Andrée <maandree@kth.se>2022-07-07 10:59:00 +0200
commit5bc0737c422bf13ba530f1931ba47e35d5298eab (patch)
tree241dbd5f47ca18f701377ab7b7d1f77d5f56aef7
parentAdd libsha1.7 (diff)
downloadlibsha1-5bc0737c422bf13ba530f1931ba47e35d5298eab.tar.gz
libsha1-5bc0737c422bf13ba530f1931ba47e35d5298eab.tar.bz2
libsha1-5bc0737c422bf13ba530f1931ba47e35d5298eab.tar.xz
Add coverage test
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--.gitignore3
-rw-r--r--Makefile3
-rw-r--r--config-coverage-gcc.mk11
3 files changed, 16 insertions, 1 deletions
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 5e3b16e..0c72167 100644
--- a/Makefile
+++ b/Makefile
@@ -65,6 +65,7 @@ MAN7 =\
libsha1.7
LOBJ = $(OBJ:.o=.lo)
+SRC = $(OBJ:.o=.c)
all: libsha1.a libsha1.$(LIBEXT) test
@@ -118,7 +119,7 @@ uninstall:
-cd -- "$(DESTDIR)$(MANPREFIX)/man7" && rm -f -- $(MAN7)
clean:
- -rm -f -- *.o *.lo *.su *.a *.so test
+ -rm -f -- *.o *.lo *.su *.a *.so *.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