tests/ref-test: Set output dir via env var
While when running with meson, we want the output to be in meson-logs for convenience, such a path isn't feasible when running as an installed test. To address this, make the destination path configurable via an environment variable. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3973>
This commit is contained in:
parent
7d4db86804
commit
e53bdc4416
2 changed files with 11 additions and 10 deletions
|
@ -145,6 +145,7 @@ test_env_variables = {
|
|||
'G_TEST_BUILDDIR': mutter_builddir,
|
||||
'XDG_CONFIG_HOME': mutter_builddir / '.config',
|
||||
'MUTTER_TEST_PLUGIN_PATH': '@0@'.format(default_plugin.full_path()),
|
||||
'MUTTER_REF_TEST_RESULT_DIR': mutter_builddir / 'meson-logs' / 'tests' / 'ref-tests',
|
||||
'GSETTINGS_SCHEMA_DIR': ':'.join([mutter_builddir / 'src' / 'tests',
|
||||
locally_compiled_schemas_dir]),
|
||||
}
|
||||
|
|
|
@ -527,7 +527,7 @@ meta_ref_test_verify_view (ClutterStageView *view,
|
|||
&diff_stat))
|
||||
{
|
||||
cairo_surface_t *diff_image;
|
||||
const char *build_dir;
|
||||
const char *ref_test_result_dir;
|
||||
g_autofree char *ref_image_copy_path = NULL;
|
||||
g_autofree char *result_image_path = NULL;
|
||||
g_autofree char *diff_image_path = NULL;
|
||||
|
@ -535,22 +535,22 @@ meta_ref_test_verify_view (ClutterStageView *view,
|
|||
diff_image = visualize_difference (ref_image, view_image,
|
||||
&gl_fuzz);
|
||||
|
||||
build_dir = g_test_get_dir (G_TEST_BUILT);
|
||||
ref_test_result_dir = g_getenv ("MUTTER_REF_TEST_RESULT_DIR");
|
||||
g_assert_nonnull (ref_test_result_dir);
|
||||
ref_image_copy_path =
|
||||
g_strdup_printf ("%s/meson-logs/tests/ref-tests/%s_%d.ref.png",
|
||||
build_dir,
|
||||
g_strdup_printf ("%s/%s_%d.ref.png",
|
||||
ref_test_result_dir,
|
||||
test_name, test_seq_no);
|
||||
result_image_path =
|
||||
g_strdup_printf ("%s/meson-logs/tests/ref-tests/%s_%d.result.png",
|
||||
build_dir,
|
||||
g_strdup_printf ("%s/%s_%d.result.png",
|
||||
ref_test_result_dir,
|
||||
test_name, test_seq_no);
|
||||
diff_image_path =
|
||||
g_strdup_printf ("%s/meson-logs/tests/ref-tests/%s_%d.diff.png",
|
||||
build_dir,
|
||||
g_strdup_printf ("%s/%s_%d.diff.png",
|
||||
ref_test_result_dir,
|
||||
test_name, test_seq_no);
|
||||
|
||||
g_mkdir_with_parents (g_path_get_dirname (ref_image_copy_path),
|
||||
0755);
|
||||
g_mkdir_with_parents (ref_test_result_dir, 0755);
|
||||
|
||||
g_assert_cmpint (cairo_surface_write_to_png (ref_image,
|
||||
ref_image_copy_path),
|
||||
|
|
Loading…
Reference in a new issue