[libvirt PATCH 016/351] meson: add test_suite build option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With autoconf this option controlled if the test suite is compiled by
default or not with the fact that it will be compiled later when
running `make check`.

With meson it is not possible to compile it later when running
`ninja test` as it will be always compiled if referenced by `test()`
function in meson.build files. Because of that enable the test suite
be default.

Enabling it only when compiling from git makes the test suite disabled
for `ninja dist` command which builds the code from non-git location.
Since that command is closest equivalent of `make distcheck` which runs
the test suite.

The only drawback from the autoconf state is that users compiling
libvirt from tarball will compile the test suite as well even though
they will not run it in most cases.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 configure.ac      | 17 -----------------
 meson.build       |  5 +++++
 meson_options.txt |  1 +
 3 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/configure.ac b/configure.ac
index 66fc88bd014..71766f2fe61 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_WITH([TEST_SUITE], [build test suite by default], [check])
-case "$with_test_suite" in
-    yes|no|check) ;;
-    *) AC_MSG_ERROR([bad value ${withval} for tests option]) ;;
-esac
-
-AC_MSG_CHECKING([Whether to build test suite by default])
-if test "$with_test_suite" = "check" ; then
-  if test -d $srcdir/.git ; then
-    with_test_suite=yes
-  else
-    with_test_suite=no
-  fi
-fi
-AC_MSG_RESULT([$with_test_suite])
-AM_CONDITIONAL([WITH_TESTS], [test "$with_test_suite" = "yes"])
-
 LIBVIRT_ARG_ENABLE([EXPENSIVE_TESTS],
                    [set the default for enabling expensive tests ]
                      [(long timeouts), use VIR_TEST_EXPENSIVE to ]
diff --git a/meson.build b/meson.build
index 633db2df51a..fee75204d27 100644
--- a/meson.build
+++ b/meson.build
@@ -124,6 +124,11 @@ if packager_version != ''
 endif
 
 
+# test options
+
+use_test_suite = get_option('test_suite')
+
+
 # figure out libvirt version strings
 
 arr_version = meson.project_version().split('.')
diff --git a/meson_options.txt b/meson_options.txt
index 2281faec429..6973b9f6587 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,3 +3,4 @@ option('packager', type: 'string', value: '', description: 'Extra packager name'
 option('packager_version', type: 'string', value: '', description: 'Extra packager version')
 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('test_suite', type: 'boolean', value: true, description: 'Whether to enable and build test suite by default')
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux