From 7b3f35e013ece7f0271f9a485be0efd2fad1fc36 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 14 Sep 2010 14:54:51 -0400 Subject: [PATCH] Do domain only check for GIO errors With GLib 2.26, an error code was defined for connection refused. This has the effect of breaking Wocky connector test since it was expecting error code 0, which is generic G_IO_ERROR_FAILED. The solution in this patch is to allow any code for GIO error domain by introducing the notion of code -1. --- tests/wocky-connector-test.c | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/wocky-connector-test.c b/tests/wocky-connector-test.c index 23da37b..81da6a9 100644 --- a/tests/wocky-connector-test.c +++ b/tests/wocky-connector-test.c @@ -196,7 +196,7 @@ test_t tests[] = /* No SRV or connect host specified, bad port specified: FAIL */ { "/connector/basic/noserv/nohost/duffport", NOISY, - { DOMAIN_GIO, 0 }, + { DOMAIN_GIO, -1 }, { { TLS, NULL }, { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK }, { "moose", "something" }, @@ -235,7 +235,7 @@ test_t tests[] = /* No SRV record, connect host and bad port specified: FAIL */ { "/connector/basic/noserv/host/duffport", NOISY, - { DOMAIN_GIO, 0 }, + { DOMAIN_GIO, -1 }, { { TLS, NULL }, { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK }, { "moose", "something" }, @@ -300,7 +300,7 @@ test_t tests[] = /* SRV record specified, bad port: ignore SRV and FAIL */ { "/connector/basic/serv/nohost/duffport", NOISY, - { DOMAIN_GIO, 0 }, + { DOMAIN_GIO, -1 }, { { TLS, NULL }, { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK }, { "moose", "something" }, @@ -339,7 +339,7 @@ test_t tests[] = /* SRV record, connect host, bad port: ignore SRV, FAIL */ { "/connector/basic/serv/host/duffport", NOISY, - { DOMAIN_GIO, 0 }, + { DOMAIN_GIO, -1 }, { { TLS, NULL }, { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK }, { "moose", "something" }, @@ -404,7 +404,7 @@ test_t tests[] = */ { "/connector/basic/duffserv/nohost/noport", NOISY, - { DOMAIN_GIO, 0 }, + { DOMAIN_GIO, -1 }, { { TLS, NULL }, { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK }, { "moose", "something" }, @@ -430,7 +430,7 @@ test_t tests[] = /* Bad SRV record, bad port specified, ignore SRV and FAIL */ { "/connector/basic/duffserv/nohost/duffport", NOISY, - { DOMAIN_GIO, 0 }, + { DOMAIN_GIO, -1 }, { { TLS, NULL }, { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK }, { "moose", "something" }, @@ -469,7 +469,7 @@ test_t tests[] = /* Bad SRV record, connect host and bad port, ignore SRV and FAIL */ { "/connector/basic/duffserv/host/duffport", NOISY, - { DOMAIN_GIO, 0 }, + { DOMAIN_GIO, -1 }, { { TLS, NULL }, { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK }, { "moose", "something" }, @@ -482,7 +482,7 @@ test_t tests[] = /* Bad SRV record, bad host and bad port: Just FAIL */ { "/connector/basic/duffserv/duffhost/noport", NOISY, - { DOMAIN_GIO, 0 }, + { DOMAIN_GIO, -1 }, { { TLS, NULL }, { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK }, { "moose", "something" }, @@ -495,7 +495,7 @@ test_t tests[] = /*Bad SRV and connect host, ignore SRV and FAIL */ { "/connector/basic/duffserv/duffhost/port", NOISY, - { DOMAIN_GIO, 0 }, + { DOMAIN_GIO, -1 }, { { TLS, NULL }, { SERVER_PROBLEM_NO_PROBLEM, CONNECTOR_OK }, { "moose", "something" }, @@ -3409,6 +3409,10 @@ run_test (gpointer data) { GQuark domain = g_quark_from_string (test->result.domain); + /* Ignore code when result.code is set to -1 */ + if (error && test->result.code == -1) + test->result.code = error->code; + g_assert_error (error, domain, test->result.code); } -- 1.7.2.2