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,8 +48,7 @@ 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',
@ -57,26 +56,30 @@ if 'virtual_image' in drivers
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',
] ]
endif
foreach test_name: unit_tests foreach test_name: unit_tests
basename = 'test-' + test_name basename = 'test-' + test_name
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,
link_with: test_utils) link_with: test_utils,
)
test(test_name, test(test_name,
find_program('test-runner.sh'), find_program('test-runner.sh'),
suite: ['unit-tests'], suite: ['unit-tests'],
args: [test_exe], args: [test_exe],
env: envs, env: envs,
) )
endforeach endforeach
endif
gdb = find_program('gdb', required: false) gdb = find_program('gdb', required: false)
if gdb.found() if gdb.found()