diff --git a/.gitignore b/.gitignore index 393d483..2ea0f8c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +Makefile.local # files generated by configure Makefile.configure config.h @@ -15,5 +16,10 @@ lowdown-diff lowdown.pc lowdown.tar.gz lowdown.tar.gz.sha512 +# files for valgrind *.valgrind *.diff-valgrind +# files for gcov +*.gcno +*.gcov +*.gcda diff --git a/Makefile b/Makefile index 3eb45f7..871a46d 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ .SUFFIXES: .xml .md .html .pdf .1 .1.html .3 .3.html .5 .5.html .thumb.jpg .png .in.pc .pc .valgrind .old.md .diff-valgrind include Makefile.configure +WWWDIR = /var/www/vhosts/kristaps.bsd.lv/htdocs/lowdown +sinclude Makefile.local # Follows semver. # This is complex because lowdown is both a program and a library; and @@ -30,7 +32,6 @@ OBJS = autolink.o \ tree.o \ util.o COMPAT_OBJS = compats.o -WWWDIR = /var/www/vhosts/kristaps.bsd.lv/htdocs/lowdown HTMLS = archive.html \ atom.xml \ diff.html \ @@ -326,6 +327,14 @@ $(HTMLS): versions.xml lowdown ./lowdown $< ; \ echo "" ; ) >$@ +index.xml: index.md coverage.md coverage-table.md lowdown + ( echo "" ; \ + echo "
" ; \ + ./lowdown index.md ; \ + ./lowdown coverage.md ; \ + ./lowdown coverage-table.md ; \ + echo "
" ; ) >$@ + .1.1.html .3.3.html .5.5.html: mandoc -Thtml -Ostyle=https://bsd.lv/css/mandoc.css $< >$@ @@ -372,6 +381,20 @@ clean: distclean: clean rm -f Makefile.configure config.h config.log config.h.old config.log.old +coverage-table.md: + $(MAKE) clean + CC=gcc CFLAGS="--coverage" ./configure LDFLAGS="--coverage" + $(MAKE) regress + ( echo "| Files | Coverage |" ; \ + echo "|-------|----------|" ; \ + for f in $(OBJS) ; do \ + src=$$(basename $$f .o).c ; \ + pct=$$(gcov -H $$src | grep 'Lines executed' | head -n1 | \ + cut -d ":" -f 2 | cut -d "%" -f 1) ; \ + echo "| $$src | $$pct% | " ; \ + done ; \ + ) >coverage-table.md + regen_regress: bins @tmp1=`mktemp` ; \ tmp2=`mktemp` ; \ diff --git a/coverage-table.md b/coverage-table.md new file mode 100644 index 0000000..adc0362 --- /dev/null +++ b/coverage-table.md @@ -0,0 +1,19 @@ +| Files | Coverage | +|-------|----------| +| autolink.c | 65.73% | +| buffer.c | 71.91% | +| diff.c | 79.40% | +| document.c | 74.01% | +| entity.c | 40.74% | +| gemini.c | 65.91% | +| html.c | 66.51% | +| html_escape.c | 87.65% | +| latex.c | 64.08% | +| library.c | 80.14% | +| libdiff.c | 94.05% | +| nroff.c | 71.38% | +| odt.c | 63.64% | +| smartypants.c | 83.89% | +| term.c | 67.54% | +| tree.c | 34.84% | +| util.c | 6.38% | diff --git a/coverage.md b/coverage.md new file mode 100644 index 0000000..7c8f812 --- /dev/null +++ b/coverage.md @@ -0,0 +1,7 @@ +## Coverage + +The regression suite executes the *lowdown* code in many ways. It's +easy to track this by examining run-time coverage using +[gcov](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html) (or the clang +alternative). To examine how the regression suite covers the sources, +run `make coverage`. The current coverage is as follows: