Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- configure.ac | 21 --------------------- meson.build | 16 ++++++++++++++++ meson_options.txt | 1 + 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 7b370f4f1be..d76c2d22fc2 100644 --- a/configure.ac +++ b/configure.ac @@ -616,23 +616,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 @@ -878,10 +861,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_DEBUG diff --git a/meson.build b/meson.build index e48525d9d22..e91d664a77a 100644 --- a/meson.build +++ b/meson.build @@ -134,6 +134,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 @@ -187,3 +195,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) diff --git a/meson_options.txt b/meson_options.txt index f0c4f93ad16..0f79f8aea03 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,3 +5,4 @@ option('system', type: 'boolean', value: false, description: 'Set install paths option('runstatedir', type: 'string', value: '', description: 'State directory for temporary sockets, pid files, etc') option('test_suite', type: 'boolean', value: true, description: 'Whether to enable and build test suite by default') 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') -- 2.26.2