summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--tests/Makefile.am13
-rw-r--r--tests/wocky-dummy-xmpp-server.c15
3 files changed, 24 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 8b1aaec..12c3c8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,6 +79,7 @@ wocky/wocky-uninstalled.pc
tests/sasl-test.db
tests/test-report.xml
tests/wocky-*-test
+tests/wocky-dummy-xmpp-server
tests/wocky-test-sasl-auth
tests/*report.xml
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c2d5c0a..7be6c8f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -64,6 +64,8 @@ TEST_PROGS = wocky-xmpp-reader-test \
wocky-scram-sha1-test \
wocky-caps-hash-test
+noinst_PROGRAMS=
+
wocky_tls_test_DEPENDENCIES = $(LIBWOCKY)
wocky_tls_test_SOURCES = \
wocky-tls-test.c \
@@ -235,6 +237,17 @@ wocky_http_proxy_test_SOURCES = wocky-http-proxy-test.c \
wocky-test-helper.c wocky-test-helper.h \
wocky-test-stream.c wocky-test-stream.h
+wocky_dummy_xmpp_server_DEPENDENCIES = $(LIBWOCKY)
+wocky_dummy_xmpp_server_SOURCES = wocky-dummy-xmpp-server.c \
+ wocky-test-connector-server.c wocky-test-connector-server.h \
+ wocky-test-sasl-auth-server.c wocky-test-sasl-auth-server.h
+wocky_dummy_xmpp_server_LDADD = $(LDADD) @LIBSASL2_LIBS@
+wocky_dummy_xmpp_server_CFLAGS = $(AM_CFLAGS) @LIBSASL2_CFLAGS@ $(TLSDEFS)
+
+if HAVE_LIBSASL2
+ noinst_PROGRAMS += wocky-dummy-xmpp-server
+endif
+
wocky_caps_hash_test_DEPENDENCIES = $(LIBWOCKY)
wocky_caps_hash_test_SOURCES = wocky-caps-hash-test.c \
wocky-test-helper.c wocky-test-helper.h \
diff --git a/tests/wocky-dummy-xmpp-server.c b/tests/wocky-dummy-xmpp-server.c
index f677fe9..eeaded4 100644
--- a/tests/wocky-dummy-xmpp-server.c
+++ b/tests/wocky-dummy-xmpp-server.c
@@ -31,6 +31,7 @@ client_connected (GIOChannel *channel,
int ssock = g_io_channel_unix_get_fd (channel);
int csock = accept (ssock, (struct sockaddr *)&client, &clen);
GSocket *gsock = g_socket_new_from_fd (csock, NULL);
+ ConnectorProblem cproblem = { 0, };
GSocketConnection *gconn;
pid_t pid = 0;
@@ -52,16 +53,17 @@ client_connected (GIOChannel *channel,
break;
case 0:
while (g_source_remove_by_user_data (loop));
- g_io_channel_close (channel);
+ g_io_channel_shutdown (channel, TRUE, NULL);
flags = fcntl (csock, F_GETFL );
flags = flags & ~O_NONBLOCK;
fcntl (csock, F_SETFL, flags);
gconn = g_object_new (G_TYPE_SOCKET_CONNECTION, "socket", gsock, NULL);
server = test_connector_server_new (G_IO_STREAM (gconn),
- NULL, "foo", "bar",
- CONNECTOR_PROBLEM_NO_PROBLEM,
- SERVER_PROBLEM_NO_PROBLEM);
- test_connector_server_start (G_OBJECT (server));
+ NULL, "foo", "bar", "1.0",
+ &cproblem,
+ SERVER_PROBLEM_NO_PROBLEM,
+ CERT_STANDARD);
+ test_connector_server_start (server);
return FALSE;
default:
g_socket_close (gsock, NULL);
@@ -81,7 +83,10 @@ main (int argc,
memset (&server, 0, sizeof (server));
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_thread_init (NULL);
+#endif
+
g_type_init ();
loop = g_main_loop_new (NULL, FALSE);