mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-06-11 02:28:05 +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_DRIVERS_DIR', meson.current_build_dir())
|
||||||
tod_envs.set('FP_TOD_KEEP_MODULES_OPEN', 'TRUE')
|
tod_envs.set('FP_TOD_KEEP_MODULES_OPEN', 'TRUE')
|
||||||
tod_envs.set('FP_VIRTUAL_FAKE_DEVICE', 'yes')
|
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',
|
fake_driver = shared_module('device-fake-tod-driver',
|
||||||
sources: [
|
sources: [
|
||||||
|
'test-device-fake.c',
|
||||||
'test-device-fake-tod.c',
|
'test-device-fake-tod.c',
|
||||||
],
|
],
|
||||||
|
c_args: tod_c_args,
|
||||||
link_with: [
|
link_with: [
|
||||||
test_utils,
|
|
||||||
libfprint_tod,
|
libfprint_tod,
|
||||||
],
|
],
|
||||||
include_directories: include_directories('../libfprint'),
|
include_directories: include_directories('../libfprint'),
|
||||||
@@ -216,10 +220,10 @@ if get_option('tod')
|
|||||||
|
|
||||||
test_utils_tod = static_library('fprint-test-utils-tod',
|
test_utils_tod = static_library('fprint-test-utils-tod',
|
||||||
sources: [
|
sources: [
|
||||||
|
'test-utils.c',
|
||||||
'test-utils-tod.c',
|
'test-utils-tod.c',
|
||||||
],
|
],
|
||||||
dependencies: libfprint_private_dep,
|
dependencies: libfprint_private_dep,
|
||||||
link_with: test_utils,
|
|
||||||
install: false)
|
install: false)
|
||||||
|
|
||||||
tod_unit_tests = [
|
tod_unit_tests = [
|
||||||
@@ -232,7 +236,10 @@ if get_option('tod')
|
|||||||
test_exe = executable(basename,
|
test_exe = executable(basename,
|
||||||
sources: basename + '.c',
|
sources: basename + '.c',
|
||||||
dependencies: libfprint_private_dep,
|
dependencies: libfprint_private_dep,
|
||||||
c_args: common_cflags,
|
c_args: [
|
||||||
|
common_cflags,
|
||||||
|
tod_c_args,
|
||||||
|
],
|
||||||
link_with: test_utils_tod,
|
link_with: test_utils_tod,
|
||||||
)
|
)
|
||||||
test(test_name,
|
test(test_name,
|
||||||
@@ -240,6 +247,7 @@ if get_option('tod')
|
|||||||
suite: ['unit-tests', 'tod'],
|
suite: ['unit-tests', 'tod'],
|
||||||
args: [test_exe],
|
args: [test_exe],
|
||||||
env: tod_envs,
|
env: tod_envs,
|
||||||
|
depends: fake_driver,
|
||||||
)
|
)
|
||||||
endforeach
|
endforeach
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -18,7 +18,11 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* 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"
|
#define FP_COMPONENT "fake_test_dev"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "test-device-fake.h"
|
#include "test-device-fake.h"
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ test_context_has_fake_device (void)
|
|||||||
{
|
{
|
||||||
FpDevice *device = devices->pdata[i];
|
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;
|
fake_device = device;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ test_device_get_driver (void)
|
|||||||
g_autoptr(FptContext) tctx = fpt_context_new_with_fake_dev ();
|
g_autoptr(FptContext) tctx = fpt_context_new_with_fake_dev ();
|
||||||
|
|
||||||
fp_device_open_sync (tctx->device, NULL, NULL);
|
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
|
static void
|
||||||
@@ -156,7 +156,7 @@ test_device_get_device_id (void)
|
|||||||
g_autoptr(FptContext) tctx = fpt_context_new_with_fake_dev ();
|
g_autoptr(FptContext) tctx = fpt_context_new_with_fake_dev ();
|
||||||
|
|
||||||
fp_device_open_sync (tctx->device, NULL, NULL);
|
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
|
static void
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ fpt_context_new_with_fake_dev (void)
|
|||||||
{
|
{
|
||||||
FpDevice *device = devices->pdata[i];
|
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;
|
tctx->device = device;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user