Commit ce0d82a3 authored by ulrich_y's avatar ulrich_y

Added coverage testing to configure

parent babbf4e8
......@@ -7,6 +7,7 @@ makefile
*.gcno
*.gcda
*.gcov
report/
checks/*.f90
checks/stats.txt
### Vim ###
......
......@@ -572,6 +572,26 @@ EOF
fi
if $COVERAGE ; then
findprog gcov GCOV gcov gcov-7 gcov-6 gcov-5 gcov-34 || exit 1
if ! findlib gcov LGCOV ; then
echo "can't perform coverage tests without libgcov. Please specify using \$LFLAGS" 1>&3
exit 1
fi
if ! findprog lcov LCOV lcov ; then
echo "graphical coverage report won't be supported" 1>&3
HAVE_LCOV=false
else
if ! findprog genhtml GENHTML genhtml ; then
echo "graphical coverage report won't be supported" 1>&3
HAVE_LCOV=false
else
HAVE_LCOV=true
fi
fi
fi
echo "creating makefile" 1>&3
......@@ -585,6 +605,9 @@ CXX=$CONF_CXX
LD=$CONF_LD
MPREP=$CONF_MPREP
MATH=$CONF_MATH
GCOV=$CONF_GCOV
LCOV=$CONF_LCOV
GENHTML=$CONF_GENHTML
FFLAGS=$CONF_FFLAGS
CFLAGS=$CONF_CFLAGS
......@@ -717,15 +740,52 @@ cat >> makefile <<EOF
check: test
./$<
EOF
if $COVERAGE ; then
cat >> makefile <<EOF
report/report.txt: test
mkdir -p report
./test -verb 1000 > /dev/null
echo "Report generated on \`date\` by `whoami`." > \$@
EOF
for i in gpl_module ieps maths_functions mpl_module shuffle utils test
do
echo -e "\t\t\$(GCOV) build/$i.gcno >> \$@" >> makefile
echo -e "\t\tmv $i.f90.gcov report/" >> makefile
done
$HAVE_LCOV && cat >> makefile <<EOF
report/coverage.info: report/report.txt
\$(LCOV) --capture --directory build/ --output-file \$@
report/lcov.report: report/coverage.info
\$(LCOV) --list \$< > \$@
cat \$@
report/index.html: report/coverage.info
\$(GENHTML) \$< --output-directory report
EOF
#cat \$@ | perl -nle "print \\\$\$1 if /Total:\\|(\\d+\\.?\\d+\\%)/"
echo -n "coverage: report/report.txt" >> makefile
$HAVE_LCOV && echo -n " report/coverage.info report/lcov.report report/index.html" >> makefile
echo >> makefile
fi
cat >> makefile <<EOF
clean:
@rm -f build/*.gcda build/*.gcno build/*.gcov
@rm -rf report/
@rm -f build/*.o build/*.mod build/*.c build/mcc.internals*
@rm -f test geval libhandyg.a handyg
@rm -f test geval libhandyg.a handyG handyg.mod
@rm -f checks/test-chen.f90 checks/test-muone.f90 checks/test-muoneNP.f90
distclean:
@rm -f build/*.gcda build/*.gcno build/*.gcov
@rm -rf report/
@rm -f build/*.o build/*.mod build/*.c build/mcc.internals*
@rm -f test geval libhandyg.a handyg
@rm -f checks/test-chen.f90 checks/test-muone.f90 checks/test-muoneNP.f90
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment