summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2018-08-01 12:20:13 +0200
committerCarlos Garnacho <carlosg@gnome.org>2018-08-01 13:08:35 +0200
commite6964ed856be9333f9b5eea91d474da91a3014d8 (patch)
tree0fd2bdd49fda4baf69556d3beb13dd3cf02c6036
parent9c5f6a99fe18d1437ac8fef359fbc8407d7726fe (diff)
downloadtracker-e6964ed856be9333f9b5eea91d474da91a3014d8.tar.gz
tests: Set limit on test-bus-query-cancellation
This test tries to do a pretty dumb DOS on tracker-store for 2s, so it frequently gets kicked itself from the session bus. Presumably we don't need it to go that far in testing query cancellation, so limit the thing to a bunch of queries.
-rw-r--r--tests/functional-tests/ipc/test-bus-query-cancellation.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/functional-tests/ipc/test-bus-query-cancellation.c b/tests/functional-tests/ipc/test-bus-query-cancellation.c
index 0955ffc25..44ab25fe4 100644
--- a/tests/functional-tests/ipc/test-bus-query-cancellation.c
+++ b/tests/functional-tests/ipc/test-bus-query-cancellation.c
@@ -23,6 +23,10 @@
#include <libtracker-sparql/tracker-sparql.h>
+#define MAX_TRIES 900
+
+static int counter = 0;
+
static void
query_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
@@ -36,12 +40,17 @@ query_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
g_error_free (error);
}
+ counter++;
+ if (counter > MAX_TRIES) {
+ g_main_loop_quit (user_data);
+ return;
+ }
+
cancellable = g_cancellable_new ();
tracker_sparql_connection_query_async (conn,
"SELECT ?urn WHERE {?urn a rdfs:Resource}",
cancellable,
- query_cb,
- NULL);
+ query_cb, user_data);
g_cancellable_cancel (cancellable);
g_object_unref (cancellable);
@@ -83,8 +92,7 @@ test_tracker_sparql_gb737023 (void)
tracker_sparql_connection_query_async (conn,
"SELECT ?urn WHERE {?urn a rdfs:Resource}",
cancellable,
- query_cb,
- NULL);
+ query_cb, loop);
g_cancellable_cancel (cancellable);
g_main_loop_run (loop);