tests: Use native meson exec wrapper in test setups instead of our script

No need to provide a script that will break usage of `meson test --gdb`
when we can use a native and cleaner alternative.

We can then ignore LIBFPRINT_TEST_WRAPPER in basic tests, while it is
still needed by umockdev tests.
This commit is contained in:
Marco Trevisan (Treviño) 2021-04-13 17:04:01 +02:00
parent 683ac48e21
commit 9a1dcaa801
4 changed files with 18 additions and 26 deletions

View file

@ -177,9 +177,8 @@ foreach test_name: unit_tests
link_with: test_utils, link_with: test_utils,
) )
test(test_name, test(test_name,
find_program('test-runner.sh'), test_exe,
suite: ['unit-tests'], suite: ['unit-tests'],
args: [test_exe],
env: envs, env: envs,
) )
endforeach endforeach
@ -193,11 +192,17 @@ test('udev-hwdb',
gdb = find_program('gdb', required: false) gdb = find_program('gdb', required: false)
if gdb.found() if gdb.found()
libfprint_wrapper = [
gdb.path(),
'-batch',
'-ex', 'run',
'--args',
]
add_test_setup('gdb', add_test_setup('gdb',
timeout_multiplier: 1000, timeout_multiplier: 1000,
exe_wrapper: libfprint_wrapper,
env: [ env: [
'LIBFPRINT_TEST_WRAPPER=@0@ --args'.format( 'LIBFPRINT_TEST_WRAPPER=' + ' '.join(libfprint_wrapper),
gdb.path())
]) ])
endif endif
@ -207,13 +212,19 @@ if valgrind.found()
glib_suppressions = glib_share + '/valgrind/glib.supp' glib_suppressions = glib_share + '/valgrind/glib.supp'
python_suppressions = '@0@/@1@'.format(meson.source_root(), python_suppressions = '@0@/@1@'.format(meson.source_root(),
files('valgrind-python.supp')[0]) files('valgrind-python.supp')[0])
libfprint_wrapper = [
valgrind.path(),
'--tool=memcheck',
'--leak-check=full',
'--suppressions=' + glib_suppressions,
'--suppressions=' + python_suppressions,
]
add_test_setup('valgrind', add_test_setup('valgrind',
timeout_multiplier: 10, timeout_multiplier: 10,
exe_wrapper: libfprint_wrapper,
env: [ env: [
'G_SLICE=always-malloc', 'G_SLICE=always-malloc',
'UNDER_VALGRIND=1', 'UNDER_VALGRIND=1',
('LIBFPRINT_TEST_WRAPPER=@0@ --tool=memcheck --leak-check=full ' + 'LIBFPRINT_TEST_WRAPPER=' + ' '.join(libfprint_wrapper),
'--suppressions=@1@ --suppressions=@2@').format(
valgrind.path(), glib_suppressions, python_suppressions)
]) ])
endif endif

View file

@ -1,3 +0,0 @@
#!/bin/bash
exec $LIBFPRINT_TEST_WRAPPER $@

View file

@ -22,14 +22,6 @@ except Exception as e:
FPrint = None FPrint = None
# Re-run the test with the passed wrapper if set
wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER')
if wrapper:
wrap_cmd = wrapper.split(' ') + [sys.executable, os.path.abspath(__file__)] + \
sys.argv[1:]
os.unsetenv('LIBFPRINT_TEST_WRAPPER')
sys.exit(subprocess.check_call(wrap_cmd))
ctx = GLib.main_context_default() ctx = GLib.main_context_default()

View file

@ -21,14 +21,6 @@ except Exception as e:
FPrint = None FPrint = None
# Re-run the test with the passed wrapper if set
wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER')
if wrapper:
wrap_cmd = wrapper.split(' ') + [sys.executable, os.path.abspath(__file__)] + \
sys.argv[1:]
os.unsetenv('LIBFPRINT_TEST_WRAPPER')
sys.exit(subprocess.check_call(wrap_cmd))
def load_image(img): def load_image(img):
png = cairo.ImageSurface.create_from_png(img) png = cairo.ImageSurface.create_from_png(img)