diff options
author | Simon McVittie <smcv@collabora.com> | 2018-06-04 16:27:48 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2018-06-04 17:55:58 +0100 |
commit | 102129f86a8d0f43e2d8002a46c8a6278e389e46 (patch) | |
tree | a18a5872c6f76538d878945bd21fce7572b914d5 | |
parent | 8ec0b5ae2d9bce65d8246204b90a9d2552f337e7 (diff) | |
download | dbus-102129f86a8d0f43e2d8002a46c8a6278e389e46.tar.gz |
server-oom test: Parse the address instead of going directly to TCP
This expands test coverage, and lets us reuse the test for other
address schemes.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=106812
(cherry picked from commit b19c9e2f265878801bc48866a7cc3152ca2ad45e)
-rw-r--r-- | test/internals/server-oom.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/test/internals/server-oom.c b/test/internals/server-oom.c index 842477d1..c8a37f32 100644 --- a/test/internals/server-oom.c +++ b/test/internals/server-oom.c @@ -38,30 +38,14 @@ /* Return TRUE if the right thing happens, but the right thing might include * OOM. */ static dbus_bool_t -test_new_tcp (void *user_data) +test_new_server (void *user_data) { + const char *listen_address = user_data; DBusError error = DBUS_ERROR_INIT; DBusServer *server = NULL; - dbus_bool_t use_nonce = FALSE; - const char *bind = "localhost"; - const char *family = NULL; dbus_bool_t result = FALSE; - if (user_data != NULL) - { - if (strcmp (user_data, "nonce") == 0) - use_nonce = TRUE; - - if (strcmp (user_data, "star") == 0) - bind = "*"; - - if (strcmp (user_data, "v4") == 0) - family = "ipv4"; - } - - server = _dbus_server_new_for_tcp_socket ("localhost", bind, - "0", family, &error, - use_nonce); + server = dbus_server_listen (listen_address, &error); if (server == NULL) goto out; @@ -136,10 +120,10 @@ main (int argc, test_init (&argc, &argv); test_cases_to_free = g_queue_new (); - add_oom_test ("/server/new-tcp", test_new_tcp, NULL); - add_oom_test ("/server/new-nonce-tcp", test_new_tcp, "nonce"); - add_oom_test ("/server/new-tcp-star", test_new_tcp, "star"); - add_oom_test ("/server/new-tcp-v4", test_new_tcp, "v4"); + add_oom_test ("/server/new-tcp", test_new_server, "tcp:host=localhost,bind=localhost"); + add_oom_test ("/server/new-nonce-tcp", test_new_server, "nonce-tcp:host=localhost,bind=localhost"); + add_oom_test ("/server/new-tcp-star", test_new_server, "tcp:host=localhost,bind=*"); + add_oom_test ("/server/new-tcp-v4", test_new_server, "tcp:host=localhost,bind=localhost,family=ipv4"); ret = g_test_run (); |