diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2015-01-07 19:17:15 -0200 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2015-01-07 23:02:34 -0200 |
commit | e9b0d1b40e645fd583f090601f4ae2a7926888a1 (patch) | |
tree | c544ebab1591900a92366d7f709950ae041669ab /Makefile.am | |
parent | 8ff7f008cd684ebe524c3ba649a613fe8b9faa65 (diff) | |
download | kmod-e9b0d1b40e645fd583f090601f4ae2a7926888a1.tar.gz kmod-e9b0d1b40e645fd583f090601f4ae2a7926888a1.tar.bz2 kmod-e9b0d1b40e645fd583f090601f4ae2a7926888a1.zip |
build-sys: integrate coverage report
Just pass --enable-coverage to configure and then "make coverage" to
have the coverage report at coverage dir.
Diffstat (limited to 'Makefile.am')
-rw-r--r-- | Makefile.am | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index 5df38cb..bf4f328 100644 --- a/Makefile.am +++ b/Makefile.am @@ -327,6 +327,45 @@ buildtest-TESTS: $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS) # ------------------------------------------------------------------------------ +# coverage +# ------------------------------------------------------------------------------ + +# .PHONY so it always rebuilds it +.PHONY: coverage lcov-run lcov-report coverage-sync + +# run lcov from scratch, always +coverage: all + $(MAKE) lcov-run + $(MAKE) lcov-report + +coverage_dir = coverage +coverage_opts = --base-directory $(srcdir) --directory $(builddir) \ + --rc 'geninfo_adjust_src_path=$(abspath $(srcdir))=>$(abspath $(builddir))' + +if ENABLE_COVERAGE +# reset run coverage tests +lcov-run: + @rm -rf $(coverage_dir) + lcov $(coverage_opts) --zerocounters + -$(MAKE) check + +# generate report based on current coverage data +lcov-report: + $(MKDIR_P) $(coverage_dir) + lcov $(coverage_opts) --capture --no-external --ignore-errors graph \ + | sed 's|$(abspath $(builddir))|$(abspath $(srcdir))|' > $(coverage_dir)/.lcov.info + lcov --remove $(coverage_dir)/.lcov.info --output-file $(coverage_dir)/.lcov-clean.info 'test-*' + genhtml -t "kmod test coverage" -o $(coverage_dir) $(coverage_dir)/.lcov-clean.info + @echo "Coverage report generated in $(abs_builddir)/$(coverage_dir)/index.html" + +else + +lcov-run lcov-report: + echo "Need to reconfigure with --enable-coverage" + +endif + +# ------------------------------------------------------------------------------ # custom release helpers # ------------------------------------------------------------------------------ |