mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-06-10 18:24:19 +00:00
tests: Isolate more the TOD tests so that we build the driver without clashes
This commit is contained in:
+12
-4
@@ -199,14 +199,18 @@ if get_option('tod')
|
||||
tod_envs.set('FP_TOD_DRIVERS_DIR', meson.current_build_dir())
|
||||
tod_envs.set('FP_TOD_KEEP_MODULES_OPEN', 'TRUE')
|
||||
tod_envs.set('FP_VIRTUAL_FAKE_DEVICE', 'yes')
|
||||
tod_envs.append('FP_DRIVERS_WHITELIST', 'fake_test_dev')
|
||||
tod_envs.append('FP_DRIVERS_WHITELIST', 'fake_test_dev_tod')
|
||||
tod_c_args = [
|
||||
'-DTEST_TOD_DRIVER=1',
|
||||
]
|
||||
|
||||
fake_driver = shared_module('device-fake-tod-driver',
|
||||
sources: [
|
||||
'test-device-fake.c',
|
||||
'test-device-fake-tod.c',
|
||||
],
|
||||
c_args: tod_c_args,
|
||||
link_with: [
|
||||
test_utils,
|
||||
libfprint_tod,
|
||||
],
|
||||
include_directories: include_directories('../libfprint'),
|
||||
@@ -216,10 +220,10 @@ if get_option('tod')
|
||||
|
||||
test_utils_tod = static_library('fprint-test-utils-tod',
|
||||
sources: [
|
||||
'test-utils.c',
|
||||
'test-utils-tod.c',
|
||||
],
|
||||
dependencies: libfprint_private_dep,
|
||||
link_with: test_utils,
|
||||
install: false)
|
||||
|
||||
tod_unit_tests = [
|
||||
@@ -232,7 +236,10 @@ if get_option('tod')
|
||||
test_exe = executable(basename,
|
||||
sources: basename + '.c',
|
||||
dependencies: libfprint_private_dep,
|
||||
c_args: common_cflags,
|
||||
c_args: [
|
||||
common_cflags,
|
||||
tod_c_args,
|
||||
],
|
||||
link_with: test_utils_tod,
|
||||
)
|
||||
test(test_name,
|
||||
@@ -240,6 +247,7 @@ if get_option('tod')
|
||||
suite: ['unit-tests', 'tod'],
|
||||
args: [test_exe],
|
||||
env: tod_envs,
|
||||
depends: fake_driver,
|
||||
)
|
||||
endforeach
|
||||
endif
|
||||
|
||||
@@ -18,7 +18,11 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef TEST_TOD_DRIVER
|
||||
#define FP_COMPONENT "fake_test_dev_tod"
|
||||
#else
|
||||
#define FP_COMPONENT "fake_test_dev"
|
||||
#endif
|
||||
|
||||
#include "test-device-fake.h"
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ test_context_has_fake_device (void)
|
||||
{
|
||||
FpDevice *device = devices->pdata[i];
|
||||
|
||||
if (g_strcmp0 (fp_device_get_driver (device), "fake_test_dev") == 0)
|
||||
if (g_strcmp0 (fp_device_get_driver (device), "fake_test_dev_tod") == 0)
|
||||
{
|
||||
fake_device = device;
|
||||
break;
|
||||
|
||||
@@ -147,7 +147,7 @@ test_device_get_driver (void)
|
||||
g_autoptr(FptContext) tctx = fpt_context_new_with_fake_dev ();
|
||||
|
||||
fp_device_open_sync (tctx->device, NULL, NULL);
|
||||
g_assert_cmpstr (fp_device_get_driver (tctx->device), ==, "fake_test_dev");
|
||||
g_assert_cmpstr (fp_device_get_driver (tctx->device), ==, "fake_test_dev_tod");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -156,7 +156,7 @@ test_device_get_device_id (void)
|
||||
g_autoptr(FptContext) tctx = fpt_context_new_with_fake_dev ();
|
||||
|
||||
fp_device_open_sync (tctx->device, NULL, NULL);
|
||||
g_assert_cmpstr (fp_device_get_device_id (tctx->device), ==, "fake_test_dev");
|
||||
g_assert_cmpstr (fp_device_get_device_id (tctx->device), ==, "fake_test_dev_tod");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -38,7 +38,7 @@ fpt_context_new_with_fake_dev (void)
|
||||
{
|
||||
FpDevice *device = devices->pdata[i];
|
||||
|
||||
if (g_strcmp0 (fp_device_get_driver (device), "fake_test_dev") == 0)
|
||||
if (g_strcmp0 (fp_device_get_driver (device), "fake_test_dev_tod") == 0)
|
||||
{
|
||||
tctx->device = device;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user