diff --git a/tests/meson.build b/tests/meson.build index 49135b435..a9cde8960 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -64,7 +64,6 @@ exe_plugin_test = shared_library( name_prefix: '', install: false, ) -config_h.set_quoted('TESTSUITE_PLUGIN_PATH', exe_plugin_test.full_path()) deps_zuc = [ dep_libshared ] if get_option('test-junit-xml') @@ -250,6 +249,13 @@ env_test_weston = [ 'WESTON_DATA_DIR=' + join_paths(meson.current_source_dir(), '..', 'data'), ] +test_config_h = configuration_data() +test_config_h.set_quoted('WESTON_TEST_REFERENCE_PATH', meson.current_source_dir() + '/reference') +test_config_h.set_quoted('WESTON_MODULE_MAP', env_modmap) +test_config_h.set_quoted('WESTON_DATA_DIR', join_paths(meson.current_source_dir(), '..', 'data')) +test_config_h.set_quoted('TESTSUITE_PLUGIN_PATH', exe_plugin_test.full_path()) +configure_file(output: 'test-config.h', configuration: test_config_h) + foreach t : tests t_name = 'test-' + t.get('name') t_sources = t.get('sources', [t.get('name') + '-test.c']) @@ -271,7 +277,7 @@ foreach t : tests install: false, ) - test(t.get('name'), t_exe, depends: t.get('test_deps', []), env: env_test_weston) + test(t.get('name'), t_exe, depends: t.get('test_deps', [])) endforeach # FIXME: the multiple loops is lame. rethink this. diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c index 503ed0983..3fb6b72f8 100644 --- a/tests/weston-test-client-helper.c +++ b/tests/weston-test-client-helper.c @@ -34,6 +34,7 @@ #include #include +#include "test-config.h" #include "shared/os-compatibility.h" #include "shared/xalloc.h" #include @@ -1025,7 +1026,7 @@ reference_path(void) char *path = getenv("WESTON_TEST_REFERENCE_PATH"); if (!path) - return "./tests/reference"; + return WESTON_TEST_REFERENCE_PATH; return path; } diff --git a/tests/weston-test-fixture-compositor.c b/tests/weston-test-fixture-compositor.c index 04c06409b..ea206be01 100644 --- a/tests/weston-test-fixture-compositor.c +++ b/tests/weston-test-fixture-compositor.c @@ -31,6 +31,7 @@ #include "shared/helpers.h" #include "weston-test-fixture-compositor.h" #include "weston.h" +#include "test-config.h" struct prog_args { int argc; @@ -180,6 +181,12 @@ execute_compositor(const struct compositor_setup *setup, const char *ctmp; int ret; + if (setenv("WESTON_MODULE_MAP", WESTON_MODULE_MAP, 0) < 0 || + setenv("WESTON_DATA_DIR", WESTON_DATA_DIR, 0) < 0) { + fprintf(stderr, "Error: environment setup failed.\n"); + return RESULT_HARD_ERROR; + } + #ifndef BUILD_DRM_COMPOSITOR if (setup->backend == WESTON_BACKEND_DRM) { fprintf(stderr, "DRM-backend required but not built, skipping.\n");