tests: Unify G_TEST_SRCDIR/G_TEST_BUILDDIR locations

Cogl and Clutter use the "current source dir" whereas the tests in
src/tests use the non-test source directory. The installed tests already
only use a single directory.

This commit changes everything to be src/test in the source and build
directory.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4307>
This commit is contained in:
Sebastian Wick 2025-02-28 15:34:07 +01:00 committed by Marge Bot
parent 5c9444d03b
commit 2770eef638
12 changed files with 20 additions and 25 deletions

View File

@ -61,8 +61,8 @@ clutter_conform_tests += clutter_conform_tests_classes_tests
clutter_conform_tests += clutter_conform_tests_general_tests
test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_TEST_SRCDIR', mutter_srcdir / 'src' / 'tests')
test_env.set('G_TEST_BUILDDIR', mutter_builddir / 'src' / 'tests')
test_env.set('G_ENABLE_DIAGNOSTIC', '0')
test_env.set('CLUTTER_ENABLE_DIAGNOSTIC', '0')
test_env.set('GSETTINGS_SCHEMA_DIR', locally_compiled_schemas_dir)

View File

@ -61,8 +61,8 @@ cogl_test_c_args = [
]
test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_TEST_SRCDIR', mutter_srcdir / 'src' / 'tests')
test_env.set('G_TEST_BUILDDIR', mutter_builddir / 'src' / 'tests')
test_env.set('G_ENABLE_DIAGNOSTIC', '0')
test_env.set('GSETTINGS_SCHEMA_DIR', locally_compiled_schemas_dir)

View File

@ -11,8 +11,8 @@ cogl_unit_tests = [
]
test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_TEST_SRCDIR', mutter_srcdir / 'src' / 'tests')
test_env.set('G_TEST_BUILDDIR', mutter_builddir / 'src' / 'tests')
test_env.set('G_ENABLE_DIAGNOSTIC', '0')
test_env.set('GSETTINGS_SCHEMA_DIR', locally_compiled_schemas_dir)

View File

@ -122,7 +122,6 @@ main (int argc, char **argv)
g_assert_true (meta_context_configure (context, &argc, &argv, NULL));
system_profile_path = g_test_build_filename (G_TEST_DIST,
"tests",
"icc-profiles",
"vx239-calibrated.icc",
NULL);

View File

@ -722,7 +722,7 @@ meta_test_color_management_profile_system (void)
g_assert_null (meta_color_device_get_assigned_profile (color_device));
path = g_test_get_filename (G_TEST_DIST, "tests", "icc-profiles", "sRGB.icc",
path = g_test_get_filename (G_TEST_DIST, "icc-profiles", "sRGB.icc",
NULL);
add_colord_system_profile (srgb_profile_id, path);
color_profiles[0] = srgb_profile_id;
@ -1107,7 +1107,7 @@ meta_test_color_management_night_light_calibrated (void)
set_night_light_temperature (6500);
set_night_light_active (FALSE);
path = g_test_get_filename (G_TEST_DIST,
"tests", "icc-profiles", "vx239-calibrated.icc",
"icc-profiles", "vx239-calibrated.icc",
NULL);
add_colord_system_profile (profile_id, path);
color_profiles[0] = profile_id;
@ -1358,7 +1358,7 @@ meta_test_color_management_night_light_uncalibrated (void)
set_night_light_temperature (6500);
set_night_light_active (FALSE);
path = g_test_get_filename (G_TEST_DIST, "tests", "icc-profiles", "sRGB.icc",
path = g_test_get_filename (G_TEST_DIST, "icc-profiles", "sRGB.icc",
NULL);
add_colord_system_profile (srgb_profile_id, path);
color_profiles[0] = srgb_profile_id;

View File

@ -1,5 +1,5 @@
[Test]
Description=Mutter test: @testname@
Exec=sh -ec 'env G_TEST_SRCDIR=@pkgdatadir@ G_TEST_BUILDDIR=@libexecdir@/installed-tests/mutter-@apiversion@ MUTTER_REF_TEST_RESULT_DIR=@reftestresultdir@ MUTTER_GDCTL_TEST_RESULT_DIR=@gdctltestresultdir@ @libexecdir@/installed-tests/mutter-@apiversion@/mutter-installed-dbus-session.py @runnerargs@ -- @libexecdir@/installed-tests/mutter-@apiversion@/@testexecutable@ @testargs@'
Exec=sh -ec 'env G_TEST_SRCDIR=@pkgdatadir@/tests G_TEST_BUILDDIR=@libexecdir@/installed-tests/mutter-@apiversion@ MUTTER_REF_TEST_RESULT_DIR=@reftestresultdir@ MUTTER_GDCTL_TEST_RESULT_DIR=@gdctltestresultdir@ @libexecdir@/installed-tests/mutter-@apiversion@/mutter-installed-dbus-session.py @runnerargs@ -- @libexecdir@/installed-tests/mutter-@apiversion@/@testexecutable@ @testargs@'
Type=session
Output=TAP

View File

@ -143,7 +143,7 @@ subdir('wayland-test-clients')
test_env = environment()
test_env_variables = {
'G_TEST_SRCDIR': mutter_srcdir / 'src',
'G_TEST_SRCDIR': mutter_srcdir / 'src' / 'tests',
'G_TEST_BUILDDIR': mutter_builddir / 'src' / 'tests',
'XDG_CONFIG_HOME': mutter_builddir / '.config',
'MUTTER_TEST_PLUGIN_PATH': '@0@'.format(default_plugin.full_path()),
@ -1080,6 +1080,7 @@ if have_installed_tests
stacking_installed_tests_cdata = configuration_data()
stacking_installed_tests_cdata.set('apiversion', libmutter_api_version)
stacking_installed_tests_cdata.set('libexecdir', libexecdir)
stacking_installed_tests_cdata.set('pkgdatadir', pkgdatadir)
stacking_installed_tests_cdata.set('tests_datadir', tests_datadir)
stacking_installed_tests_cdata.set('stacking_test', stacking_test)

View File

@ -323,7 +323,7 @@ meta_ref_test_verify (MetaRefTestAdaptor adaptor,
depathify (test_name);
dist_dir = g_test_get_dir (G_TEST_DIST);
ref_image_path = g_strdup_printf ("%s/tests/ref-tests/%s_%d.ref.png",
ref_image_path = g_strdup_printf ("%s/ref-tests/%s_%d.ref.png",
dist_dir,
test_name, test_seq_no);

View File

@ -96,8 +96,6 @@ meta_ensure_test_client_path (int argc,
char **argv)
{
test_runner_client_path = g_test_build_filename (G_TEST_BUILT,
"src",
"tests",
"mutter-test-client",
NULL);
if (!g_file_test (test_runner_client_path,
@ -785,7 +783,7 @@ meta_set_custom_monitor_config_full (MetaBackend *backend,
config_store = meta_monitor_config_manager_get_store (config_manager);
path = g_test_build_filename (G_TEST_DIST, "tests", "monitor-configs",
path = g_test_build_filename (G_TEST_DIST, "monitor-configs",
filename, NULL);
if (!meta_monitor_config_store_set_custom (config_store, path, NULL,
configs_flags,

View File

@ -406,7 +406,6 @@ check_gdctl_output (const char *expected_output_file,
g_assert_no_error (wait_data.error);
expected_output_path = g_test_build_filename (G_TEST_DIST,
"tests",
"gdctl",
expected_output_file,
NULL);

View File

@ -8975,7 +8975,7 @@ meta_test_monitor_migrated_rotated (void)
MONITOR_TEST_FLAG_NONE);
old_config_path = g_test_build_filename (G_TEST_DIST,
"tests", "migration",
"migration",
"rotated.xml",
NULL);
@ -8998,7 +8998,7 @@ meta_test_monitor_migrated_rotated (void)
check_monitor_test_clients_state ();
expected_path = g_test_get_filename (G_TEST_DIST,
"tests", "migration",
"migration",
"rotated-finished.xml",
NULL);
expected_data = meta_read_file (expected_path);
@ -9253,7 +9253,7 @@ meta_test_monitor_migrated_horizontal_strip (void)
MONITOR_TEST_FLAG_NONE);
old_config_path = g_test_build_filename (G_TEST_DIST,
"tests", "migration",
"migration",
"horizontal-strip.xml",
NULL);
@ -9276,7 +9276,7 @@ meta_test_monitor_migrated_horizontal_strip (void)
check_monitor_test_clients_state ();
expected_path = g_test_get_filename (G_TEST_DIST,
"tests", "migration",
"migration",
"horizontal-strip-finished.xml",
NULL);
expected_data = meta_read_file (expected_path);
@ -9304,7 +9304,7 @@ meta_test_monitor_custom_detached_groups (void)
g_autofree char *path = NULL;
g_autoptr (GError) error = NULL;
path = g_test_build_filename (G_TEST_DIST, "tests", "monitor-configs",
path = g_test_build_filename (G_TEST_DIST, "monitor-configs",
"detached-groups.xml", NULL);
meta_monitor_config_store_set_custom (config_store, path, NULL,
META_MONITORS_CONFIG_FLAG_NONE,
@ -11028,14 +11028,12 @@ main (int argc,
g_assert_true (meta_context_configure (context, &argc, &argv, NULL));
path = g_test_build_filename (G_TEST_DIST,
"tests",
"monitor-configs",
"system",
NULL);
g_setenv ("XDG_CONFIG_DIRS", path, TRUE);
g_free (path);
path = g_test_build_filename (G_TEST_DIST,
"tests",
"monitor-configs",
"user",
NULL);

View File

@ -1,5 +1,5 @@
[Test]
Description=Mutter stacking test: @stacking_test@
Exec=sh -ec '@libexecdir@/installed-tests/mutter-@apiversion@/mutter-installed-dbus-session.py -- @libexecdir@/installed-tests/mutter-@apiversion@/mutter-test-runner @tests_datadir@/stacking/@stacking_test@.metatest'
Exec=sh -ec 'env G_TEST_SRCDIR=@pkgdatadir@/tests G_TEST_BUILDDIR=@libexecdir@/installed-tests/mutter-@apiversion@ @libexecdir@/installed-tests/mutter-@apiversion@/mutter-installed-dbus-session.py -- @libexecdir@/installed-tests/mutter-@apiversion@/mutter-test-runner @tests_datadir@/stacking/@stacking_test@.metatest'
Type=session
Output=TAP