]> git.0d.be Git - empathy.git/commitdiff
tests: Lookup the pkcs11 standalone directory at run time.
authorStef Walter <stefw@collabora.co.uk>
Sat, 11 Dec 2010 03:31:01 +0000 (03:31 +0000)
committerStef Walter <stefw@collabora.co.uk>
Fri, 24 Dec 2010 13:40:02 +0000 (07:40 -0600)
Rather than cluttering up configure, lookup the relevant
directory at runtime.

configure.ac
tests/Makefile.am
tests/empathy-tls-test.c

index ab8c6f3cb87913b452a4c5c6f194a751d9f5ddac..28040909bceeb61897ae5972ae05f8bd4a19bf0c 100644 (file)
@@ -168,12 +168,6 @@ PKG_CHECK_MODULES(EMPATHY,
    gcr-3 >= $GCR_REQUIRED
 ])
 
-# Pkg Config lookup for modules used in tests
-AC_MSG_CHECKING([for pkcs11 standalone modules])
-pkcs11standalonedir=$(pkg-config --variable=pkcs11standalonedir gcr-3)
-AC_MSG_RESULT([$pkcs11standalonedir])
-AC_SUBST(pkcs11standalonedir)
-
 # -----------------------------------------------------------
 # evolution-data-server (about-me)
 # -----------------------------------------------------------
index 23de8d2780000ca1d6f3e84b5720c91b03e48d65..a9fc0cb1ea2e9cb318c4c1ecf18ba932c23fd911 100644 (file)
@@ -12,7 +12,6 @@ AM_CPPFLAGS =                                         \
        $(ERROR_CFLAGS)                                 \
        -I$(top_srcdir)                                 \
        -DPKGDATADIR=\""$(pkgdatadir)"\"                \
-       -DP11STANDALONEDIR=\""$(pkcs11standalonedir)"\" \
        -DGCR_API_SUBJECT_TO_CHANGE                     \
        $(EMPATHY_CFLAGS)                               \
        $(WARN_CFLAGS)                                  \
index 48833b36d1fd22ddc3734e34b819ac6caca2339a..f508b368c423a4c6cf4e16cc0c5af1ac14c93d3e 100644 (file)
@@ -327,16 +327,35 @@ add_pkcs11_module_for_testing (Test *test, const gchar *filename,
 {
   GError *error = NULL;
   gchar *args, *path, *directory;
+  gchar *standalone, *error_output;
+  gint exit_status;
 
   directory = g_build_filename (g_getenv ("EMPATHY_SRCDIR"),
           "tests", "certificates", subdir, NULL);
 
+  /*
+   * Lookup the directory for standalone pkcs11 modules installed by
+   * gnome-keyring. We use these for testing our implementation.
+   */
+  g_spawn_command_line_sync ("pkg-config --variable=pkcs11standalonedir gcr-3",
+          &standalone, &error_output, &exit_status, &error);
+  g_assert_no_error (error);
+  if (exit_status != 0)
+    {
+      g_warning ("couldn't determine standalone pkcs11 module directory: %d: %s",
+              exit_status, error_output);
+      g_assert_not_reached ();
+    }
+
+  g_strstrip (standalone);
   args = g_strdup_printf ("directory=\"%s\"", directory);
-  path = g_build_filename (P11STANDALONEDIR, filename, NULL);
+  path = g_build_filename (standalone, filename, NULL);
   gcr_pkcs11_add_module_from_file (path, args, &error);
   g_assert_no_error (error);
 
   g_free (directory);
+  g_free (standalone);
+  g_free (error_output);
   g_free (args);
   g_free (path);
 }