Browse Source

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"
Steffen Jaeckel 10 years ago
parent
commit
7db5760c91
3 changed files with 11 additions and 0 deletions
  1. 3 0
      .gitignore
  2. 5 0
      build.sh
  3. 3 0
      makefile

+ 3 - 0
.gitignore

@@ -57,6 +57,9 @@ timing.exe
 *.gcno
 *.gcov
 
+coverage/
+coverage*.info
+
 # coverity intermediate directory etc.
 cov-int/
 .coverity_*

+ 5 - 0
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

+ 3 - 0
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.