]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test: Export G_TEST_BUILDDIR, G_TEST_SRCDIR
authorSimon McVittie <smcv@collabora.com>
Mon, 12 Sep 2022 12:24:28 +0000 (13:24 +0100)
committerSimon McVittie <smcv@collabora.com>
Wed, 5 Oct 2022 09:41:03 +0000 (10:41 +0100)
These environment variables are used by GLib's g_test_build_filename()
and related convenience functions, which make it easier for unit tests
to find data files in a way that works for both build-time tests and
"as-installed" tests. During "as-installed" testing, both variables
will normally be unset, and GLib uses the directory containing the
executable. In most cases that results in the right thing happening, and
this will also be true for dbus, since we install the test executables
in ${libexecdir}/installed-tests, helper executables in the same place,
and test data in ${libexecdir}/installed-tests/data.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 37e01259435a28b11a087867ea199cd09f0a5cff)
[backport to 1.14.x: discard Meson build system updates]

cmake/modules/Macros.cmake
test/Makefile.am

index 92fe9d816779c731e52d65cecd39ae7607bcd614..6acc82a743a474d544409593c33859a5cc686286 100644 (file)
@@ -65,6 +65,8 @@ macro(add_unit_test _name _target)
     list(APPEND _env "DBUS_TEST_EXEC=${DBUS_TEST_EXEC}")
     list(APPEND _env "DBUS_TEST_HOMEDIR=${DBUS_TEST_HOMEDIR}")
     list(APPEND _env "DBUS_TEST_UNINSTALLED=1")
+    list(APPEND _env "G_TEST_BUILDDIR=${Z_DRIVE_IF_WINE}${PROJECT_BINARY_DIR}/test")
+    list(APPEND _env "G_TEST_SRCDIR=${Z_DRIVE_IF_WINE}${PROJECT_SOURCE_DIR}/test")
     list(APPEND _env ${__ENV})
     set_tests_properties(${_name} PROPERTIES ENVIRONMENT "${_env}")
 endmacro()
index f9d6396530dad59d360da21ee8deb00b6604e477..d599a8c4477c00cba3267bb97ca39ed9f3a842f5 100644 (file)
@@ -403,6 +403,8 @@ AM_TESTS_ENVIRONMENT = \
        export DBUS_TEST_EXEC=@abs_top_builddir@/test; \
        export DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus; \
        export DBUS_TEST_UNINSTALLED=1; \
+       export G_TEST_BUILDDIR=@abs_builddir@; \
+       export G_TEST_SRCDIR=@abs_srcdir@; \
        export HOME=@abs_top_builddir@/dbus; \
        $(NULL)