Merge Request #8
← To merge requests
From
dachary:wip-lcov
into
jerasure:master
Commits (1)
-
To create the HTML report of the test code coverage: ./configure --enable-coverage make coverage and find the report in the html directory. Signed-off-by: Loic Dachary <loic@dachary.org>
Showing
3 changed files
Show diff stats
Makefile.am
... | ... | @@ -6,3 +6,12 @@ ACLOCAL_AMFLAGS = -I m4 |
6 | 6 | |
7 | 7 | include_HEADERS = include/gf_complete.h include/gf_method.h include/gf_rand.h include/gf_general.h |
8 | 8 | |
9 | +coverage: | |
10 | + lcov -d $(top_builddir) -z | |
11 | + lcov -d $(top_builddir) -c -i -o base_full.lcov | |
12 | + make -j4 check | |
13 | + lcov -d $(top_builddir) -c -o tested_full.lcov | |
14 | + lcov --remove base_full.lcov /usr/include\* /usr/lib\* -o base.lcov | |
15 | + lcov --remove tested_full.lcov /usr/include\* /usr/lib\* -o tested.lcov | |
16 | + lcov --add-tracefile base.lcov --add-tracefile tested.lcov -o result.lcov | |
17 | + rm -fr html ; genhtml -o html --baseline-file base.lcov tested.lcov | ... | ... |
configure.ac
... | ... | @@ -60,5 +60,11 @@ AC_ARG_ENABLE([sse], |
60 | 60 | fi] |
61 | 61 | ) |
62 | 62 | |
63 | +AC_ARG_ENABLE([coverage], | |
64 | + [AS_HELP_STRING([--enable-coverage], [enable code coverage tracking])], | |
65 | + [], | |
66 | + [enable_coverage=no]) | |
67 | +AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_coverage" != xno) | |
68 | + | |
63 | 69 | AC_CONFIG_FILES([Makefile src/Makefile tools/Makefile test/Makefile examples/Makefile]) |
64 | 70 | AC_OUTPUT | ... | ... |
src/Makefile.am
... | ... | @@ -5,6 +5,9 @@ AUTOMAKE_OPTIONS = subdir-objects |
5 | 5 | |
6 | 6 | AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include |
7 | 7 | AM_CFLAGS = -O3 $(SIMD_FLAGS) -fPIC |
8 | +if ENABLE_COVERAGE | |
9 | +AM_CFLAGS += -fprofile-arcs -ftest-coverage | |
10 | +endif | |
8 | 11 | |
9 | 12 | lib_LTLIBRARIES = libgf_complete.la |
10 | 13 | libgf_complete_la_SOURCES = gf.c gf_method.c gf_wgen.c gf_w4.c gf_w8.c gf_w16.c gf_w32.c \ | ... | ... |
-
Added 1 new commit:
- 5d620b32 - add --enable-coverage to create lcov reports
-
Added 1 new commit:
- e1d35637 - add --enable-coverage to create lcov reports