mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
meson: add test_coverage build option
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
parent
3a7faf84df
commit
2e613fae7c
21
configure.ac
21
configure.ac
@ -614,23 +614,6 @@ if test -z "$PERL"; then
|
||||
AC_MSG_ERROR(['perl' binary is required to build libvirt])
|
||||
fi
|
||||
|
||||
LIBVIRT_ARG_ENABLE([TEST_COVERAGE], [turn on code coverage instrumentation], [no])
|
||||
case "$enable_test_coverage" in
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR([bad value ${enable_test_coverga} for test-coverage option]) ;;
|
||||
esac
|
||||
|
||||
if test "$enable_test_coverage" = yes; then
|
||||
save_WARN_CFLAGS=$WARN_CFLAGS
|
||||
WARN_CFLAGS=
|
||||
gl_WARN_ADD([-fprofile-arcs])
|
||||
gl_WARN_ADD([-ftest-coverage])
|
||||
COVERAGE_FLAGS=$WARN_CFLAGS
|
||||
AC_SUBST([COVERAGE_CFLAGS], [$COVERAGE_FLAGS])
|
||||
AC_SUBST([COVERAGE_LDFLAGS], [$COVERAGE_FLAGS])
|
||||
WARN_CFLAGS=$save_WARN_CFLAGS
|
||||
fi
|
||||
|
||||
dnl MinGW checks
|
||||
LIBVIRT_WIN_CHECK_COMMON
|
||||
LIBVIRT_WIN_CHECK_MINGW
|
||||
@ -876,10 +859,6 @@ AC_MSG_NOTICE([])
|
||||
LIBVIRT_WIN_RESULT_COMMON
|
||||
LIBVIRT_WIN_RESULT_WINDRES
|
||||
AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([Test suite])
|
||||
AC_MSG_NOTICE([])
|
||||
LIBVIRT_RESULT([Coverage], [$enable_test_coverage])
|
||||
AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([Miscellaneous])
|
||||
AC_MSG_NOTICE([])
|
||||
LIBVIRT_RESULT([Use -Werror], [$enable_werror])
|
||||
|
16
meson.build
16
meson.build
@ -137,6 +137,14 @@ else
|
||||
use_expensive_tests = get_option('expensive_tests').enabled()
|
||||
endif
|
||||
|
||||
coverage_flags = []
|
||||
if get_option('test_coverage')
|
||||
coverage_flags = [
|
||||
'-fprofile-arcs',
|
||||
'-ftest-coverage',
|
||||
]
|
||||
endif
|
||||
|
||||
|
||||
# figure out libvirt version strings
|
||||
|
||||
@ -190,3 +198,11 @@ top_inc_dir = include_directories('.')
|
||||
|
||||
# generate meson-config.h file
|
||||
configure_file(output: 'meson-config.h', configuration: conf)
|
||||
|
||||
|
||||
# print configuration summary
|
||||
|
||||
test_summary = {
|
||||
'Coverage': coverage_flags.length() > 0,
|
||||
}
|
||||
summary(test_summary, section: 'Test suite', bool_yn: true)
|
||||
|
@ -5,3 +5,4 @@ option('packager_version', type: 'string', value: '', description: 'Extra packag
|
||||
option('system', type: 'boolean', value: false, description: 'Set install paths to system ones')
|
||||
option('runstatedir', type: 'string', value: '', description: 'State directory for temporary sockets, pid files, etc')
|
||||
option('expensive_tests', type: 'feature', value: 'auto', description: 'set the default for enabling expensive tests (long timeouts), use VIR_TEST_EXPENSIVE to override')
|
||||
option('test_coverage', type: 'boolean', value: false, description: 'turn on code coverage instrumentation')
|
||||
|
Loading…
Reference in New Issue
Block a user