[gnome-music/wip/jfelder/build-no-net: 1/2] build: Add network_tests build option
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/build-no-net: 1/2] build: Add network_tests build option
- Date: Thu, 30 Apr 2020 22:30:37 +0000 (UTC)
commit 6045a9bbd4352070287164449965ffd27d7e930d
Author: Jean Felder <jfelder src gnome org>
Date: Fri May 1 00:24:22 2020 +0200
build: Add network_tests build option
This allows disabling network for tests on build systems that do not
allow network during unit tests.
Configuring with -Dnetwork_tests=false will disable appstream validation
by using the --nonet option.
data/meson.build | 11 ++++++-----
meson_options.txt | 2 ++
2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 25ff1e10..aad5da81 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -62,11 +62,12 @@ i18n.merge_file(
# Validating the appdata file
appstream_util = find_program('appstream-util', required: false)
if appstream_util.found()
- test (
- 'Validate appdata file',
- appstream_util,
- args: ['validate-relax', join_paths(meson.current_build_dir (), APPLICATION_ID + '.appdata.xml')]
- )
+ validate_args = ['validate-relax', join_paths(meson.current_build_dir (), APPLICATION_ID + '.appdata.xml')]
+if not get_option('network_tests')
+ validate_args += '--nonet'
+endif
+if appstream_util.found()
+ test ('Validate appdata file', appstream_util, args: validate_args)
endif
# Installing the default icon
diff --git a/meson_options.txt b/meson_options.txt
index a9e396dd..53097192 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,3 +7,5 @@ option(
],
value: 'default'
)
+
+option('network_tests', type: 'boolean', value: true, description: 'Allow networking in unit-tests')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]