Commit 36fcd430 authored by Simon McVittie's avatar Simon McVittie

Pass in DBUS_TEST_EXEC via environment, not hard-coded into binaries

This avoids "capturing" the build directory in the built binaries
when built with embedded tests, which is good for reproducible builds.
See <https://reproducible-builds.org/> for more information.
Signed-off-by: 's avatarSimon McVittie <smcv@debian.org>
Reviewed-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100692
parent 53959c99
......@@ -31,7 +31,6 @@
#define TEST_LISTEN "@TEST_LISTEN@"
// test binaries
#define DBUS_TEST_EXEC "@DBUS_TEST_EXEC@"
#define DBUS_EXEEXT "@EXEEXT@"
/* Some dbus features */
......
......@@ -63,6 +63,7 @@ macro(add_test_executable _target _source)
list(APPEND _env "DBUS_FATAL_WARNINGS=1")
list(APPEND _env "DBUS_TEST_DATA=${PREFIX}${CMAKE_BINARY_DIR}/test/data")
list(APPEND _env "DBUS_TEST_DBUS_LAUNCH=${PREFIX}${CMAKE_BINARY_DIR}/bin/dbus-launch${EXEEXT}")
list(APPEND _env "DBUS_TEST_EXEC=${PREFIX}${DBUS_TEST_EXEC}")
list(APPEND _env "DBUS_TEST_HOMEDIR=${PREFIX}${CMAKE_BINARY_DIR}/dbus")
set_tests_properties(${_target} PROPERTIES ENVIRONMENT "${_env}")
endmacro(add_test_executable)
......
......@@ -1742,8 +1742,6 @@ DBUS_TEST_DATA="$DBUS_PWD/test/data"
AC_SUBST([DBUS_TEST_DATA])
AC_SUBST([DBUS_TEST_EXEC])
AC_DEFINE_UNQUOTED([DBUS_TEST_EXEC], ["$DBUS_TEST_EXEC"],
[Full path to the daemon in the builddir])
AC_DEFINE_UNQUOTED([DBUS_EXEEXT], ["$EXEEXT"],
[Extension for executables, typically empty or .exe])
......
......@@ -38,7 +38,7 @@ get_test_exec (const char *exe,
dbus_test_exec = _dbus_getenv ("DBUS_TEST_EXEC");
if (dbus_test_exec == NULL)
dbus_test_exec = DBUS_TEST_EXEC;
return NULL;
if (!_dbus_string_init (scratch_space))
return NULL;
......@@ -111,7 +111,7 @@ check_spawn_segfault (void *data)
if (argv[0] == NULL)
{
/* OOM was simulated, never mind */
/* OOM was simulated or DBUS_TEST_EXEC was unset; either is OK */
return TRUE;
}
......@@ -166,7 +166,7 @@ check_spawn_exit (void *data)
if (argv[0] == NULL)
{
/* OOM was simulated, never mind */
/* OOM was simulated or DBUS_TEST_EXEC was unset; either is OK */
return TRUE;
}
......@@ -217,7 +217,7 @@ check_spawn_and_kill (void *data)
if (argv[0] == NULL)
{
/* OOM was simulated, never mind */
/* OOM was simulated or DBUS_TEST_EXEC was unset; either is OK */
return TRUE;
}
......
......@@ -235,6 +235,7 @@ installcheck_environment = \
export DBUS_TEST_DBUS_LAUNCH=$(DESTDIR)$(bindir)/dbus-launch$(EXEEXT); \
export DBUS_TEST_DBUS_MONITOR=$(DESTDIR)$(bindir)/dbus-monitor$(EXEEXT); \
export DBUS_TEST_DBUS_SEND=$(DESTDIR)$(bindir)/dbus-send$(EXEEXT); \
export DBUS_TEST_EXEC=@abs_top_builddir@/test; \
export DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus; \
export DBUS_TEST_DATADIR=$(DESTDIR)$(datadir); \
${NULL}
......@@ -253,6 +254,7 @@ AM_TESTS_ENVIRONMENT = \
export DBUS_TEST_DBUS_MONITOR=@abs_top_builddir@/tools/dbus-monitor$(EXEEXT); \
export DBUS_TEST_DBUS_SEND=@abs_top_builddir@/tools/dbus-send$(EXEEXT); \
export DBUS_TEST_DATA=@abs_top_builddir@/test/data; \
export DBUS_TEST_EXEC=@abs_top_builddir@/test; \
export DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus; \
$(NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment