[libsoup] tests: fix when building without glib-networking available
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] tests: fix when building without glib-networking available
- Date: Tue, 3 Mar 2015 16:07:22 +0000 (UTC)
commit 3dfcc37bdbee7037149b61aa26f401d0fa54f1f5
Author: Dan Winship <danw gnome org>
Date: Tue Mar 3 10:53:12 2015 -0500
tests: fix when building without glib-networking available
At some point soup_test_session_new() got broken so that it would
always fail if TLS wasn't availble. Fix that. Also fix two tests in
server-test that would crash when TLS wasn't available.
tests/server-test.c | 4 +++-
tests/test-utils.c | 28 +++++++++++++++-------------
2 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/tests/server-test.c b/tests/server-test.c
index 9e46bb5..135d4b6 100644
--- a/tests/server-test.c
+++ b/tests/server-test.c
@@ -84,7 +84,7 @@ server_teardown (ServerData *sd, gconstpointer test_data)
soup_server_remove_handler (sd->server, iter->data);
g_slist_free_full (sd->handlers, g_free);
- soup_test_server_quit_unref (sd->server);
+ g_clear_pointer (&sd->server, soup_test_server_quit_unref);
g_clear_pointer (&sd->base_uri, soup_uri_free);
g_clear_pointer (&sd->ssl_base_uri, soup_uri_free);
}
@@ -1284,6 +1284,8 @@ do_steal_connect_test (ServerData *sd, gconstpointer test_data)
SoupMessage *msg;
const char *handled_by;
+ SOUP_TEST_SKIP_IF_NO_TLS;
+
proxy = soup_test_server_new (SOUP_TEST_SERVER_IN_THREAD);
proxy_uri = soup_test_server_get_uri (proxy, SOUP_URI_SCHEME_HTTP, "127.0.0.1");
soup_server_add_handler (proxy, NULL, proxy_server_callback, NULL, NULL);
diff --git a/tests/test-utils.c b/tests/test-utils.c
index ad0410c..3a717ad 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -238,20 +238,22 @@ soup_test_session_new (GType type, ...)
session = (SoupSession *)g_object_new_valist (type, propname, args);
va_end (args);
- cafile = g_test_build_filename (G_TEST_DIST, "test-cert.pem", NULL);
- tlsdb = g_tls_file_database_new (cafile, &error);
- g_free (cafile);
- if (error) {
- if (g_strcmp0 (g_getenv ("GIO_USE_TLS"), "dummy") == 0)
- g_clear_error (&error);
- else
- g_assert_no_error (error);
- }
+ if (tls_available) {
+ cafile = g_test_build_filename (G_TEST_DIST, "test-cert.pem", NULL);
+ tlsdb = g_tls_file_database_new (cafile, &error);
+ g_free (cafile);
+ if (error) {
+ if (g_strcmp0 (g_getenv ("GIO_USE_TLS"), "dummy") == 0)
+ g_clear_error (&error);
+ else
+ g_assert_no_error (error);
+ }
- g_object_set (G_OBJECT (session),
- SOUP_SESSION_TLS_DATABASE, tlsdb,
- NULL);
- g_clear_object (&tlsdb);
+ g_object_set (G_OBJECT (session),
+ SOUP_SESSION_TLS_DATABASE, tlsdb,
+ NULL);
+ g_clear_object (&tlsdb);
+ }
if (http_debug_level && !logger) {
SoupLoggerLogLevel level = MIN ((SoupLoggerLogLevel)http_debug_level, SOUP_LOGGER_LOG_BODY);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]