]> granicus.if.org Git - neomutt/commitdiff
build: add coverage testing 1655/head
authorRichard Russon <rich@flatcap.org>
Tue, 16 Apr 2019 00:47:40 +0000 (01:47 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 16 Apr 2019 09:36:54 +0000 (10:36 +0100)
.gitignore
Makefile.autosetup
auto.def

index 5b05e3eb0fe1a325aa07a088677a2dbd77a1811d..330609b16777279f53b4ff788aab4d1ea8d97677 100644 (file)
@@ -17,9 +17,12 @@ test/string-test
 
 # Build products
 *.o
+*.gc??
 *.Po
 *.Tpo
 html
+lcov
+lcov.info
 lib*.a
 po/*.mo
 po/neomutt.pot
index 19abf26c294e4affd931fd185634d5e4bb61c956..2027cdfc5ad44fac8d6aeb164543807d8663ffc8 100644 (file)
@@ -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
index 1d446857113350106b49768e823e44df540baeac..298756a1d0d655b922eec672c312dfe4a94f3e5c 100644 (file)
--- 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]} {