[glib-networking/wip/tlssplit: 7/8] 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: 7/8] Split tests to take into account the backend
- Date: Tue, 1 Sep 2015 14:40:58 +0000 (UTC)
commit 3f5d2c0fbdea0b169a077562063e9ff0a4ecdf9b
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 8d3d903..24217bf 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 766401c..5aa9270 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>
@@ -870,6 +872,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)
@@ -959,6 +962,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,
@@ -1304,6 +1308,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)
{
@@ -1316,16 +1321,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);
@@ -1421,11 +1429,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);
@@ -1747,8 +1757,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);
@@ -1768,10 +1779,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]