[libglnx/wip/smcv/subproject: 3/4] tests: Optionally skip building and running the actual tests
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libglnx/wip/smcv/subproject: 3/4] tests: Optionally skip building and running the actual tests
- Date: Thu, 21 Apr 2022 17:54:51 +0000 (UTC)
commit a7f66436dab9c8d0b26b28be55f421f54b70bc67
Author: Simon McVittie <smcv collabora com>
Date: Thu Apr 21 18:51:09 2022 +0100
tests: Optionally skip building and running the actual tests
If we're building libglnx as a subproject in a larger project, we won't
necessarily want to run these.
Signed-off-by: Simon McVittie <smcv collabora com>
meson_options.txt | 9 +++++++++
tests/meson.build | 42 ++++++++++++++++++++++--------------------
2 files changed, 31 insertions(+), 20 deletions(-)
---
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..1028017
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,9 @@
+# Copyright 2022 Collabora Ltd.
+# SPDX-License-Identifier: LGPL-2.0-or-later
+
+option(
+ 'tests',
+ type : 'boolean',
+ description : 'build and run unit tests',
+ value : 'true',
+)
diff --git a/tests/meson.build b/tests/meson.build
index 9aeddbf..4ad8528 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -17,24 +17,26 @@ libglnx_testlib_dep = declare_dependency(
link_with : libglnx_testlib,
)
-test_names = [
- 'errors',
- 'fdio',
- 'macros',
- 'shutil',
- 'xattrs',
-]
+if get_option('tests')
+ test_names = [
+ 'errors',
+ 'fdio',
+ 'macros',
+ 'shutil',
+ 'xattrs',
+ ]
-foreach test_name : test_names
- exe = executable(test_name,
- [
- 'test-libglnx-' + test_name + '.c',
- ],
- dependencies: [
- libglnx_dep,
- libglnx_deps,
- libglnx_testlib_dep,
- ],
- )
- test(test_name, exe)
-endforeach
+ foreach test_name : test_names
+ exe = executable(test_name,
+ [
+ 'test-libglnx-' + test_name + '.c',
+ ],
+ dependencies: [
+ libglnx_dep,
+ libglnx_deps,
+ libglnx_testlib_dep,
+ ],
+ )
+ test(test_name, exe)
+ endforeach
+endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]