Modernize the remainder of the tests.
authorStef Walter <stefw@collabora.co.uk>
Sat, 23 Apr 2011 22:19:42 +0000 (00:19 +0200)
committerStef Walter <stefw@collabora.co.uk>
Sun, 24 Apr 2011 08:23:19 +0000 (10:23 +0200)
 * Bring up to date with gtester running and individual binaries.
 * Make the tests run in make distcheck

31 files changed:
egg/tests/Makefile.am
egg/tests/test-asn1.c
egg/tests/test-asn1x.c
egg/tests/test-dh.c
egg/tests/test-dn.c
egg/tests/test-hex.c
egg/tests/test-hkdf.c
egg/tests/test-oid.c
egg/tests/test-openssl.c
egg/tests/test-padding.c
egg/tests/test-secmem.c
egg/tests/test-symkey.c
gck/tests/Makefile.am
gck/tests/test-gck-crypto.c
gck/tests/test-gck-enumerator.c
gck/tests/test-gck-module.c
gck/tests/test-gck-modules.c
gck/tests/test-gck-object.c
gck/tests/test-gck-session.c
gck/tests/test-gck-slot.c
gck/tests/test-gck-uri.c
gcr/tests/Makefile.am
gcr/tests/frob-certificate.c
gcr/tests/frob-key.c
gcr/tests/test-certificate-chain.c
gcr/tests/test-certificate.c
gcr/tests/test-parser.c
gcr/tests/test-pkcs11-certificate.c
gcr/tests/test-simple-certificate.c
gcr/tests/test-trust.c
testing/Makefile.am

index 72f0d37..6de8baf 100644 (file)
@@ -3,8 +3,9 @@ asn1-def-test.c: test.asn
        $(ASN1PARSER) -o asn1-def-test.c $(srcdir)/test.asn
 
 INCLUDES = \
-       -I$(top_srcdir)/egg \
-       -DSRCDIR=$(srcdir) \
+       -I$(top_builddir) \
+       -I$(top_srcdir) \
+       -DSRCDIR="\"$(srcdir)\"" \
        $(GLIB_CFLAGS)
 
 LDADD =  \
@@ -34,7 +35,7 @@ test_asn1_SOURCES = \
 check_PROGRAMS = $(TEST_PROGS)
 
 test: $(TEST_PROGS)
-       SRCDIR='$(srcdir)' gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
+       gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
 
 check-local: test
 
@@ -44,6 +45,9 @@ EXTRA_DIST = \
        test.asn \
        files
 
+DISTCLEANFILES = \
+       asn1-def-test.c
+
 # ------------------------------------------------------------------------------
 
 noinst_PROGRAMS = \
index 39f188d..cf855da 100644 (file)
@@ -23,9 +23,9 @@
 
 #include "config.h"
 
-#include "egg-asn1x.h"
-#include "egg-asn1-defs.h"
-#include "egg-testing.h"
+#include "egg/egg-asn1x.h"
+#include "egg/egg-asn1-defs.h"
+#include "egg/egg-testing.h"
 
 #include <glib.h>
 #include <libtasn1.h>
@@ -726,8 +726,8 @@ typedef struct {
 static void
 setup (Test *test, gconstpointer unused)
 {
-       if (!g_file_get_contents ("files/test-certificate-1.der", (gchar**)&test->data,
-                                 &test->n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/files/test-certificate-1.der",
+                                 (gchar**)&test->data, &test->n_data, NULL))
                g_assert_not_reached ();
 
        test->asn1 = egg_asn1x_create (pkix_asn1_tab, "Certificate");
index 553ad6f..7556e5d 100644 (file)
    Author: Stef Walter <stef@memberwebs.com>
 */
 
-#include "egg-asn1x.h"
+#include "config.h"
+
+#include "egg/egg-asn1x.h"
+#include "egg/egg-asn1-defs.h"
+#include "egg/egg-testing.h"
 
 #include <pwd.h>
 #include <stdlib.h>
 #include <unistd.h>
 
-#include "egg-asn1-defs.h"
-#include "egg-testing.h"
-
 #if 0
 static void
 build_personal_name (void)
@@ -101,13 +102,13 @@ main (int argc, char **argv)
 
        egg_tests_chdir_base (argv[0]);
 
-       test_some_asn1_stuff (pkix_asn1_tab, "files/test-certificate-1.der", "Certificate");
-       test_some_asn1_stuff (pkix_asn1_tab, "files/test-pkcs8-1.der", "pkcs-8-PrivateKeyInfo");
-       test_some_asn1_stuff (pk_asn1_tab, "files/test-rsakey-1.der", "RSAPrivateKey");
-       test_some_asn1_stuff (pkix_asn1_tab, "files/test-personalname-1.der", "PersonalName");
-       test_some_asn1_stuff (pkix_asn1_tab, "files/test-pkcs7-1.der", "pkcs-7-ContentInfo");
-       test_some_asn1_stuff (pkix_asn1_tab, "files/test-pkcs7-2.der", "pkcs-7-ContentInfo");
-       test_some_asn1_stuff (pkix_asn1_tab, "files/test-pkcs12-1.der", "pkcs-12-PFX");
+       test_some_asn1_stuff (pkix_asn1_tab, SRCDIR "/files/test-certificate-1.der", "Certificate");
+       test_some_asn1_stuff (pkix_asn1_tab, SRCDIR "/files/test-pkcs8-1.der", "pkcs-8-PrivateKeyInfo");
+       test_some_asn1_stuff (pk_asn1_tab, SRCDIR "/files/test-rsakey-1.der", "RSAPrivateKey");
+       test_some_asn1_stuff (pkix_asn1_tab, SRCDIR "/files/test-personalname-1.der", "PersonalName");
+       test_some_asn1_stuff (pkix_asn1_tab, SRCDIR "/files/test-pkcs7-1.der", "pkcs-7-ContentInfo");
+       test_some_asn1_stuff (pkix_asn1_tab, SRCDIR "/files/test-pkcs7-2.der", "pkcs-7-ContentInfo");
+       test_some_asn1_stuff (pkix_asn1_tab, SRCDIR "/files/test-pkcs12-1.der", "pkcs-12-PFX");
 
        return 0;
 }
index 58098cc..ba9fcfc 100644 (file)
@@ -23,9 +23,9 @@
 
 #include "config.h"
 
-#include "egg-dh.h"
-#include "egg-secure-memory.h"
-#include "egg-testing.h"
+#include "egg/egg-dh.h"
+#include "egg/egg-secure-memory.h"
+#include "egg/egg-testing.h"
 
 #include <stdlib.h>
 #include <stdio.h>
index eae139f..98f5a43 100644 (file)
 
 #include "config.h"
 
-#include "egg-asn1-defs.h"
-#include "egg-asn1x.h"
-#include "egg-dn.h"
-#include "egg-oid.h"
+#include "egg/egg-asn1-defs.h"
+#include "egg/egg-asn1x.h"
+#include "egg/egg-dn.h"
+#include "egg/egg-oid.h"
 
 #include <glib.h>
 #include <gcrypt.h>
@@ -45,8 +45,8 @@ typedef struct {
 static void
 setup (Test *test, gconstpointer unused)
 {
-       if (!g_file_get_contents ("files/test-certificate-1.der", (gchar**)&test->data,
-                                 &test->n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/files/test-certificate-1.der",
+                                 (gchar**)&test->data, &test->n_data, NULL))
                g_assert_not_reached ();
 
        test->asn1 = egg_asn1x_create (pkix_asn1_tab, "Certificate");
index 713bf60..e2cb9f0 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "config.h"
 
-#include "egg-hex.h"
+#include "egg/egg-hex.h"
 
 #include <stdlib.h>
 #include <stdio.h>
index 44c463d..93f16df 100644 (file)
@@ -27,9 +27,9 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "egg-hkdf.h"
-#include "egg-secure-memory.h"
-#include "egg-testing.h"
+#include "egg/egg-hkdf.h"
+#include "egg/egg-secure-memory.h"
+#include "egg/egg-testing.h"
 
 #include <gcrypt.h>
 
index 189a200..37b0e2e 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "config.h"
 
-#include "egg-oid.h"
+#include "egg/egg-oid.h"
 
 #include <glib.h>
 
index 18f9fd9..e80c1b1 100644 (file)
 
 #include "config.h"
 
-#include "egg-symkey.h"
-#include "egg-openssl.h"
-#include "egg-secure-memory.h"
-#include "egg-testing.h"
+#include "egg/egg-symkey.h"
+#include "egg/egg-openssl.h"
+#include "egg/egg-secure-memory.h"
+#include "egg/egg-testing.h"
 
 #include <glib.h>
 
@@ -51,7 +51,7 @@ typedef struct {
 static void
 setup (Test *test, gconstpointer unused)
 {
-       if (!g_file_get_contents ("files/pem-rsa-enc.key", (gchar**)&test->input, &test->n_input, NULL))
+       if (!g_file_get_contents (SRCDIR "/files/pem-rsa-enc.key", (gchar**)&test->input, &test->n_input, NULL))
                g_assert_not_reached ();
 }
 
index 236d941..10a6c0e 100644 (file)
@@ -23,8 +23,8 @@
 
 #include "config.h"
 
-#include "egg-padding.h"
-#include "egg-testing.h"
+#include "egg/egg-padding.h"
+#include "egg/egg-testing.h"
 
 #include <gcrypt.h>
 
index ddd74a1..b5ee465 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "config.h"
 
-#include "egg-secure-memory.h"
+#include "egg/egg-secure-memory.h"
 
 #include <glib.h>
 
index c2c1b78..b65ee30 100644 (file)
@@ -23,9 +23,9 @@
 
 #include "config.h"
 
-#include "egg-libgcrypt.h"
-#include "egg-secure-memory.h"
-#include "egg-symkey.h"
+#include "egg/egg-libgcrypt.h"
+#include "egg/egg-secure-memory.h"
+#include "egg/egg-symkey.h"
 
 #include <gcrypt.h>
 
index b06a1e4..e43f2e6 100644 (file)
@@ -1,7 +1,9 @@
 
 INCLUDES = \
-       -I$(top_srcdir)/egg \
-       -DSRCDIR=$(srcdir) \
+       -I$(top_builddir) \
+       -I$(top_srcdir) \
+       -DSRCDIR="\"$(srcdir)\"" \
+       -DBUILDDIR="\"$(builddir)\"" \
        -DGCK_API_SUBJECT_TO_CHANGE \
        $(GLIB_CFLAGS)
 
@@ -28,7 +30,7 @@ TEST_PROGS = \
 check_PROGRAMS = $(TEST_PROGS)
 
 test: $(TEST_PROGS)
-       SRCDIR='$(srcdir)' gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
+       gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
 
 check-local: test
 
index d6dfc9e..208673f 100644 (file)
@@ -57,7 +57,7 @@ setup (Test *test, gconstpointer unused)
        GckSlot *slot;
 
        /* Successful load */
-       test->module = gck_module_initialize (".libs/libmock-test-module.so", NULL, 0, &err);
+       test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, 0, &err);
        g_assert_no_error (err);
        g_assert (GCK_IS_MODULE (test->module));
 
@@ -627,15 +627,9 @@ test_derive_key (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gck/crypto/encrypt", Test, NULL, setup, test_encrypt, teardown);
        g_test_add ("/gck/crypto/decrypt", Test, NULL, setup, test_decrypt, teardown);
        g_test_add ("/gck/crypto/login_context_specific", Test, NULL, setup, test_login_context_specific, teardown);
index a92128b..83458f0 100644 (file)
@@ -48,7 +48,7 @@ setup (Test *test, gconstpointer unused)
        GError *err = NULL;
 
        /* Successful load */
-       test->module = gck_module_initialize (".libs/libmock-test-module.so", NULL, 0, &err);
+       test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, 0, &err);
        g_assert_no_error (err);
        g_assert (GCK_IS_MODULE (test->module));
 
@@ -266,15 +266,9 @@ test_token_match (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gck/enumerator/create", Test, NULL, setup, test_create, teardown);
        g_test_add ("/gck/enumerator/create_slots", Test, NULL, setup, test_create_slots, teardown);
        g_test_add ("/gck/enumerator/next", Test, NULL, setup, test_next, teardown);
index 48050b2..4e6a337 100644 (file)
@@ -40,7 +40,7 @@ setup (Test *test, gconstpointer unused)
        GError *err = NULL;
 
        /* Successful load */
-       test->module = gck_module_initialize (".libs/libmock-test-module.so", NULL, 0, &err);
+       test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, 0, &err);
        g_assert_no_error (err);
        g_assert (test->module);
 }
@@ -101,7 +101,7 @@ test_module_props (Test *test, gconstpointer unused)
 
        g_object_get (test->module, "path", &path, NULL);
        g_assert (path != NULL && "no module-path");
-       g_assert (strcmp (".libs/libmock-test-module.so", path) == 0 && "module path wrong");
+       g_assert (strcmp (BUILDDIR "/.libs/libmock-test-module.so", path) == 0 && "module path wrong");
        g_free (path);
 }
 
@@ -127,15 +127,9 @@ test_module_info (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gck/module/invalid_modules", Test, NULL, setup, test_invalid_modules, teardown);
        g_test_add ("/gck/module/module_equals_hash", Test, NULL, setup, test_module_equals_hash, teardown);
        g_test_add ("/gck/module/module_props", Test, NULL, setup, test_module_props, teardown);
index 0fe287e..3b38d05 100644 (file)
@@ -48,7 +48,7 @@ setup (Test *test, gconstpointer unused)
        GError *err = NULL;
 
        /* Successful load */
-       module = gck_module_initialize (".libs/libmock-test-module.so", NULL, 0, &err);
+       module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, 0, &err);
        g_assert_no_error (err);
        g_assert (GCK_IS_MODULE (module));
 
@@ -193,15 +193,9 @@ test_enumerate_uri (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gck/modules/enumerate_objects", Test, NULL, setup, test_enumerate_objects, teardown);
        g_test_add ("/gck/modules/token_for_uri", Test, NULL, setup, test_token_for_uri, teardown);
        g_test_add ("/gck/modules/token_for_uri_not_found", Test, NULL, setup, test_token_for_uri_not_found, teardown);
index e41e4db..672a102 100644 (file)
@@ -50,7 +50,7 @@ setup (Test *test, gconstpointer unused)
        GList *slots;
 
        /* Successful load */
-       test->module = gck_module_initialize (".libs/libmock-test-module.so", NULL, 0, &err);
+       test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, 0, &err);
        g_assert_no_error (err);
        g_assert (GCK_IS_MODULE (test->module));
 
@@ -403,15 +403,9 @@ test_find_objects (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gck/object/object_props", Test, NULL, setup, test_object_props, teardown);
        g_test_add ("/gck/object/object_equals_hash", Test, NULL, setup, test_object_equals_hash, teardown);
        g_test_add ("/gck/object/create_object", Test, NULL, setup, test_create_object, teardown);
index 5cc1564..356819b 100644 (file)
@@ -48,7 +48,7 @@ setup (Test *test, gconstpointer unused)
        GList *slots;
 
        /* Successful load */
-       test->module = gck_module_initialize (".libs/libmock-test-module.so", NULL, 0, &err);
+       test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, 0, &err);
        g_assert_no_error (err);
        g_assert (GCK_IS_MODULE (test->module));
 
@@ -303,15 +303,9 @@ test_auto_login (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gck/session/session_props", Test, NULL, setup, test_session_props, teardown);
        g_test_add ("/gck/session/session_info", Test, NULL, setup, test_session_info, teardown);
        g_test_add ("/gck/session/open_close_session", Test, NULL, setup, test_open_close_session, teardown);
index e36dc6d..8a61479 100644 (file)
@@ -43,7 +43,7 @@ setup (Test *test, gconstpointer unused)
        GList *slots;
 
        /* Successful load */
-       test->module = gck_module_initialize (".libs/libmock-test-module.so", NULL, 0, &err);
+       test->module = gck_module_initialize (BUILDDIR "/.libs/libmock-test-module.so", NULL, 0, &err);
        g_assert_no_error (err);
        g_assert (GCK_IS_MODULE (test->module));
 
@@ -242,15 +242,9 @@ test_token_info_match_different (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gck/slot/slot_info", Test, NULL, setup, test_slot_info, teardown);
        g_test_add ("/gck/slot/slot_props", Test, NULL, setup, test_slot_props, teardown);
        g_test_add ("/gck/slot/slot_equals_hash", Test, NULL, setup, test_slot_equals_hash, teardown);
index 865aa0f..8483ed9 100644 (file)
@@ -519,15 +519,9 @@ null_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        /* Suppress these messages in tests */
        g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG,
                           null_log_handler, NULL);
index 544a406..9d16168 100644 (file)
@@ -1,8 +1,8 @@
 
 INCLUDES = \
-       -I$(top_srcdir)/egg \
-       -I$(top_srcdir)/gcr \
-       -DSRCDIR=$(srcdir) \
+       -I$(top_builddir) \
+       -I$(top_srcdir) \
+       -DSRCDIR="\"$(srcdir)\"" \
        -DGCR_API_SUBJECT_TO_CHANGE \
        -DGCK_API_SUBJECT_TO_CHANGE \
        $(GLIB_CFLAGS) \
@@ -29,7 +29,7 @@ TEST_PROGS = \
 check_PROGRAMS = $(TEST_PROGS)
 
 test: $(TEST_PROGS)
-       SRCDIR='$(srcdir)' gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
+       gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
 
 check-local: test
 
index d14215c..667a42f 100644 (file)
@@ -105,7 +105,7 @@ main(int argc, char *argv[])
                test_certificate (argv[1]);
        } else {
                chdir_base_dir (argv[0]);
-               test_certificate ("files/der-certificate.crt");
+               test_certificate (SRCDIR "/files/der-certificate.crt");
        }
 
        return 0;
index cd71b01..3292e2f 100644 (file)
@@ -103,7 +103,7 @@ main(int argc, char *argv[])
                test_key (argv[1]);
        } else {
                chdir_base_dir (argv[0]);
-               test_key ("files/pem-dsa-1024.key");
+               test_key (SRCDIR "/files/pem-dsa-1024.key");
        }
 
        return 0;
index ade0eac..b0bedfb 100644 (file)
@@ -155,19 +155,19 @@ setup (Test *test, gconstpointer unused)
        gck_list_unref_free (modules);
 
        /* A self-signed certificate */
-       if (!g_file_get_contents ("files/der-certificate.crt", &contents, &n_contents, NULL))
+       if (!g_file_get_contents (SRCDIR "/files/der-certificate.crt", &contents, &n_contents, NULL))
                g_assert_not_reached ();
        test->cert_self = gcr_simple_certificate_new (contents, n_contents);
        g_free (contents);
 
        /* A signed certificate */
-       if (!g_file_get_contents ("files/dhansak-collabora.cer", &contents, &n_contents, NULL))
+       if (!g_file_get_contents (SRCDIR "/files/dhansak-collabora.cer", &contents, &n_contents, NULL))
                g_assert_not_reached ();
        test->cert_signed = mock_certificate_new (contents, n_contents);
        g_free (contents);
 
        /* The signer for the above certificate */
-       if (!g_file_get_contents ("files/collabora-ca.cer", &contents, &n_contents, NULL))
+       if (!g_file_get_contents (SRCDIR "/files/collabora-ca.cer", &contents, &n_contents, NULL))
                g_assert_not_reached ();
        test->cert_ca = mock_certificate_new (contents, n_contents);
        g_free (contents);
@@ -632,16 +632,10 @@ test_with_anchor_error_async (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
        g_set_prgname ("test-certificate-chain");
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gcr/certificate-chain/new", Test, NULL, setup, test_new, teardown);
        g_test_add ("/gcr/certificate-chain/new_with_cert", Test, NULL, setup, test_new_with_cert, teardown);
        g_test_add ("/gcr/certificate-chain/selfsigned", Test, NULL, setup, test_selfsigned, teardown);
index 137fe2a..aed032d 100644 (file)
@@ -44,19 +44,19 @@ setup (Test *test, gconstpointer unused)
        gchar *contents;
        gsize n_contents;
 
-       if (!g_file_get_contents ("files/der-certificate.crt", &contents, &n_contents, NULL))
+       if (!g_file_get_contents (SRCDIR "/files/der-certificate.crt", &contents, &n_contents, NULL))
                g_assert_not_reached ();
        test->certificate = gcr_simple_certificate_new (contents, n_contents);
        g_assert (test->certificate);
        g_free (contents);
 
-       if (!g_file_get_contents ("files/der-certificate-dsa.cer", &contents, &n_contents, NULL))
+       if (!g_file_get_contents (SRCDIR "/files/der-certificate-dsa.cer", &contents, &n_contents, NULL))
                g_assert_not_reached ();
        test->dsa_cert = gcr_simple_certificate_new (contents, n_contents);
        g_assert (test->dsa_cert);
        g_free (contents);
 
-       if (!g_file_get_contents ("files/dhansak-collabora.cer", &contents, &n_contents, NULL))
+       if (!g_file_get_contents (SRCDIR "/files/dhansak-collabora.cer", &contents, &n_contents, NULL))
                g_assert_not_reached ();
        test->dhansak_cert = gcr_simple_certificate_new (contents, n_contents);
        g_assert (test->certificate);
@@ -255,16 +255,10 @@ test_certificate_is_issuer (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
        g_set_prgname ("test-certificate");
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gcr/certificate/issuer_cn", Test, NULL, setup, test_issuer_cn, teardown);
        g_test_add ("/gcr/certificate/issuer_dn", Test, NULL, setup, test_issuer_dn, teardown);
        g_test_add ("/gcr/certificate/issuer_part", Test, NULL, setup, test_issuer_part, teardown);
index e8c5e30..39fbefc 100644 (file)
@@ -121,7 +121,7 @@ test_parse_all (Test *test, gconstpointer unused)
        gsize len;
        GDir *dir;
 
-       dir = g_dir_open ("files", 0, NULL);
+       dir = g_dir_open (SRCDIR "/files", 0, NULL);
        g_assert (dir);
 
        for (;;) {
@@ -132,7 +132,7 @@ test_parse_all (Test *test, gconstpointer unused)
                        continue;
 
                g_free (test->filedesc);
-               test->filedesc = g_build_filename ("files", filename, NULL);
+               test->filedesc = g_build_filename (SRCDIR "/files", filename, NULL);
 
                if (g_file_test (test->filedesc, G_FILE_TEST_IS_DIR))
                        continue;
@@ -157,16 +157,10 @@ test_parse_all (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
        g_set_prgname ("test-parser");
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gcr/parser/parse_all", Test, NULL, setup, test_parse_all, teardown);
 
        return g_test_run ();
index c5d4c90..feed864 100644 (file)
@@ -25,7 +25,7 @@
 #include "egg/egg-asn1x.h"
 #include "egg/egg-asn1-defs.h"
 
-#include "gcr.h"
+#include "gcr/gcr.h"
 #include "gcr/gcr-internal.h"
 
 #include "egg/egg-testing.h"
@@ -59,12 +59,12 @@ setup (Test *test, gconstpointer unused)
        GNode *asn, *node;
        CK_RV rv;
 
-       if (!g_file_get_contents ("files/der-certificate.crt", (gchar**)&test->cert_data,
+       if (!g_file_get_contents (SRCDIR "/files/der-certificate.crt", (gchar**)&test->cert_data,
                                  &test->n_cert_data, NULL))
                g_assert_not_reached ();
        g_assert (test->cert_data);
 
-       if (!g_file_get_contents ("files/der-certificate-dsa.cer", (gchar**)&test->cert2_data,
+       if (!g_file_get_contents (SRCDIR "/files/der-certificate-dsa.cer", (gchar**)&test->cert2_data,
                                  &test->n_cert2_data, NULL))
                g_assert_not_reached ();
        g_assert (test->cert2_data);
@@ -265,16 +265,10 @@ test_lookup_certificate_issuer_fail_async (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
        g_set_prgname ("test-pkcs11-certificate");
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gcr/pkcs11-certificate/lookup_certificate_issuer", Test, NULL, setup, test_lookup_certificate_issuer, teardown);
        g_test_add ("/gcr/pkcs11-certificate/lookup_certificate_issuer_not_found", Test, NULL, setup, test_lookup_certificate_issuer_not_found, teardown);
        g_test_add ("/gcr/pkcs11-certificate/lookup_certificate_issuer_async", Test, NULL, setup, test_lookup_certificate_issuer_async, teardown);
index 707d294..f3039cb 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "config.h"
 
-#include "gcr.h"
+#include "gcr/gcr.h"
 #include "gcr/gcr-internal.h"
 
 #include "gck/gck-test.h"
@@ -43,7 +43,7 @@ typedef struct {
 static void
 setup (Test *test, gconstpointer unused)
 {
-       if (!g_file_get_contents ("files/der-certificate.crt", (gchar**)&test->cert_data,
+       if (!g_file_get_contents (SRCDIR "/files/der-certificate.crt", (gchar**)&test->cert_data,
                                  &test->n_cert_data, NULL))
                g_assert_not_reached ();
        g_assert (test->cert_data);
@@ -93,16 +93,10 @@ test_new_static (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
        g_set_prgname ("test-simple-certificate");
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gcr/simple-certificate/new", Test, NULL, setup, test_new, teardown);
        g_test_add ("/gcr/simple-certificate/new_static", Test, NULL, setup, test_new_static, teardown);
 
index a7a33eb..1ddf8a8 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "config.h"
 
-#include "gcr.h"
+#include "gcr/gcr.h"
 #include "gcr/gcr-internal.h"
 
 #include "gck/gck-mock.h"
@@ -54,7 +54,7 @@ setup (Test *test, gconstpointer unused)
        gsize len;
        CK_RV rv;
 
-       if (!g_file_get_contents ("files/der-certificate.crt", &contents, &len, NULL))
+       if (!g_file_get_contents (SRCDIR "/files/der-certificate.crt", &contents, &len, NULL))
                g_assert_not_reached ();
        g_assert (contents);
 
@@ -309,16 +309,10 @@ test_is_certificate_anchored_async (Test *test, gconstpointer unused)
 int
 main (int argc, char **argv)
 {
-       const gchar *srcdir;
-
        g_type_init ();
        g_test_init (&argc, &argv, NULL);
        g_set_prgname ("test-trust");
 
-       srcdir = g_getenv ("SRCDIR");
-       if (srcdir && chdir (srcdir) < 0)
-               g_error ("couldn't change directory to: %s: %s", srcdir, g_strerror (errno));
-
        g_test_add ("/gcr/trust/is_pinned_none", Test, NULL, setup, test_is_pinned_none, teardown);
        g_test_add ("/gcr/trust/add_and_is_pinned", Test, NULL, setup, test_add_and_is_pinned, teardown);
        g_test_add ("/gcr/trust/add_certificate_pinned_fail", Test, NULL, setup, test_add_certificate_pinned_fail, teardown);
index 6304d6f..926eaaf 100644 (file)
@@ -1,22 +1,6 @@
 
 EXTRA_DIST = \
-       ca-example \
-       testing.c testing.h \
-       testing-build.sh \
-       testing.make
-
-INCLUDES = \
-       -I$(top_srcdir) \
-       -I$(top_builddir) \
-       $(GTK_CFLAGS) \
-       $(GLIB_CFLAGS)
-
-LIBS = \
-       $(GTK_LIBS) \
-       $(GLIB_LIBS) \
-       $(GTHREAD_LIBS)
-
-noinst_PROGRAMS =
+       ca-example
 
 CLEANFILES = \
        coverage \