[glib-networking/wip/tlssplit: 3/4] Split tests to take into account the backend



commit 932e4a7eb9b1a77961a8a1f9bca820734d8b68c2
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Tue Aug 18 10:42:49 2015 +0200

    Split tests to take into account the backend
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761092

 tls/tests/Makefile.am     |   30 +++++++++++++++++++++---------
 tls/tests/certificate.c   |    5 +++--
 tls/tests/connection.c    |    5 +++--
 tls/tests/file-database.c |    5 +++--
 4 files changed, 30 insertions(+), 15 deletions(-)
---
diff --git a/tls/tests/Makefile.am b/tls/tests/Makefile.am
index 55e5032..0ecd483 100644
--- a/tls/tests/Makefile.am
+++ b/tls/tests/Makefile.am
@@ -1,24 +1,36 @@
 include $(top_srcdir)/glib-networking.mk
 
 AM_CPPFLAGS +=                                 \
-       $(GNUTLS_CFLAGS)                        \
        -I$(top_srcdir)/tls                     \
        -I$(top_builddir)/tls                   \
        -DSRCDIR=\""$(abs_srcdir)"\"            \
        -DTOP_BUILDDIR=\""$(top_builddir)"\"
 
 LDADD  = \
-       $(GLIB_LIBS) \
-       $(GNUTLS_LIBS)
+       $(GLIB_LIBS)
 
-test_programs =       \
-       certificate   \
-       file-database \
-       connection    \
+test_programs =
+
+if HAVE_GNUTLS
+test_programs +=             \
+       certificate-gnutls   \
+       file-database-gnutls \
+       connection-gnutls    \
        $(NULL)
 
-connection_SOURCES = connection.c \
-       mock-interaction.c mock-interaction.h
+certificate_gnutls_SOURCES = certificate.c
+certificate_gnutls_CPPFLAGS = $(AM_CPPFLAGS) $(GNUTLS_CFLAGS) -DBACKEND=\""gnutls"\" -DWITH_BACKEND_GNUTLS
+certificate_gnutls_LDADD = $(GLIB_LIBS) $(GNUTLS_LIBS)
+
+connection_gnutls_SOURCES = connection.c mock-interaction.c mock-interaction.h
+connection_gnutls_CPPFLAGS = $(AM_CPPFLAGS) $(GNUTLS_CFLAGS) -DBACKEND=\""gnutls"\" -DWITH_BACKEND_GNUTLS
+connection_gnutls_LDADD = $(GLIB_LIBS) $(GNUTLS_LIBS)
+
+file_database_gnutls_SOURCES = file-database.c
+file_database_gnutls_CPPFLAGS = $(AM_CPPFLAGS) $(GNUTLS_CFLAGS) -DBACKEND=\""gnutls"\" -DWITH_BACKEND_GNUTLS
+file_database_gnutls_LDADD = $(GLIB_LIBS) $(GNUTLS_LIBS)
+
+endif
 
 if HAVE_PKCS11
 
diff --git a/tls/tests/certificate.c b/tls/tests/certificate.c
index ae4c621..991087e 100644
--- a/tls/tests/certificate.c
+++ b/tls/tests/certificate.c
@@ -545,8 +545,9 @@ main (int   argc,
   g_test_init (&argc, &argv, NULL);
 
   g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
-  g_setenv ("GIO_EXTRA_MODULES", TOP_BUILDDIR "/tls/gnutls/.libs", TRUE);
-  g_setenv ("GIO_USE_TLS", "gnutls", TRUE);
+  g_setenv ("GIO_EXTRA_MODULES", TOP_BUILDDIR "/tls/" BACKEND "/.libs", TRUE);
+  g_setenv ("GIO_USE_TLS", BACKEND, TRUE);
+  g_assert (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" BACKEND) == 
0);
 
   g_test_add ("/tls/certificate/create-pem", TestCertificate, NULL,
               setup_certificate, test_create_pem, teardown_certificate);
diff --git a/tls/tests/connection.c b/tls/tests/connection.c
index d2bf8cb..8f4095e 100644
--- a/tls/tests/connection.c
+++ b/tls/tests/connection.c
@@ -1993,8 +1993,9 @@ main (int   argc,
   g_test_bug_base ("http://bugzilla.gnome.org/";);
 
   g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
-  g_setenv ("GIO_EXTRA_MODULES", TOP_BUILDDIR "/tls/gnutls/.libs", TRUE);
-  g_setenv ("GIO_USE_TLS", "gnutls", TRUE);
+  g_setenv ("GIO_EXTRA_MODULES", TOP_BUILDDIR "/tls/" BACKEND "/.libs", TRUE);
+  g_setenv ("GIO_USE_TLS", BACKEND, TRUE);
+  g_assert (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" BACKEND) == 
0);
 
   g_test_add ("/tls/connection/basic", TestConnection, NULL,
               setup_connection, test_basic_connection, teardown_connection);
diff --git a/tls/tests/file-database.c b/tls/tests/file-database.c
index 40e292a..c27521e 100644
--- a/tls/tests/file-database.c
+++ b/tls/tests/file-database.c
@@ -542,8 +542,9 @@ main (int   argc,
   g_test_init (&argc, &argv, NULL);
 
   g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
-  g_setenv ("GIO_EXTRA_MODULES", TOP_BUILDDIR "/tls/gnutls/.libs", TRUE);
-  g_setenv ("GIO_USE_TLS", "gnutls", TRUE);
+  g_setenv ("GIO_EXTRA_MODULES", TOP_BUILDDIR "/tls/" BACKEND "/.libs", TRUE);
+  g_setenv ("GIO_USE_TLS", BACKEND, TRUE);
+  g_assert (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" BACKEND) == 
0);
 
   g_test_add_func ("/tls/backend/default-database-is-singleton",
                    test_default_database_is_singleton);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]