[glib-networking/wip/tlssplit: 5/6] Split tests to take into account the backend
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/wip/tlssplit: 5/6] Split tests to take into account the backend
- Date: Tue, 13 Oct 2015 09:54:10 +0000 (UTC)
commit 20042e513b30e50ee551628a87b9360b56e7984b
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue Aug 18 10:42:49 2015 +0200
Split tests to take into account the backend
tls/tests/Makefile.am | 36 ++++++++++++++++++++++++++----------
tls/tests/certificate.c | 5 +++--
tls/tests/connection.c | 17 +++++++++++++++--
tls/tests/file-database.c | 5 +++--
4 files changed, 47 insertions(+), 16 deletions(-)
---
diff --git a/tls/tests/Makefile.am b/tls/tests/Makefile.am
index 2dd071e..6b3ebd6 100644
--- a/tls/tests/Makefile.am
+++ b/tls/tests/Makefile.am
@@ -1,22 +1,41 @@
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)
+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
+connection_gnutls_CPPFLAGS = $(AM_CPPFLAGS) $(GNUTLS_CFLAGS) -DBACKEND=\""gnutls"\" -DWITH_BACKEND_GNUTLS
+connection_gnutls_LDADD = $(GLIB_LIBS) $(GNUTLS_LIBS)
+if HAVE_PKCS11
+connection_gnutls_SOURCES += mock-interaction.c mock-interaction.h
+connection_gnutls_LDADD += $(top_builddir)/tls/pkcs11/libgiopkcs11.la $(PKCS11_LIBS)
+endif
+
+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
test_programs += \
@@ -34,9 +53,6 @@ pkcs11_slot_SOURCES = pkcs11-slot.c \
mock-pkcs11.c mock-pkcs11.h \
mock-interaction.c mock-interaction.h
-connection_SOURCES = connection.c \
- mock-interaction.c mock-interaction.h
-
endif
testfiles_data = \
diff --git a/tls/tests/certificate.c b/tls/tests/certificate.c
index 5e3468b..9d1b77e 100644
--- a/tls/tests/certificate.c
+++ b/tls/tests/certificate.c
@@ -544,8 +544,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 60af5f6..ef472fe 100644
--- a/tls/tests/connection.c
+++ b/tls/tests/connection.c
@@ -24,7 +24,9 @@
#include "config.h"
+#ifdef WITH_BACKEND_GNUTLS
#include "mock-interaction.h"
+#endif
#include <gio/gio.h>
#include <gnutls/gnutls.h>
@@ -1005,6 +1007,7 @@ test_client_auth_failure (TestConnection *test,
g_assert (accepted_changed == TRUE);
}
+#ifdef WITH_BACKEND_GNUTLS
static void
test_client_auth_request_cert (TestConnection *test,
gconstpointer data)
@@ -1094,6 +1097,7 @@ test_client_auth_request_fail (TestConnection *test,
g_io_stream_close (test->server_connection, NULL, NULL);
g_io_stream_close (test->client_connection, NULL, NULL);
}
+#endif
static void
test_connection_no_database (TestConnection *test,
@@ -1439,6 +1443,7 @@ test_simultaneous_async (TestConnection *test,
g_assert_cmpstr (test->buf, ==, TEST_DATA);
}
+#ifdef WITH_BACKEND_GNUTLS
static gboolean
check_gnutls_has_rehandshaking_bug (void)
{
@@ -1451,16 +1456,19 @@ check_gnutls_has_rehandshaking_bug (void)
!strcmp (version, "3.3.9") ||
!strcmp (version, "3.3.10"));
}
+#endif
static void
test_simultaneous_async_rehandshake (TestConnection *test,
gconstpointer data)
{
+#ifdef WITH_BACKEND_GNUTLS
if (check_gnutls_has_rehandshaking_bug ())
{
g_test_skip ("test would fail due to gnutls bug 108690");
return;
}
+#endif
test->rehandshake = TRUE;
test_simultaneous_async (test, data);
@@ -1556,11 +1564,13 @@ static void
test_simultaneous_sync_rehandshake (TestConnection *test,
gconstpointer data)
{
+#ifdef WITH_BACKEND_GNUTLS
if (check_gnutls_has_rehandshaking_bug ())
{
g_test_skip ("test would fail due to gnutls bug 108690");
return;
}
+#endif
test->rehandshake = TRUE;
test_simultaneous_sync (test, data);
@@ -1882,8 +1892,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);
@@ -1907,10 +1918,12 @@ main (int argc,
setup_connection, test_client_auth_rehandshake, teardown_connection);
g_test_add ("/tls/connection/client-auth-failure", TestConnection, NULL,
setup_connection, test_client_auth_failure, teardown_connection);
+#ifdef WITH_BACKEND_GNUTLS
g_test_add ("/tls/connection/client-auth-request-cert", TestConnection, NULL,
setup_connection, test_client_auth_request_cert, teardown_connection);
g_test_add ("/tls/connection/client-auth-request-fail", TestConnection, NULL,
setup_connection, test_client_auth_request_fail, teardown_connection);
+#endif
g_test_add ("/tls/connection/no-database", TestConnection, NULL,
setup_connection, test_connection_no_database, teardown_connection);
g_test_add ("/tls/connection/failed", TestConnection, NULL,
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]