]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: add test_coverage build option
authorPavel Hrdina <phrdina@redhat.com>
Thu, 30 Apr 2020 12:56:21 +0000 (14:56 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:26:55 +0000 (09:26 +0200)
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>
configure.ac
meson.build
meson_options.txt

index f7e665bd4556a3e5f1b77daf765b304e6a9f975b..d5b3a653dceee022409c7ab93af68e55acb4e334 100644 (file)
@@ -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])
index f9173b1acd656fc8cd7fcd7a79e8b0b9668fa077..ff4fcd31663a6471c48cc2cdd54d11b7dbad9677 100644 (file)
@@ -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)
index 390c7d33fa94e112a6e8a6d0c3b02bbae964b304..7171d4c17b5932c97fb01a62db93f239251b3251 100644 (file)
@@ -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')