[gnome-builder] build: add network_tests build option



commit dd1238d6dec1f1e6e88f4f1748f092a64ae52a02
Author: Christian Hergert <chergert redhat com>
Date:   Tue Sep 25 21:27:42 2018 -0700

    build: add network_tests build option
    
    This allows disabling network for tests on build systems that do not
    allow network during unit tests such as Debian.
    
    Configuring with -Dnetwork_tests=false will disable appstream validation
    by using the --nonet option.
    
    Fixes #626

 data/meson.build  | 9 +++++----
 meson_options.txt | 2 ++
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 2bf0abb85..94e2bcb17 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -27,10 +27,11 @@ appdata_file = i18n.merge_file(
 
 appstream_util = find_program('appstream-util', required: false)
 if appstream_util.found()
-  test('Validate appstream file', appstream_util,
-    # FIXME: Screenshots are wrong size for 'validate'
-    args: ['validate-relax', appdata_file]
-  )
+  validate_args = ['validate-relax', appdata_file]
+if not get_option('network_tests')
+  validate_args += '--nonet'
+endif
+  test('Validate appstream file', appstream_util, args: validate_args)
 endif
 
 # D-Bus service file.
diff --git a/meson_options.txt b/meson_options.txt
index 9d6d0944e..d56194709 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -16,6 +16,8 @@ option('with_vapi', type: 'boolean')
 option('with_help', type: 'boolean', value: false)
 option('with_docs', type: 'boolean', value: false)
 
+option('network_tests', type: 'boolean', value: true, description: 'Allow networking in unit-tests')
+
 option('ctags_path', type: 'string', value: '')
 
 option('python_libprefix', type: 'string')


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