]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Unify the way to find dbus-daemon test binary
authorChengwei Yang <chengwei.yang@intel.com>
Tue, 8 Oct 2013 13:59:37 +0000 (21:59 +0800)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 8 Oct 2013 15:08:57 +0000 (16:08 +0100)
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>
cmake/config.h.cmake
configure.ac
test/name-test/Makefile.am
tools/dbus-launch.c

index d6ea64f20349bc2f509163c6670f3f6e57b477a1..3735560955db966d0f0b349676559140e85a490b 100644 (file)
@@ -33,9 +33,6 @@
 #define DBUS_TEST_EXEC "@DBUS_TEST_EXEC@"
 #define DBUS_EXEEXT "@EXEEXT@"
 
-/* Full path to test file test/test-exit in builddir */
-#define TEST_BUS_BINARY          "@TEST_BUS_BINARY@"
-
 /* Some dbus features */
 #cmakedefine DBUS_ENABLE_ANSI 1
 #cmakedefine DBUS_ENABLE_VERBOSE_MODE 1
index 174308fb712748189880f0b307acc5e2bf9d04a8..923315e541d839f2c3711c18d13b8b7cb160fba0 100644 (file)
@@ -1617,10 +1617,6 @@ AC_DEFINE_UNQUOTED([DBUS_TEST_EXEC], ["$DBUS_TEST_EXEC"],
 AC_DEFINE_UNQUOTED([DBUS_EXEEXT], ["$EXEEXT"],
                    [Extension for executables, typically empty or .exe])
 
-AC_DEFINE_UNQUOTED(TEST_BUS_BINARY, ["$DBUS_PWD/bus/dbus-daemon$EXEEXT"],
-                   [Full path to the daemon in the builddir])
-AC_SUBST(TEST_BUS_BINARY)
-
 AC_DEFINE_UNQUOTED(TEST_BUS_LAUNCH_BINARY, ["$DBUS_PWD/tools/dbus-launch$EXEEXT"],
                    [Full path to the dbus-launch in the builddir])
 
index 931cb2c97778c6752e637e5048aa4e65455157eb..da41e58b50a2d6d794d707dcdcdefa2b7f38d955 100644 (file)
@@ -18,6 +18,7 @@ TESTS_ENVIRONMENT = \
         DBUS_TOP_SRCDIR=@abs_top_srcdir@ \
         PYTHON=@PYTHON@ \
         DBUS_TEST_DATA=@abs_top_builddir@/test/data \
+        DBUS_TEST_DAEMON=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT) \
         $(NULL)
 TESTS=run-test.sh run-test-systemserver.sh
 else
index 050bd2faeabcd4af8c4e840d6460f867a002081d..7ecee63e4d925189b093fc053970dffd1b01cce0 100644 (file)
@@ -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",