Bug 41455

Summary: Installing unit tests
Product: Telepathy Reporter: Alban Crequy <alban.crequy>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: enhancement    
Priority: medium CC: will
Version: git masterKeywords: patch
Hardware: Other   
OS: All   
URL: http://cgit.collabora.com/git/user/alban/telepathy-glib.git/log/?h=tests4
Whiteboard: review+
i915 platform: i915 features:

Description Alban Crequy 2011-10-04 08:54:00 UTC
Unit tests can be run with "make check" in the source tree but they cannot be
installed. Adding a configure option to install them could be useful for fully
automated tests.

(Same bug as Bug #41448 but for tp-glib)
Comment 1 Marco Barisione 2011-10-31 10:07:44 UTC
Why not renaming the d-bus service files dir to dbus-installed (like you did in gabble)?

Some tests depend on the examples, not on the source code. I think those tests should be installed too.
Comment 2 Alban Crequy 2011-11-01 05:53:11 UTC
(In reply to comment #1)
> Why not renaming the d-bus service files dir to dbus-installed (like you did in
> gabble)?

done

> Some tests depend on the examples, not on the source code. I think those tests
> should be installed too.

done.
Comment 3 Marco Barisione 2011-11-01 08:35:57 UTC
Looks fine to me.
Comment 4 Marco Barisione 2011-11-01 08:47:40 UTC
Actually:


+  gchar *command_installed[] = {
+      g_strdup_printf ("%s/%s",
+          libexec,

libexec is potentially NULL. I think printf-style functions on some platforms are not NULL-safe.

-  if (!g_spawn_async (NULL, command, NULL, 0, NULL, NULL, NULL, &error))
+  if (abs_top_builddir != NULL)
+    {
+      if (!g_spawn_async (NULL, command_uninstalled, NULL, 0, NULL, NULL, NULL,
+          &error))
+        {
+          g_error ("g_spawn_async: %s", error->message);
+        }
+    }
+  else
     {
-      g_error ("g_spawn_async: %s", error->message);
+      if (!g_spawn_async (NULL, command_installed, NULL, 0, NULL, NULL, NULL,
+          &error))
+        {
+          g_error ("g_spawn_async: %s", error->message);
+        }
     }

This code duplication is a bit ugly. You could rework it to make it more readable, for instance by having command[0] assigned based on abs_top_builddir.
Comment 5 Alban Crequy 2011-11-01 09:04:36 UTC
(In reply to comment #4)
> Actually:
> 
> 
> +  gchar *command_installed[] = {
> +      g_strdup_printf ("%s/%s",
> +          libexec,
> 
> libexec is potentially NULL. I think printf-style functions on some platforms
> are not NULL-safe.
(...)
> 
> This code duplication is a bit ugly. You could rework it to make it more
> readable, for instance by having command[0] assigned based on abs_top_builddir.


fixed.
Comment 6 Marco Barisione 2011-11-04 08:24:21 UTC
Looks good. If make check keeps working in every case, please merge with master.
Comment 7 Alban Crequy 2011-11-04 09:46:03 UTC
and merged to git master: 45b8e51..d2e6b77

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.