diff --git a/tests/meson.build b/tests/meson.build index b172c1ae..31040d1d 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -6,6 +6,8 @@ envs.set('G_MESSAGES_DEBUG', 'all') # Setup paths envs.set('MESON_SOURCE_ROOT', meson.project_source_root()) envs.set('MESON_BUILD_ROOT', meson.project_build_root()) +envs.set('G_TEST_SRCDIR', meson.current_source_dir()) +envs.set('G_TEST_BUILDDIR', meson.current_build_dir()) envs.prepend('LD_LIBRARY_PATH', meson.project_build_root() / 'libfprint') # Set FP_DEVICE_EMULATION so that drivers can adapt (e.g. to use fixed @@ -71,6 +73,12 @@ envs_str = run_command(python3, '-c', env_parser_cmd, env: envs, check: installed_tests).stdout().strip() +envs_str = ' '.join([ + envs_str, + 'G_TEST_SRCDIR=' + installed_tests_testdir, + 'G_TEST_BUILDDIR=' + installed_tests_execdir, +]) + if get_option('introspection') envs.prepend('GI_TYPELIB_PATH', meson.project_build_root() / 'libfprint') virtual_devices_tests = [ @@ -247,10 +255,6 @@ endif unit_tests_deps = { 'fpi-assembling' : [cairo_dep] } -test_config = configuration_data() -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 if unit_tests_deps.has_key(test_name) missing_deps = false @@ -278,7 +282,7 @@ foreach test_name: unit_tests basename = 'test-' + test_name test_exe = executable(basename, - sources: [basename + '.c', test_config_h], + sources: basename + '.c', dependencies: [ libfprint_private_dep ] + extra_deps, c_args: common_cflags, link_whole: test_utils, diff --git a/tests/test-fpi-assembling.c b/tests/test-fpi-assembling.c index 94b8fe5e..c6dae6fe 100644 --- a/tests/test-fpi-assembling.c +++ b/tests/test-fpi-assembling.c @@ -22,7 +22,6 @@ #include #include "fpi-assembling.h" #include "fpi-image.h" -#include "test-config.h" typedef struct { @@ -67,8 +66,7 @@ test_frame_assembling (void) g_autoptr(FpImage) fp_img = NULL; GSList *frames = NULL; - g_assert_false (SOURCE_ROOT == NULL); - path = g_build_path (G_DIR_SEPARATOR_S, SOURCE_ROOT, "tests", "vfs5011", "capture.png", NULL); + path = g_test_build_filename (G_TEST_DIST, "vfs5011", "capture.png", NULL); img = cairo_image_surface_create_from_png (path); data = cairo_image_surface_get_data (img);