aboutsummaryrefslogtreecommitdiff
path: root/contrib/openpam/Makefile.am
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/openpam/Makefile.am')
-rw-r--r--contrib/openpam/Makefile.am31
1 files changed, 29 insertions, 2 deletions
diff --git a/contrib/openpam/Makefile.am b/contrib/openpam/Makefile.am
index 6355cefcd5bc..89ec3a3cfa34 100644
--- a/contrib/openpam/Makefile.am
+++ b/contrib/openpam/Makefile.am
@@ -1,5 +1,3 @@
-# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $
-
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = misc include lib bin modules
@@ -19,3 +17,32 @@ EXTRA_DIST = \
RELNOTES \
autogen.sh \
misc/gendoc.pl
+
+if WITH_CODE_COVERAGE
+covdir = @abs_top_builddir@/cov
+coverage: coverage-clean all coverage-prepare coverage-run coverage-report
+coverage-clean:
+ -rm -rf "${covdir}"
+coverage-prepare:
+ mkdir "${covdir}"
+if CLANG_CODE_COVERAGE
+profdata = ${covdir}/@PACKAGE@.profdata
+# hardcoding libpam.so here is horrible, need to find a better solution
+coverage-run:
+ LLVM_PROFILE_FILE="${covdir}/@PACKAGE@.%p.raw" \
+ ${MAKE} -C "@abs_top_builddir@" check
+coverage-report:
+ llvm-profdata@clang_ver@ merge \
+ --sparse "${covdir}/@PACKAGE@".*.raw -o "${profdata}"
+ llvm-cov@clang_ver@ show \
+ --format=html --tab-size=8 \
+ --output-dir="${covdir}" \
+ --instr-profile="${profdata}" \
+ --object "@abs_top_builddir@/lib/libpam/.libs/libpam.so"
+ @echo "coverage report: file://${covdir}/index.html"
+endif
+else
+coverage:
+ echo "code coverage is not enabled." >&2
+ false
+endif