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 endforeach
endif endif
if 'virtual_image' in drivers test_utils = static_library('fprint-test-utils',
test_utils = static_library('fprint-test-utils', sources: [
sources: [ 'test-utils.c',
'test-utils.c', 'test-device-fake.c',
'test-device-fake.c', ],
], dependencies: libfprint_private_dep,
dependencies: libfprint_private_dep, install: false)
install: false)
unit_tests = [ unit_tests = []
if 'virtual_image' in drivers
unit_tests += [
'fp-context', 'fp-context',
'fp-device', '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 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) gdb = find_program('gdb', required: false)
if gdb.found() if gdb.found()
add_test_setup('gdb', add_test_setup('gdb',