Blame SOURCES/0120-tests-meson-Support-unit-tests-non-depending-on-virt.patch

73b847
From 67441cfe751c0b59febf1ed2b0895cf1d5561ff1 Mon Sep 17 00:00:00 2001
73b847
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
73b847
Date: Wed, 11 Dec 2019 21:09:02 +0100
73b847
Subject: [PATCH 120/181] tests/meson: Support unit-tests non depending on
73b847
 virtual driver
73b847
73b847
Since tests depending on the fake device don't depend on virtual-image
73b847
driver anymore, let's change the way we organize the things, by putting
73b847
everything in the test lib, but enabling unit-tests depending on what they
73b847
depend on.
73b847
---
73b847
 tests/meson.build | 51 +++++++++++++++++++++++++----------------------
73b847
 1 file changed, 27 insertions(+), 24 deletions(-)
73b847
73b847
diff --git a/tests/meson.build b/tests/meson.build
73b847
index e37991d..7482a66 100644
73b847
--- a/tests/meson.build
73b847
+++ b/tests/meson.build
73b847
@@ -48,36 +48,39 @@ if get_option('introspection')
73b847
     endforeach
73b847
 endif
73b847
 
73b847
-if 'virtual_image' in drivers
73b847
-    test_utils = static_library('fprint-test-utils',
73b847
-        sources: [
73b847
-            'test-utils.c',
73b847
-            'test-device-fake.c',
73b847
-        ],
73b847
-        dependencies: libfprint_private_dep,
73b847
-        install: false)
73b847
+test_utils = static_library('fprint-test-utils',
73b847
+    sources: [
73b847
+        'test-utils.c',
73b847
+        'test-device-fake.c',
73b847
+    ],
73b847
+    dependencies: libfprint_private_dep,
73b847
+    install: false)
73b847
+
73b847
+unit_tests = []
73b847
 
73b847
-    unit_tests = [
73b847
+if 'virtual_image' in drivers
73b847
+    unit_tests += [
73b847
         'fp-context',
73b847
         'fp-device',
73b847
     ]
73b847
-
73b847
-    foreach test_name: unit_tests
73b847
-        basename = 'test-' + test_name
73b847
-        test_exe = executable(basename,
73b847
-            sources: basename + '.c',
73b847
-            dependencies: libfprint_private_dep,
73b847
-            c_args: common_cflags,
73b847
-            link_with: test_utils)
73b847
-        test(test_name,
73b847
-            find_program('test-runner.sh'),
73b847
-            suite: ['unit-tests'],
73b847
-            args: [test_exe],
73b847
-            env: envs,
73b847
-        )
73b847
-    endforeach
73b847
 endif
73b847
 
73b847
+foreach test_name: unit_tests
73b847
+    basename = 'test-' + test_name
73b847
+    test_exe = executable(basename,
73b847
+        sources: basename + '.c',
73b847
+        dependencies: libfprint_private_dep,
73b847
+        c_args: common_cflags,
73b847
+        link_with: test_utils,
73b847
+    )
73b847
+    test(test_name,
73b847
+        find_program('test-runner.sh'),
73b847
+        suite: ['unit-tests'],
73b847
+        args: [test_exe],
73b847
+        env: envs,
73b847
+    )
73b847
+endforeach
73b847
+
73b847
 gdb = find_program('gdb', required: false)
73b847
 if gdb.found()
73b847
     add_test_setup('gdb',
73b847
-- 
73b847
2.24.1
73b847