summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2023-04-25 18:38:21 +0100
committerPhilip Withnall <pwithnall@endlessos.org>2023-04-27 12:23:25 +0100
commit2ac66413a4669228d101d0a1f77664d7fe5e7d9a (patch)
tree4a0fcd626ff6306f5ec5c7a11ff0b771feb723e2
parentef08e8dd81e865a50afe25dd0af028eaabcd7246 (diff)
downloadglib-2ac66413a4669228d101d0a1f77664d7fe5e7d9a.tar.gz
tests: Support --timeout argument in resolver manual test
For testing timeouts. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-rw-r--r--gio/tests/resolver.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gio/tests/resolver.c b/gio/tests/resolver.c
index ec9b9e9de..68b3d3cfb 100644
--- a/gio/tests/resolver.c
+++ b/gio/tests/resolver.c
@@ -41,6 +41,7 @@ static int nlookups = 0;
static gboolean synchronous = FALSE;
static guint connectable_count = 0;
static GResolverRecordType record_type = 0;
+static gint timeout_ms = 0;
static G_NORETURN void
usage (void)
@@ -722,6 +723,7 @@ static const GOptionEntry option_entries[] = {
{ "synchronous", 's', 0, G_OPTION_ARG_NONE, &synchronous, "Synchronous connections", NULL },
{ "connectable", 'c', 0, G_OPTION_ARG_INT, &connectable_count, "Connectable count", "C" },
{ "special-type", 't', 0, G_OPTION_ARG_CALLBACK, record_type_arg, "Record type like MX, TXT, NS or SOA", "RR" },
+ { "timeout", 0, 0, G_OPTION_ARG_INT, &timeout_ms, "Timeout (ms)", "ms" },
G_OPTION_ENTRY_NULL,
};
@@ -749,6 +751,9 @@ main (int argc, char **argv)
resolver = g_resolver_get_default ();
+ if (timeout_ms != 0)
+ g_resolver_set_timeout (resolver, timeout_ms);
+
cancellable = g_cancellable_new ();
#ifdef G_OS_UNIX