2019-07-03 21:39:08 +00:00
|
|
|
envs = environment()
|
2019-08-12 14:30:40 +00:00
|
|
|
# Enable debug messages and abort on warnings
|
2019-07-03 21:39:08 +00:00
|
|
|
envs.set('G_DEBUG', 'fatal-warnings')
|
|
|
|
envs.set('G_MESSAGES_DEBUG', 'all')
|
2019-08-12 14:30:40 +00:00
|
|
|
|
|
|
|
# Setup paths
|
2019-07-03 21:39:08 +00:00
|
|
|
envs.set('MESON_SOURCE_ROOT', meson.build_root())
|
|
|
|
envs.prepend('LD_LIBRARY_PATH', join_paths(meson.build_root(), 'libfprint'))
|
2019-08-12 14:30:40 +00:00
|
|
|
|
|
|
|
# Set FP_DEVICE_EMULATION so that drivers can adapt (e.g. to use fixed
|
|
|
|
# random numbers rather than proper ones)
|
|
|
|
envs.set('FP_DEVICE_EMULATION', '1')
|
|
|
|
|
2019-12-13 19:34:08 +00:00
|
|
|
# Set a colon-separated list of native drivers we enable in tests
|
|
|
|
envs.set('FP_DRIVERS_WHITELIST', 'virtual_image')
|
|
|
|
|
2019-07-03 21:39:08 +00:00
|
|
|
envs.set('NO_AT_BRIDGE', '1')
|
|
|
|
|
2019-11-18 20:17:43 +00:00
|
|
|
if get_option('introspection')
|
2019-12-05 13:39:45 +00:00
|
|
|
envs.prepend('GI_TYPELIB_PATH', join_paths(meson.build_root(), 'libfprint'))
|
|
|
|
|
2019-11-18 20:17:43 +00:00
|
|
|
if 'virtual_image' in drivers
|
2019-11-21 19:37:17 +00:00
|
|
|
test('virtual-image',
|
2019-11-18 20:17:43 +00:00
|
|
|
find_program('virtual-image.py'),
|
|
|
|
args: '--verbose',
|
|
|
|
env: envs,
|
|
|
|
depends: libfprint_typelib,
|
|
|
|
)
|
|
|
|
endif
|
2019-07-03 21:39:08 +00:00
|
|
|
|
2019-11-26 19:59:09 +00:00
|
|
|
drivers_tests = [
|
|
|
|
'vfs5011',
|
|
|
|
'synaptics',
|
|
|
|
]
|
2019-08-12 14:30:40 +00:00
|
|
|
|
2019-11-26 19:59:09 +00:00
|
|
|
foreach driver_test: drivers_tests
|
2019-12-13 19:34:08 +00:00
|
|
|
driver_envs = envs
|
|
|
|
driver_envs.set('FP_DRIVERS_WHITELIST', driver_test)
|
|
|
|
|
2019-11-26 19:59:09 +00:00
|
|
|
test(driver_test,
|
2019-11-18 20:17:43 +00:00
|
|
|
find_program('umockdev-test.py'),
|
2019-11-26 19:59:09 +00:00
|
|
|
args: join_paths(meson.current_source_dir(), driver_test),
|
2019-12-13 19:34:08 +00:00
|
|
|
env: driver_envs,
|
2019-11-26 19:59:09 +00:00
|
|
|
suite: ['drivers'],
|
2019-11-18 20:17:43 +00:00
|
|
|
timeout: 10,
|
|
|
|
depends: libfprint_typelib,
|
|
|
|
)
|
2019-11-26 19:59:09 +00:00
|
|
|
endforeach
|
2019-11-18 20:17:43 +00:00
|
|
|
endif
|
2019-11-26 17:45:31 +00:00
|
|
|
|
2019-12-05 13:38:41 +00:00
|
|
|
if 'virtual_image' in drivers
|
|
|
|
test_utils = static_library('fprint-test-utils',
|
|
|
|
sources: ['test-utils.c'],
|
|
|
|
dependencies: libfprint_private_dep,
|
|
|
|
install: false)
|
|
|
|
|
|
|
|
unit_tests = [
|
|
|
|
'fp-context',
|
2019-12-05 16:05:21 +00:00
|
|
|
'fp-device',
|
2019-12-05 13:38:41 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2019-11-26 17:45:31 +00:00
|
|
|
gdb = find_program('gdb', required: false)
|
|
|
|
if gdb.found()
|
|
|
|
add_test_setup('gdb',
|
|
|
|
timeout_multiplier: 1000,
|
|
|
|
env: [
|
|
|
|
'LIBFPRINT_TEST_WRAPPER=@0@ --args'.format(
|
|
|
|
gdb.path())
|
|
|
|
])
|
|
|
|
endif
|
2019-11-26 17:50:18 +00:00
|
|
|
|
|
|
|
valgrind = find_program('valgrind', required: false)
|
|
|
|
if valgrind.found()
|
|
|
|
glib_share = glib_dep.get_pkgconfig_variable('prefix') / 'share' / glib_dep.name()
|
|
|
|
glib_suppressions = glib_share + '/valgrind/glib.supp'
|
|
|
|
python_suppressions = '@0@/@1@'.format(meson.source_root(),
|
|
|
|
files('valgrind-python.supp')[0])
|
|
|
|
add_test_setup('valgrind',
|
|
|
|
timeout_multiplier: 10,
|
|
|
|
env: [
|
|
|
|
'G_SLICE=always-malloc',
|
|
|
|
('LIBFPRINT_TEST_WRAPPER=@0@ --tool=memcheck --leak-check=full ' +
|
|
|
|
'--suppressions=@1@ --suppressions=@2@').format(
|
|
|
|
valgrind.path(), glib_suppressions, python_suppressions)
|
|
|
|
])
|
|
|
|
endif
|