Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
utils
libavl
Commits
b1aaffe4
Commit
b1aaffe4
authored
May 24, 2018
by
Adrien Oliva
Browse files
Handle lcov-cobertura to produce jenkins coverage report
Modernize configure.pre
parent
7c781289
Changes
3
Hide whitespace changes
Inline
Side-by-side
Makefile.am
View file @
b1aaffe4
...
...
@@ -9,70 +9,87 @@ ALLPHONY = coverage
################################################################################ if COVERAGE
if
COVERAGE
################################################################################ if LCOV
if
LCOV
lcov-coverage-clean
:
lcov
--compat-libtool
--directory
"
$(top_srcdir)
/src"
--zerocounters
--output-file
"coverage-report.info"
lcov-coverage-filter
:
lcov
--rc
lcov_branch_coverage
=
1
--compat-libtool
--directory
"
$
(top_srcdir
)
"
--capture
--output-file
"coverage-report.info"
lcov
--rc
lcov_branch_coverage
=
1
--extract
"coverage-report.info"
"
$$
(readlink -f
$(top_srcdir)
)/*"
--output-file
"coverage-report2.info"
lcov
--rc
lcov_branch_coverage
=
1
--compat-libtool
--directory
"
$
$
(readlink -f "
$(top_builddir)
/
"
)"
--capture
--output-file
"coverage-report.info"
lcov
--rc
lcov_branch_coverage
=
1
--extract
"coverage-report.info"
"
$$
(readlink -f
"
$(top_srcdir)
"
)/*"
--output-file
"coverage-report2.info"
lcov
--rc
lcov_branch_coverage
=
1
--remove
"coverage-report2.info"
"*unittests*"
--output-file
"coverage-report.info"
############################################################################### if GENHTML
if
GENHTML
GENHTML_EXTRA
=
################################################################################ if PERLGD
GENHTML_EXTRA
=
--rc
lcov_branch_coverage
=
1
--highlight
--legend
--demangle-cpp
if
PERLGD
GENHTML_EXTRA
+=
--frames
endif
################################################################################ endif
endif
# PERLGD
genhtml-coverage-report
:
genhtml
--rc
lcov_branch_coverage
=
1
--highlight
--legend
--demangle-cpp
$(GENHTML_EXTRA)
--output-directory
"coverage-report"
--prefix
"
$$
(readlink -f
$(top_srcdir)
)"
"coverage-report.info"
################################################################################ else
else
genhtml
$(GENHTML_EXTRA)
--output-directory
"coverage-report"
--prefix
"
$$
(readlink -f
$(top_srcdir)
)"
"coverage-report.info"
else
# GENHTML
genhtml-coverage-report
:
@
(
echo
"Lcov suite is not completely installed. Please be sure to have genhtml to get beautiful coverage report"
)
endif
################################################################################ endif
endif
# GENHTML
else
# LCOV
################################################################################ else
else
lcov-coverage-clean
:
@
(
echo
ACH!!!! Caca
)
lcov-coverage-filter
:
@
(
echo
ACH!!!! Caca2
)
genhtml-coverage-report
:
@
(
echo
ACH!!!! Caca3
)
endif
################################################################################ endif
endif
# LCOV
if
LCOV_COBERTURA
lcov-cobertura-report
:
lcov_cobertura
"coverage-report.info"
-o
"coverage-report.xml"
gcovr-coverage-report
:
else
# LCOV_COBERTURA
lcov-cobertura-report
:
if
GCOVR
gcovr-coverage-report
:
gcovr
-r
.
-e
"avl_test.*"
--xml
-o
coverage-report.xml
else
gcovr
-r
.
--exclude-unreachable-branches
--exclude-directories
=
"unittests"
--xml
-o
"coverage-report.xml"
else
# GCOVR
gcovr-coverage-report
:
endif
endif
# GCOVR
endif
# LCOV_COBERTURA
coverage-clean
:
lcov-coverage-clean
coverage-report
:
lcov-coverage-filter genhtml-coverage-report gcovr-coverage-report
coverage-report
:
lcov-coverage-filter genhtml-coverage-report
lcov-cobertura-report
gcovr-coverage-report
coverage
:
coverage-clean check coverage-report
ALLPHONY
+=
coverage-clean coverage-report lcov-coverage-clean lcov-coverage-filter genhtml-coverage-report gcovr-coverage-report
else
ALLPHONY
+=
coverage-clean
ALLPHONY
+=
coverage-report
ALLPHONY
+=
lcov-coverage-clean
ALLPHONY
+=
lcov-coverage-filter
ALLPHONY
+=
genhtml-coverage-report
ALLPHONY
+=
gcovr-coverage-report
ALLPHONY
+=
lcov-cobertura-report
else
# COVERAGE
coverage
:
@
(
echo
"Coverage support is disabled. Re-run configure with --enable-coverage switch."
)
endif
endif
# COVERAGE
CLEANFILES
=
"coverage-report.info"
"coverage-report2.info"
"coverage-report"
"coverage-report.xml"
...
...
Makefile.common
View file @
b1aaffe4
AM_CFLAGS
=
-Wall
-Wextra
-Werror
${extra_CFLAGS}
AM_CFLAGS
=
-std
=
c11
-Wall
-Wextra
${extra_CFLAGS}
AM_CXXFLAGS
=
-std
=
c++11
-Wall
-Wextra
${extra_CXXFLAGS}
AM_LDFLAGS
=
${extra_LDFLAGS}
if
DEBUG
...
...
configure.pre
View file @
b1aaffe4
...
...
@@ -23,22 +23,67 @@ AC_PROG_INSTALL
AC_PROG_MAKE_SET
LT_INIT
# Checks for libraries
.
# Checks for libraries
extra_CFLAGS
=
""
extra_CXXFLAGS
=
""
extra_LDFLAGS
=
""
compiler_generic_flags
=
""
compiler_c_flags
=
""
compiler_cxx_flags
=
""
GCC_VERSION
=
""
GCC_VERSION_MAJOR
=
0
GCC_VERSION_MINOR
=
0
GCC_VERSION_PATCH
=
0
AS_IF
([
test
"x$GCC"
=
"xyes"
], [
GCC_VERSION
=
"$($CC -dumpversion)"
GCC_VERSION_MAJOR
=$(
echo
$
GCC_VERSION
|
cut
-
d
'.'
-
f1
)
GCC_VERSION_MINOR
=$(
echo
$
GCC_VERSION
|
cut
-
d
'.'
-
f2
)
GCC_VERSION_PATCH
=$(
echo
$
GCC_VERSION
|
cut
-
d
'.'
-
f3
)
])
AS_IF
([
test
$
GCC_VERSION_MAJOR
-
ge
3
], [
compiler_generic_flags
+=
"-Wshadow "
compiler_generic_flags
+=
"-Wformat=2 "
compiler_cxx_flags
+=
"-Wold-style-cast "
])
AS_IF
([
test
$
GCC_VERSION_MAJOR
-
ge
4
], [
AS_IF
([
test
$
GCC_VERSION_MAJOR
-
gt
4
-
o
$
GCC_VERSION_MINOR
-
ge
3
], [
compiler_generic_flags
+=
"-Wlogical-op "
])
AS_IF
([
test
$
GCC_VERSION_MAJOR
-
gt
4
-
o
$
GCC_VERSION_MINOR
-
ge
5
], [
compiler_generic_flags
+=
"-Wdouble-promotion "
compiler_c_flags
+=
"-Wjump-misses-init "
])
AS_IF
([
test
$
GCC_VERSION_MAJOR
-
gt
4
-
o
$
GCC_VERSION_MINOR
-
ge
8
], [
compiler_cxx_flags
+=
"-Wuseless-cast "
])
])
AS_IF
([
test
$
GCC_VERSION_MAJOR
-
ge
6
], [
compiler_generic_flags
+=
"-Wduplicated-cond "
compiler_generic_flags
+=
"-Wnull-dereference "
])
AS_IF
([
test
$
GCC_VERSION_MAJOR
-
ge
7
], [
compiler_generic_flags
+=
"-Wduplicated-branches "
compiler_generic_flags
+=
"-Wrestrict "
])
# Debug flags
AC_ARG_ENABLE
(
debug
,
AS_HELP_STRING
([--
enable
-
debug
],
[
enable
debugging
[
default
:
no
]]),
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],
[debug=false])
AM_CONDITIONAL(DEBUG, test "x$debug" = "xtrue")
[],
[
enable_debug
=
no
])
AM_CONDITIONAL
(
DEBUG
,
test
"x${enable_debug}"
=
"xyes"
)
AM_COND_IF
(
DEBUG
,
AC_DEFINE(LIBAVL_DEBUG, 1, [Define to 0 if this is a release build]),
AC_DEFINE(LIBAVL_DEBUG, 0, [Define to 1 or higher if this is a debug build]))
[
AC_DEFINE
(
__
DEBUG__
,
1
, [
Define
to
0
if
this
is
a
release
build
])
extra_CFLAGS
+=
"-Werror -g $compiler_generic_flags $compiler_c_flags"
extra_CXXFLAGS
+=
"-Werror -g $compiler_generic_flags $compiler_cxx_flags"
]
)
AC_ARG_ENABLE
(
log
,
AS_HELP_STRING
([--
enable
-
log
],
[
enable
log
with
level
from
0
to
5
[
default
:
0
]]),
...
...
@@ -71,18 +116,38 @@ AM_COND_IF(FUNLOG,
)
AC_ARG_ENABLE
([
coverage
],
AS_HELP_STRING
([--
enable
-
coverage
],
[enable coverage report while testing
.
]),
[
enable
coverage
report
while
testing
[
default
:
no
]
]),
[],
[enable_coverage=false])
if test "$GCC" = "yes"; then
AM_CONDITIONAL(COVERAGE, test "${enable_coverage}" = "yes")
AM_COND_IF(COVERAGE,
[extra_CFLAGS+="--coverage"
extra_LDFLAGS+="-lgcov"
])
fi
[
enable_coverage
=
no
])
AS_IF
([
test
"x$GCC"
=
"xyes"
],
[
AM_CONDITIONAL
(
COVERAGE
,
test
"x${enable_coverage}"
=
"xyes"
)
AM_COND_IF
(
COVERAGE
,
[
extra_CFLAGS
+=
"--coverage "
extra_CXXFLAGS
+=
"--coverage "
extra_LDFLAGS
+=
"-lgcov "
])
],
[
AC_MSG_WARN
([
Coverage
is
currently
not
supported
with
a
compiler
other
than
GCC
])]
)
# Profiling flags
AC_ARG_ENABLE
([
profile
],
AS_HELP_STRING
([--
enable
-
profile
],
[
enable
profiling
functions
while
testing
[
default
:
no
]]),
[],
[
enable_profile
=
no
])
AS_IF
([
test
"x$GCC"
=
"xyes"
],
[
AM_CONDITIONAL
(
PROFILE
,
test
"x${enable_profile}"
=
"xyes"
)
AM_COND_IF
(
PROFILE
,
[
extra_CFLAGS
+=
"-pg "
extra_CXXFLAGS
+=
"-pg "
])
],
[
AC_MSG_WARN
([
Profiling
is
currently
not
supported
with
a
compiler
other
than
GCC
])]
)
AC_SUBST
([
extra_CFLAGS
])
AC_SUBST
([
extra_CXXFLAGS
])
AC_SUBST
([
extra_LDFLAGS
])
# Checks for header files.
...
...
@@ -100,9 +165,11 @@ AC_CHECK_FUNC([memcpy printf])
# Coverage tools
AC_CHECK_PROG
([
gcovr
], [
gcovr
], [
yes
])
AM_CONDITIONAL(GCOVR, test "x${gcovr}" = "xyes")
AM_CONDITIONAL
(
GCOVR
, [
test
"x${gcovr}"
=
"xyes"
])
AC_CHECK_PROG
([
lcov_cobertura
], [
lcov_cobertura
], [
yes
])
AM_CONDITIONAL
(
LCOV_COBERTURA
, [
test
"x${lcov_cobertura}"
=
"xyes"
])
AC_CHECK_PROG
([
lcov
], [
lcov
], [
yes
])
AM_CONDITIONAL(LCOV, test "x${lcov}" = "xyes")
AM_CONDITIONAL
(
LCOV
,
[
test
"x${lcov}"
=
"xyes"
]
)
AC_CHECK_PROG
([
genhtml
], [
genhtml
], [
yes
])
AM_CONDITIONAL
(
GENHTML
, [
test
"x${genhtml}"
=
"xyes"
])
AM_CONDITIONAL
(
PERLGD
, [
perldoc
-
l
GD
])
...
...
@@ -114,4 +181,7 @@ AC_CONFIG_FILES([Makefile
valgrind
-
driver
Doxyfile
])
AM_SILENT_RULES
([
yes
])
AC_OUTPUT
# vi:syntax=config
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment