[tracker] tests: Set limit on test-bus-query-cancellation
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tests: Set limit on test-bus-query-cancellation
- Date: Wed, 1 Aug 2018 11:13:02 +0000 (UTC)
commit e6964ed856be9333f9b5eea91d474da91a3014d8
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Aug 1 12:20:13 2018 +0200
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.
tests/functional-tests/ipc/test-bus-query-cancellation.c | 16 ++++++++++++----
1 file 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]