[libglnx/wip/smcv/subproject: 2/3] 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: 2/3] tests: Optionally skip building and running the actual tests
- Date: Thu, 21 Apr 2022 17:34:32 +0000 (UTC)
commit a31c5dc3055c849c3307b22811440b22d7f3b667
Author: Simon McVittie <smcv collabora com>
Date: Thu Apr 21 18:33:32 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 | 6 ++++++
tests/meson.build | 40 +++++++++++++++++++++-------------------
2 files changed, 27 insertions(+), 19 deletions(-)
---
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..5efc08e
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,6 @@
+option(
+ 'tests',
+ type : 'boolean',
+ description : 'build and run unit tests',
+ value : 'true',
+)
diff --git a/tests/meson.build b/tests/meson.build
index 80038c4..47d6b45 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -14,23 +14,25 @@ libglnx_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,
- ],
- )
- test(test_name, exe)
-endforeach
+ foreach test_name : test_names
+ exe = executable(test_name,
+ [
+ 'test-libglnx-' + test_name + '.c',
+ ],
+ dependencies: [
+ libglnx_dep,
+ libglnx_deps,
+ ],
+ )
+ test(test_name, exe)
+ endforeach
+endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]