[tracker/class-signal] functional-tests: class-signal: Allow tweaking the test



commit 7f2aceb25dcaae0eb3974c889d038dec0ca6d940
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Aug 20 14:11:36 2010 +0200

    functional-tests: class-signal: Allow tweaking the test

 tests/functional-tests/class-signal-test.vala |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/tests/functional-tests/class-signal-test.vala b/tests/functional-tests/class-signal-test.vala
index 482c1ff..ab2c687 100644
--- a/tests/functional-tests/class-signal-test.vala
+++ b/tests/functional-tests/class-signal-test.vala
@@ -20,6 +20,8 @@
 using Tracker;
 using Tracker.Sparql;
 
+int max_signals = 1000;
+
 struct Event {
 	int subject_id;
 	int pred_id;
@@ -43,6 +45,7 @@ public class TestApp {
 	bool initialized = false;
 	Sparql.Connection signal_con;
 	Sparql.Connection con;
+	string max_signals_s;
 
 	public TestApp ()
 	requires (!initialized) {
@@ -59,6 +62,8 @@ public class TestApp {
 
 			resources_object.class_signal.connect (on_class_signal_received);
 
+			max_signals_s = max_signals.to_string ();
+
 		} catch (Sparql.Error e) {
 			warning ("Could not connect to D-Bus service: %s", e.message);
 			initialized = false;
@@ -98,11 +103,15 @@ public class TestApp {
 		try {
 			while (cursor.next()) {
 				int i;
-				print ("%s", kind);
-				for (i = 0; i < cursor.n_columns; i++)
-					print ("%s%s%s", i != 0 ? ", nie:title '":"<", cursor.get_string (i),
-					                 i != 0 ? "'":">");
-				print ("\n");
+				string resource = cursor.get_string (0);
+
+				print ("%s <%s> nie:title '%s'\n",
+				       kind,
+				       resource,
+				       cursor.get_string (1));
+				if (resource == max_signals_s) {
+					loop.quit();
+				}
 			}
 		} catch (GLib.Error e) {
 			warning ("Couldn't iterate query results: %s", e.message);
@@ -139,9 +148,13 @@ public class TestApp {
 	private void insert_data () {
 		int i;
 
-		for (i = 0; i< 10000; i++) {
+		for (i = 0; i <= max_signals; i++) {
 			string upqry = "DELETE { <%d> a rdfs:Resource } INSERT { <%d> a nmm:MusicPiece ; nie:title 'title %d' }".printf(i, i, i);
+
 			resources_object.sparql_update_async (upqry);
+
+			// Once the FD passing bug is fixed (running out of FDs), replace
+			// above with this:
 			// con.update_async (upqry);
 		}
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]