From 252293edc6c33d0fe90d17d090e477d46601b11e Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Tue, 16 Apr 2019 01:47:40 +0100 Subject: [PATCH] build: add coverage testing --- .gitignore | 3 +++ Makefile.autosetup | 9 +++++++++ auto.def | 11 ++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5b05e3eb0..330609b16 100644 --- a/.gitignore +++ b/.gitignore @@ -17,9 +17,12 @@ test/string-test # Build products *.o +*.gc?? *.Po *.Tpo html +lcov +lcov.info lib*.a po/*.mo po/neomutt.pot diff --git a/Makefile.autosetup b/Makefile.autosetup index 19abf26c2..2027cdfc5 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -424,6 +424,15 @@ distclean: clean $(RM) $(DEPFILES) .clang_complete autosetup/jimsh0 config.h config.log \ conststrings.c contrib/Makefile doc/Makefile doc/neomutt.1 \ html Makefile po/Makefile test/Makefile + $(RM) *.gc?? */*.gc?? test/*/*.gc?? + $(RM) lcov.info lcov + +# coverage testing +coverage: all test + $(RM) lcov + $(RM) config/dump.gc?? + lcov -t "result" -o lcov.info -c -d mutt -d config + genhtml -o lcov lcov.info # Tests for the config code config-test: libmutt.a libemail.a libconfig.a diff --git a/auto.def b/auto.def index 1d4468571..298756a1d 100644 --- a/auto.def +++ b/auto.def @@ -89,6 +89,8 @@ options { with-tokyocabinet:path => "Location of TokyoCabinet" # System with-sysroot:path => "Target system root" +# Coverage testing + lcov=0 => "Enable Coverage Testing" # Enable all options everything=0 => "Enable all options" } @@ -102,7 +104,7 @@ if {1} { # Keep sorted, please. foreach opt { bdb doc everything fmemopen full-doc gdbm gnutls gpgme gss - homespool idn idn2 inotify kyotocabinet lmdb locales-fix lua mixmaster nls + homespool idn idn2 inotify kyotocabinet lcov lmdb locales-fix lua mixmaster nls notmuch pgp qdbm sasl smime ssl tokyocabinet } { define want-$opt [opt-bool $opt] @@ -447,6 +449,13 @@ if {[get-define want-sasl]} { } } +############################################################################### +# Coverage Testing +if {[get-define want-lcov]} { + define-append CFLAGS -fprofile-arcs -ftest-coverage + define-append LDFLAGS -fprofile-arcs -ftest-coverage +} + ############################################################################### # Lua if {[get-define want-lua]} { -- 2.50.0