diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2015-01-28 22:44:16 +0100 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2015-01-30 09:33:40 +0100 |
commit | fa1ada44eabd62b46b89c7be22bfce6d595d8dac (patch) | |
tree | 590b2ac1b38e93947702145157c9f225078902f9 /test | |
parent | b5bf338953f3427621ac238293cdcd2914dfc505 (diff) | |
download | dbus-fa1ada44eabd62b46b89c7be22bfce6d595d8dac.tar.gz |
Add manual tcp test case.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=87999
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 7 | ||||
-rw-r--r-- | test/manual-tcp.c | 46 |
2 files changed, 52 insertions, 1 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 173df74b..c0c7a69f 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -123,6 +123,10 @@ manual_dir_iter_SOURCES = manual-dir-iter.c manual_dir_iter_CPPFLAGS = $(static_cppflags) manual_dir_iter_LDADD = $(top_builddir)/dbus/libdbus-internal.la +manual_tcp_SOURCES = manual-tcp.c +manual_tcp_CPPFLAGS = $(static_cppflags) +manual_tcp_LDADD = $(top_builddir)/dbus/libdbus-internal.la + EXTRA_DIST = dbus-test-runner testexecdir = $(libdir)/dbus-1.0/test @@ -135,7 +139,8 @@ installable_tests = \ $(NULL) installable_manual_tests = \ manual-dir-iter \ - $(NULL) + manual-tcp \ + $(NULL) if DBUS_WITH_GLIB installable_tests += \ diff --git a/test/manual-tcp.c b/test/manual-tcp.c new file mode 100644 index 00000000..64691c9d --- /dev/null +++ b/test/manual-tcp.c @@ -0,0 +1,46 @@ +/* + * Simple manual tcp check + * + * supports: + * - server listening check + * + * syntax: manual-tcp [<ipv4>|<ipv6>] + * +*/ + +#include "config.h" +#include "dbus/dbus-server-socket.h" + +#include <stdio.h> + +int +main (int argc, char **argv) +{ + DBusServer *server; + DBusError error; + int result = 0; + int i; + + char *family = NULL; + + if (argc == 2) + family = argv[1]; + + for (i = 0; i < 1000; i++) + { + dbus_error_init (&error); + server = _dbus_server_new_for_tcp_socket ("localhost", "localhost", "0", family, &error, FALSE); + if (server == NULL) + { + printf("%d: %s %s\n",i, error.name, error.message); + dbus_error_free(&error); + result = -1; + } + else { + printf("%d: %s \n",i, dbus_server_get_address(server)); + dbus_server_disconnect(server); + dbus_server_unref(server); + } + } + return result; +} |