Merge tag 'v1.94.6' into tod

v1.94.6

Git-EVTag-v0-SHA512: e1afaf08552dd3bc8e20229f4e8e141236a2133ce69cd3c68332e68483fb80a471ac0d7da1eedd6e4b0944b729433ac26e86ec12ef3accc78f86b1331150e185
This commit is contained in:
Marco Trevisan (Treviño)
2023-08-17 05:26:05 +02:00
46 changed files with 1075 additions and 355 deletions
+114 -14
View File
@@ -4,9 +4,9 @@ envs.set('G_DEBUG', 'fatal-warnings')
envs.set('G_MESSAGES_DEBUG', 'all')
# Setup paths
envs.set('MESON_SOURCE_ROOT', meson.source_root())
envs.set('MESON_BUILD_ROOT', meson.build_root())
envs.prepend('LD_LIBRARY_PATH', join_paths(meson.build_root(), 'libfprint'))
envs.set('MESON_SOURCE_ROOT', meson.project_source_root())
envs.set('MESON_BUILD_ROOT', meson.project_build_root())
envs.prepend('LD_LIBRARY_PATH', meson.project_build_root() / 'libfprint')
# Set FP_DEVICE_EMULATION so that drivers can adapt (e.g. to use fixed
# random numbers rather than proper ones)
@@ -19,8 +19,17 @@ envs.set('FP_DRIVERS_WHITELIST', ':'.join([
'virtual_device_storage',
]))
envs.set('FP_PRINTS_PATH', meson.project_source_root() / 'examples' / 'prints')
envs.set('NO_AT_BRIDGE', '1')
python3 = find_program('python3')
installed_tests = get_option('installed-tests')
installed_tests_execdir = libexecdir / 'installed-tests' / versioned_libname
installed_tests_testdir = datadir / 'installed-tests' / versioned_libname
installed_tests_libdir = libdir
drivers_tests = [
'aes2501',
'aes3500',
@@ -30,6 +39,7 @@ drivers_tests = [
'elanspi',
'synaptics',
'upektc_img',
'upektc_img-tcs1s',
'uru4000-msv2',
'uru4000-4500',
'vfs0050',
@@ -44,23 +54,33 @@ drivers_tests = [
if get_option('introspection')
conf = configuration_data()
conf.set('SRCDIR', meson.source_root())
conf.set('BUILDDIR', meson.build_root())
conf.set('SRCDIR', meson.project_source_root())
conf.set('BUILDDIR', meson.project_build_root())
configure_file(configuration: conf,
input: 'create-driver-test.py.in',
output: 'create-driver-test.py')
endif
env_parser_cmd = '''
import os;
print(" ".join([f"{k}={v}" for k, v in os.environ.items()
if k.startswith("FP_") or k.startswith("G_")]))
'''
envs_str = run_command(python3, '-c', env_parser_cmd,
env: envs,
check: installed_tests).stdout().strip()
if get_option('introspection')
envs.prepend('GI_TYPELIB_PATH', join_paths(meson.build_root(), 'libfprint'))
envs.prepend('GI_TYPELIB_PATH', meson.project_build_root() / 'libfprint')
virtual_devices_tests = [
'virtual-image',
'virtual-device',
]
python3 = find_program('python3')
unittest_inspector = find_program('unittest_inspector.py')
umockdev_test = find_program('umockdev-test.py')
umockdev_test_name = 'umockdev-test.py'
umockdev_test = find_program(umockdev_test_name)
foreach vdtest: virtual_devices_tests
driver_name = '_'.join(vdtest.split('-'))
@@ -92,6 +112,31 @@ if get_option('introspection')
env: envs,
)
endforeach
if installed_tests
install_data(base_args,
install_dir: installed_tests_execdir,
install_mode: 'rwxr-xr-x',
)
configure_file(
input: 'test.in',
output: vdtest + '.test',
install_dir: installed_tests_testdir,
configuration: {
# FIXME: use fs.name() on meson 0.58
'exec': installed_tests_execdir / '@0@'.format(base_args[0]).split('/')[-1],
'env': ' '.join([
envs_str,
'LD_LIBRARY_PATH=' + installed_tests_libdir,
'FP_PRINTS_PATH=' + installed_tests_testdir / 'prints',
# FIXME: Adding this requires gnome-desktop-testing!12
# 'GI_TYPELIB_PATH=' + installed_tests_libdir / 'girepository-1.0',
]),
'extra_content': '',
},
)
endif
else
test(vdtest,
find_program('sh'),
@@ -100,6 +145,7 @@ if get_option('introspection')
endif
endforeach
driver_tests_enabled = false
foreach driver_test: drivers_tests
driver_name = driver_test.split('-')[0]
driver_envs = envs
@@ -107,6 +153,7 @@ if get_option('introspection')
if (driver_name in supported_drivers and
gusb_dep.version().version_compare('>= 0.3.0'))
driver_tests_enabled = true
test(driver_test,
python3,
args: [
@@ -118,6 +165,32 @@ if get_option('introspection')
timeout: 15,
depends: libfprint_typelib,
)
if installed_tests
driver_envs_str = run_command(python3, '-c', env_parser_cmd,
env: driver_envs,
check: true).stdout().strip()
configure_file(
input: 'driver.test.in',
output: 'driver-' + driver_test + '.test',
install_dir: installed_tests_testdir,
configuration: {
'installed_tests_execdir': installed_tests_execdir,
'installed_tests_testdir': installed_tests_testdir,
'umockdev_test_name': umockdev_test_name,
'driver_test': driver_test,
'driver_env': ' '.join([
driver_envs_str,
'LD_LIBRARY_PATH=' + installed_tests_libdir,
# FIXME: Adding this requires gnome-desktop-testing!12
# 'GI_TYPELIB_PATH=' + installed_tests_libdir / 'girepository-1.0',
]),
},
)
install_subdir(driver_test, install_dir: installed_tests_testdir)
endif
else
test(driver_test,
find_program('sh'),
@@ -125,6 +198,17 @@ if get_option('introspection')
)
endif
endforeach
if installed_tests and driver_tests_enabled
install_data(umockdev_test.full_path(),
install_dir: installed_tests_execdir,
install_mode: 'rwxr-xr-x',
)
install_data('capture.py',
install_dir: installed_tests_execdir,
install_mode: 'rwxr-xr-x',
)
endif
else
warning('Skipping all driver tests as introspection bindings are missing')
test('virtual-image',
@@ -164,7 +248,7 @@ endif
unit_tests_deps = { 'fpi-assembling' : [cairo_dep] }
test_config = configuration_data()
test_config.set_quoted('SOURCE_ROOT', meson.source_root())
test_config.set_quoted('SOURCE_ROOT', meson.project_source_root())
test_config_h = configure_file(output: 'test-config.h', configuration: test_config)
foreach test_name: unit_tests
@@ -197,13 +281,28 @@ foreach test_name: unit_tests
sources: [basename + '.c', test_config_h],
dependencies: [ libfprint_private_dep ] + extra_deps,
c_args: common_cflags,
link_with: test_utils,
link_whole: test_utils,
install: installed_tests,
install_dir: installed_tests_execdir,
)
test(test_name,
test_exe,
suite: ['unit-tests'],
env: envs,
)
configure_file(
input: 'test.in',
output: test_name + '.test',
install: installed_tests,
install_dir: installed_tests_testdir,
configuration: {
'exec': installed_tests_execdir / basename,
'env': envs_str,
'extra_content': 'TestEnvironment=LD_LIBRARY_PATH=' +
installed_tests_libdir,
},
)
endforeach
# Run udev rule generator with fatal warnings
@@ -217,7 +316,7 @@ test('udev-hwdb',
gdb = find_program('gdb', required: false)
if gdb.found()
libfprint_wrapper = [
gdb.path(),
gdb.full_path(),
'-batch',
'-ex', 'run',
'--args',
@@ -234,12 +333,12 @@ 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'
libfprint_suppressions = '@0@/@1@'.format(meson.source_root(),
libfprint_suppressions = '@0@/@1@'.format(meson.project_source_root(),
files('libfprint.supp')[0])
python_suppressions = '@0@/@1@'.format(meson.source_root(),
python_suppressions = '@0@/@1@'.format(meson.project_source_root(),
files('valgrind-python.supp')[0])
libfprint_wrapper = [
valgrind.path(),
valgrind.full_path(),
'--tool=memcheck',
'--leak-check=full',
'--leak-resolution=high',
@@ -248,6 +347,7 @@ if valgrind.found()
'--track-origins=yes',
'--show-leak-kinds=definite,possible',
'--show-error-list=yes',
'--gen-suppressions=all',
'--suppressions=' + libfprint_suppressions,
'--suppressions=' + glib_suppressions,
'--suppressions=' + python_suppressions,