[libvirt PATCH 15/15] meson: add tests build option to enable/disable unit tests

Pavel Hrdina posted 15 patches 5 years, 4 months ago
[libvirt PATCH 15/15] meson: add tests build option to enable/disable unit tests
Posted by Pavel Hrdina 5 years, 4 months ago
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 meson.build       | 6 +++++-
 meson_options.txt | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index f44cb4424a..9f8c43d5ab 100644
--- a/meson.build
+++ b/meson.build
@@ -2205,7 +2205,10 @@ subdir('src')
 
 subdir('tools')
 
-subdir('tests')
+build_tests = not get_option('tests').disabled()
+if build_tests
+  subdir('tests')
+endif
 
 subdir('examples')
 
@@ -2440,6 +2443,7 @@ misc_summary = {
   'Use -Werror': cc_flags.contains('-Werror'),
   'Warning Flags': supported_cc_flags,
   'docs': gen_docs,
+  'tests': build_tests,
   'DTrace': conf.has('WITH_DTRACE_PROBES'),
   'firewalld': conf.has('WITH_FIREWALLD'),
   'firewalld-zone': conf.has('WITH_FIREWALLD_ZONE'),
diff --git a/meson_options.txt b/meson_options.txt
index 3c6d6a03c5..78be491704 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,6 +8,7 @@ option('test_coverage', type: 'boolean', value: false, description: 'turn on cod
 option('git_werror', type: 'feature', value: 'auto', description: 'use -Werror if building from GIT')
 option('rpath', type: 'feature', value: 'auto', description: 'whether to include rpath information in installed binaries and libraries')
 option('docs', type: 'feature', value: 'auto', description: 'whether to generate documentation')
+option('tests', type: 'feature', value: 'auto', description: 'whether to build tests')
 
 
 # build dependencies options
-- 
2.26.2

Re: [libvirt PATCH 15/15] meson: add tests build option to enable/disable unit tests
Posted by Andrea Bolognani 5 years, 4 months ago
On Thu, 2020-10-08 at 15:59 +0200, Pavel Hrdina wrote:
> +++ b/meson_options.txt
> @@ -8,6 +8,7 @@ option('test_coverage', type: 'boolean', value: false, description: 'turn on cod
>  option('git_werror', type: 'feature', value: 'auto', description: 'use -Werror if building from GIT')
>  option('rpath', type: 'feature', value: 'auto', description: 'whether to include rpath information in installed binaries and libraries')
>  option('docs', type: 'feature', value: 'auto', description: 'whether to generate documentation')
> +option('tests', type: 'feature', value: 'auto', description: 'whether to build tests')

Don't we want -Dtests=enabled in libvirt.spec.in at this point?

-- 
Andrea Bolognani / Red Hat / Virtualization

Re: [libvirt PATCH 15/15] meson: add tests build option to enable/disable unit tests
Posted by Pavel Hrdina 5 years, 4 months ago
On Thu, Oct 08, 2020 at 08:17:09PM +0200, Andrea Bolognani wrote:
> On Thu, 2020-10-08 at 15:59 +0200, Pavel Hrdina wrote:
> > +++ b/meson_options.txt
> > @@ -8,6 +8,7 @@ option('test_coverage', type: 'boolean', value: false, description: 'turn on cod
> >  option('git_werror', type: 'feature', value: 'auto', description: 'use -Werror if building from GIT')
> >  option('rpath', type: 'feature', value: 'auto', description: 'whether to include rpath information in installed binaries and libraries')
> >  option('docs', type: 'feature', value: 'auto', description: 'whether to generate documentation')
> > +option('tests', type: 'feature', value: 'auto', description: 'whether to build tests')
> 
> Don't we want -Dtests=enabled in libvirt.spec.in at this point?

As described in a reply to different patch there is no need to do it I
think being explicit is better so I'll add it into libvirt.spec file.

Pavel