Compare commits
2 commits
64edbc294d
...
988154ebea
Author | SHA1 | Date | |
---|---|---|---|
|
988154ebea | ||
|
29e80880cc |
3 changed files with 47 additions and 52 deletions
25
Makefile.am
25
Makefile.am
|
@ -17,3 +17,28 @@ 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 merge -sparse "${covdir}/@PACKAGE@".*.raw -o "${profdata}"
|
||||
llvm-cov show -instr-profile="${profdata}" -format=html -output-dir="${covdir}" \
|
||||
--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
|
||||
|
|
40
configure.ac
40
configure.ac
|
@ -33,26 +33,26 @@ AC_DEFINE_UNQUOTED(LIB_MAJ, $LIB_MAJ, [OpenPAM library major number])
|
|||
|
||||
AC_ARG_ENABLE([debug],
|
||||
AC_HELP_STRING([--enable-debug],
|
||||
[turn debugging macros on]),
|
||||
[turn debugging macros on]),
|
||||
AC_DEFINE(OPENPAM_DEBUG, 1, [Turn debugging macros on]))
|
||||
|
||||
AC_ARG_ENABLE([unversioned-modules],
|
||||
AC_HELP_STRING([--disable-unversioned-modules],
|
||||
[support loading of unversioned modules]),
|
||||
[support loading of unversioned modules]),
|
||||
[AS_IF([test x"$enableval" = x"no"], [
|
||||
AC_DEFINE(DISABLE_UNVERSIONED_MODULES,
|
||||
1,
|
||||
[Whether loading unversioned modules support is disabled])
|
||||
AC_DEFINE(DISABLE_UNVERSIONED_MODULES,
|
||||
1,
|
||||
[Whether loading unversioned modules support is disabled])
|
||||
])])
|
||||
|
||||
AC_ARG_WITH([modules-dir],
|
||||
AC_HELP_STRING([--with-modules-dir=DIR],
|
||||
[OpenPAM modules directory]),
|
||||
[OpenPAM modules directory]),
|
||||
[AS_IF([test x"$withval" != x"no"], [
|
||||
OPENPAM_MODULES_DIR="$withval"
|
||||
AC_DEFINE_UNQUOTED(OPENPAM_MODULES_DIR,
|
||||
"${OPENPAM_MODULES_DIR%/}",
|
||||
[OpenPAM modules directory])
|
||||
OPENPAM_MODULES_DIR="$withval"
|
||||
AC_DEFINE_UNQUOTED(OPENPAM_MODULES_DIR,
|
||||
"${OPENPAM_MODULES_DIR%/}",
|
||||
[OpenPAM modules directory])
|
||||
])])
|
||||
AC_SUBST(OPENPAM_MODULES_DIR)
|
||||
AM_CONDITIONAL([CUSTOM_MODULES_DIR], [test x"$OPENPAM_MODULES_DIR" != x""])
|
||||
|
@ -127,17 +127,22 @@ AC_ARG_ENABLE([werror],
|
|||
AC_ARG_ENABLE([code-coverage],
|
||||
AS_HELP_STRING([--enable-code-coverage],
|
||||
[enable code coverage]))
|
||||
AM_CONDITIONAL([CODE_COVERAGE], [test x"$enable_code_coverage" = x"yes"])
|
||||
AS_IF([test x"$enable_code_coverage" = x"yes"], [
|
||||
AS_IF([test x"$ax_cv_c_compiler_vendor" = x"clang"], [
|
||||
CFLAGS="${CFLAGS} -fprofile-instr-generate -fcoverage-mapping"
|
||||
AM_COND_IF([WITH_TEST], [
|
||||
AS_IF([test x"$ax_cv_c_compiler_vendor" = x"clang"], [
|
||||
CFLAGS="${CFLAGS} -fprofile-instr-generate -fcoverage-mapping"
|
||||
clang_code_coverage="yes"
|
||||
], [
|
||||
AC_MSG_ERROR([code coverage is only supported with clang])
|
||||
])
|
||||
AC_DEFINE([WITH_CODE_COVERAGE], [1], [Define to 1 if code coverage is enabled])
|
||||
AC_MSG_NOTICE([code coverage enabled])
|
||||
], [
|
||||
AC_MSG_ERROR([code coverage is only supported with clang])
|
||||
AC_MSG_ERROR([code coverage requires unit tests])
|
||||
])
|
||||
AC_DEFINE([CODE_COVERAGE], [1], [Define to 1 if code coverage is enabled])
|
||||
AC_MSG_NOTICE([code coverage enabled])
|
||||
])
|
||||
AC_SUBST([enable_code_coverage], [$enable_code_coverage])
|
||||
AM_CONDITIONAL([WITH_CODE_COVERAGE], [test x"$enable_code_coverage" = x"yes"])
|
||||
AM_CONDITIONAL([CLANG_CODE_COVERAGE], [test x"$clang_code_coverage" = x"yes"])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
|
@ -160,6 +165,5 @@ AC_CONFIG_FILES([
|
|||
modules/pam_unix/Makefile
|
||||
t/Makefile
|
||||
])
|
||||
AC_CONFIG_FILES([misc/coverage.sh],[chmod +x misc/coverage.sh])
|
||||
AC_CONFIG_FILES([misc/coverity.sh],[chmod +x misc/coverity.sh])
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
echo "usage: ${0##*/} [-jN]" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts "j:" opt ; do
|
||||
case $opt in
|
||||
j)
|
||||
j="-j$OPTARG"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! [ "@enable_code_coverage@" = "yes" ] ; then
|
||||
echo "Code coverage disabled." >&2
|
||||
echo "Re-run ./configure with --enable-code-coverage and try again." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
srcdir="@abs_top_srcdir@"
|
||||
profdir="@abs_top_builddir@/cov"
|
||||
profraw="${profdir}/@PACKAGE@.%p.raw"
|
||||
profdata="${profdir}/@PACKAGE@.profdata"
|
||||
export LLVM_PROFILE_FILE="${profraw}"
|
||||
[ -e "${profdir}" ] && rm -r "${profdir}"
|
||||
gmake -C "${srcdir}" $j check
|
||||
llvm-profdata merge -sparse "${profdir}/@PACKAGE@".*.raw -o "${profdata}"
|
||||
llvm-cov show -instr-profile="${profdata}" -format=html -output-dir="${profdir}" \
|
||||
--object "@abs_top_builddir@/lib/libpam/.libs/libpam.so"
|
Loading…
Reference in a new issue