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.
This commit is contained in:
Marco Trevisan (Treviño) 2019-12-11 21:09:02 +01:00
parent f578ebe82d
commit 324258bc8c

View file

@ -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',