summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-09-12 13:24:28 +0100
committerSimon McVittie <smcv@collabora.com>2022-10-05 10:46:48 +0100
commit9f675abd3fea8222011b1134714c3cf71f7b1f2b (patch)
tree53c9c160e2bfba809abbfe0e0d7e21fcd3612bdf
parentb9f914fa277d7e1152f5f7cc068b3eded69b78fc (diff)
downloaddbus-9f675abd3fea8222011b1134714c3cf71f7b1f2b.tar.gz
dbus-9f675abd3fea8222011b1134714c3cf71f7b1f2b.tar.bz2
dbus-9f675abd3fea8222011b1134714c3cf71f7b1f2b.zip
test: Export G_TEST_BUILDDIR, G_TEST_SRCDIR
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] (cherry picked from commit bbf5ef008a629af62f817771adee6ae4adcf3bcd) [backport to 1.12.x: resolve conflicts in CMake build system]
-rw-r--r--cmake/modules/Macros.cmake2
-rw-r--r--test/Makefile.am2
2 files changed, 4 insertions, 0 deletions
diff --git a/cmake/modules/Macros.cmake b/cmake/modules/Macros.cmake
index 63b2171b..16aa7a63 100644
--- a/cmake/modules/Macros.cmake
+++ b/cmake/modules/Macros.cmake
@@ -54,6 +54,8 @@ macro(add_test_executable _target _source)
list(APPEND _env "DBUS_TEST_EXEC=${PREFIX}${DBUS_TEST_EXEC}")
list(APPEND _env "DBUS_TEST_HOMEDIR=${PREFIX}${CMAKE_BINARY_DIR}/dbus")
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")
set_tests_properties(${_target} PROPERTIES ENVIRONMENT "${_env}")
endmacro(add_test_executable)
diff --git a/test/Makefile.am b/test/Makefile.am
index 1b6835fe..168ffaea 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -273,6 +273,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)