summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChengwei Yang <chengwei.yang@intel.com>2013-10-08 21:59:37 +0800
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-10-08 16:08:57 +0100
commit47df159cc5b82d29588749b4dafedde33a8a3470 (patch)
treec89c33de840a9751386f7349549a80394753e8ca /tools
parent5b74af796c8f1d9f3f60594f22c6bfd4c097ad8b (diff)
downloaddbus-47df159cc5b82d29588749b4dafedde33a8a3470.tar.gz
Unify the way to find dbus-daemon test binary
There are two ways to find the dbus-daemon for testing. The first one is defined as string at compile stage and the second one is export it from test environment. The first way has limitation that after defined, it's static string, so it's impossible to run installable check. So let's unify to the second way. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37849 [added missing "}" -smcv] Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/dbus-launch.c62
1 files changed, 33 insertions, 29 deletions
diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c
index 050bd2fa..7ecee63e 100644
--- a/tools/dbus-launch.c
+++ b/tools/dbus-launch.c
@@ -1129,35 +1129,39 @@ main (int argc, char **argv)
verbose ("Calling exec()\n");
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
- /* exec from testdir */
- if (getenv ("DBUS_USE_TEST_BINARY") != NULL)
- {
- if (config_file == NULL && getenv ("DBUS_TEST_DATA") != NULL)
- {
- config_file = concat2 (getenv ("DBUS_TEST_DATA"),
- "/valid-config-files/session.conf");
-
- if (config_file == NULL)
- {
- fprintf (stderr, "Out of memory\n");
- exit (1);
- }
- }
-
- execl (TEST_BUS_BINARY,
- TEST_BUS_BINARY,
- "--fork",
- "--print-pid", write_pid_fd_as_string,
- "--print-address", write_address_fd_as_string,
- config_file ? "--config-file" : "--session",
- config_file, /* has to be last in this varargs list */
- NULL);
-
- fprintf (stderr,
- "Failed to execute test message bus daemon %s: %s.\n",
- TEST_BUS_BINARY, strerror (errno));
- exit (1);
- }
+ {
+ const char *test_daemon;
+ /* exec from testdir */
+ if (getenv ("DBUS_USE_TEST_BINARY") != NULL &&
+ (test_daemon = getenv ("DBUS_TEST_DAEMON")) != NULL)
+ {
+ if (config_file == NULL && getenv ("DBUS_TEST_DATA") != NULL)
+ {
+ config_file = concat2 (getenv ("DBUS_TEST_DATA"),
+ "/valid-config-files/session.conf");
+
+ if (config_file == NULL)
+ {
+ fprintf (stderr, "Out of memory\n");
+ exit (1);
+ }
+ }
+
+ execl (test_daemon,
+ test_daemon,
+ "--fork",
+ "--print-pid", write_pid_fd_as_string,
+ "--print-address", write_address_fd_as_string,
+ config_file ? "--config-file" : "--session",
+ config_file, /* has to be last in this varargs list */
+ NULL);
+
+ fprintf (stderr,
+ "Failed to execute test message bus daemon %s: %s.\n",
+ test_daemon, strerror (errno));
+ exit (1);
+ }
+ }
#endif /* DBUS_ENABLE_EMBEDDED_TESTS */
execl (DBUS_DAEMONDIR"/dbus-daemon",