Blob Blame History Raw
From 67441cfe751c0b59febf1ed2b0895cf1d5561ff1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Wed, 11 Dec 2019 21:09:02 +0100
Subject: [PATCH 120/181] tests/meson: Support unit-tests non depending on
 virtual driver

Since tests depending on the fake device don't depend on virtual-image
driver anymore, let's change the way we organize the things, by putting
everything in the test lib, but enabling unit-tests depending on what they
depend on.
---
 tests/meson.build | 51 +++++++++++++++++++++++++----------------------
 1 file changed, 27 insertions(+), 24 deletions(-)

diff --git a/tests/meson.build b/tests/meson.build
index e37991d..7482a66 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -48,36 +48,39 @@ if get_option('introspection')
     endforeach
 endif
 
-if 'virtual_image' in drivers
-    test_utils = static_library('fprint-test-utils',
-        sources: [
-            'test-utils.c',
-            'test-device-fake.c',
-        ],
-        dependencies: libfprint_private_dep,
-        install: false)
+test_utils = static_library('fprint-test-utils',
+    sources: [
+        'test-utils.c',
+        'test-device-fake.c',
+    ],
+    dependencies: libfprint_private_dep,
+    install: false)
+
+unit_tests = []
 
-    unit_tests = [
+if 'virtual_image' in drivers
+    unit_tests += [
         'fp-context',
         'fp-device',
     ]
-
-    foreach test_name: unit_tests
-        basename = 'test-' + test_name
-        test_exe = executable(basename,
-            sources: basename + '.c',
-            dependencies: libfprint_private_dep,
-            c_args: common_cflags,
-            link_with: test_utils)
-        test(test_name,
-            find_program('test-runner.sh'),
-            suite: ['unit-tests'],
-            args: [test_exe],
-            env: envs,
-        )
-    endforeach
 endif
 
+foreach test_name: unit_tests
+    basename = 'test-' + test_name
+    test_exe = executable(basename,
+        sources: basename + '.c',
+        dependencies: libfprint_private_dep,
+        c_args: common_cflags,
+        link_with: test_utils,
+    )
+    test(test_name,
+        find_program('test-runner.sh'),
+        suite: ['unit-tests'],
+        args: [test_exe],
+        env: envs,
+    )
+endforeach
+
 gdb = find_program('gdb', required: false)
 if gdb.found()
     add_test_setup('gdb',
-- 
2.24.1