From 7db5760c91eed26b761debdd9acb83857c022cc1 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Sun, 30 Aug 2015 17:17:05 +0200 Subject: [PATCH] add possibility to create combined coverage Define the environment variable LTC_COVERAGE to something, run testme.sh with all the coverage compile time options enabled and then 'make lcov' creates the combined coverage for all combinations of compile-time options handled in testme.sh. e.g. LTC_COVERAGE=1 ./testme.sh "makefile -j3" "-DUSE_LTM -DLTM_DESC -I../libtommath -fprofile-arcs -ftest-coverage" "../libtommath/libtommath.a -lgcov" --- .gitignore | 3 +++ build.sh | 5 +++++ makefile | 3 +++ 3 files changed, 11 insertions(+) diff --git a/.gitignore b/.gitignore index 1538c91..2ac5901 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,9 @@ timing.exe *.gcno *.gcov +coverage/ +coverage*.info + # coverity intermediate directory etc. cov-int/ .coverity_* diff --git a/build.sh b/build.sh index 228afff..9338caf 100755 --- a/build.sh +++ b/build.sh @@ -24,7 +24,12 @@ if [ -a test ] && [ -f test ] && [ -x test ]; then for f in *_tv.txt; do if (diff -i -w -B $f notes/$f) then true; else (echo "tv_gen $f failed" && rm -f testok.txt && exit 1); fi; done fi fi + +lcov_opts="--capture --no-external --directory src -q" +lcov_out=$(echo coverage_$1_$2_$3 | tr ' -=+' '_')".info" + if [ -a testok.txt ] && [ -f testok.txt ]; then + [ "$LTC_COVERAGE" != "" ] && lcov $lcov_opts --output-file $lcov_out exit 0 fi exit 1 diff --git a/makefile b/makefile index 3a96ecf..626da35 100644 --- a/makefile +++ b/makefile @@ -275,6 +275,9 @@ profile: rm -f timing `find . -type f | grep [.][ao] | xargs` CFLAGS="$(CFLAGS) -fprofile-use" $(MAKE) timing EXTRALIBS="$(EXTRALIBS) -lgcov" +lcov: + lcov `find -name 'coverage_*.info' -exec echo -n " -a {}" \;` -o coverage.info -q 2>/dev/null + genhtml coverage.info --output-directory coverage -q #This rule cleans the source tree of all compiled code, not including the pdf #documentation.