[tracker/wip/carlosg/tracker-3.0-api-breaks: 30/79] tests: Drop tests for tracker_sparql_connection_get(_async) behavior
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/tracker-3.0-api-breaks: 30/79] tests: Drop tests for tracker_sparql_connection_get(_async) behavior
- Date: Mon, 27 Jan 2020 12:57:33 +0000 (UTC)
commit 38c98870c62fdfd5b5513a644ce1120454946bf6
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Dec 23 01:30:52 2019 +0100
tests: Drop tests for tracker_sparql_connection_get(_async) behavior
We are going to drop the singleton TrackerSparqlConnection, all
constructor methods will return a brand new object of their own. These
tests were verifying the behavior of tracker_sparql_connection_get() (and
its async variant) and ensuring the uniqueness of the returned connection.
It seems we cannot repurpose these tests, given the new behavior in mind,
the only exception is test_tracker_sparql_connection_interleaved() which
now simply tests for concurrent queries on the same connection.
tests/libtracker-sparql/tracker-sparql-test.c | 139 --------------------------
1 file changed, 139 deletions(-)
---
diff --git a/tests/libtracker-sparql/tracker-sparql-test.c b/tests/libtracker-sparql/tracker-sparql-test.c
index 201b01881..dcbbb9777 100644
--- a/tests/libtracker-sparql/tracker-sparql-test.c
+++ b/tests/libtracker-sparql/tracker-sparql-test.c
@@ -199,130 +199,6 @@ test_tracker_sparql_cursor_next_async (void)
g_main_loop_run (main_loop);
}
-static void
-test_tracker_sparql_connection_locking_sync (void)
-{
- TrackerSparqlConnection *c1, *c2, *c3;
-
- c1 = tracker_sparql_connection_get (NULL, NULL);
- c2 = tracker_sparql_connection_get (NULL, NULL);
- c3 = tracker_sparql_connection_get (NULL, NULL);
- g_assert (c1 == c2);
- g_assert (c2 == c3);
-
- g_object_unref (c1);
- g_object_unref (c2);
- g_object_unref (c3);
-}
-
-static TrackerSparqlConnection *c1 = NULL;
-static TrackerSparqlConnection *c2 = NULL;
-static TrackerSparqlConnection *c3 = NULL;
-
-static void
-test_tracker_sparql_connection_locking_async_cb (GObject *source,
- GAsyncResult *result,
- gpointer user_data)
-{
- TrackerSparqlConnection *connection;
- TrackerSparqlConnection *connection_waiting;
- GError *error = NULL;
-
- g_assert (result != NULL);
- connection = tracker_sparql_connection_get_finish (result, &error);
- g_assert_no_error (error);
- g_assert (connection != NULL);
-
- if (!c1) {
- g_print ("GOT connection #1, waiting connection:%p (expecting NULL)\n", user_data);
- c1 = connection;
- } else if (!c2) {
- g_print ("GOT connection #2, waiting connection:%p (expecting NULL)\n", user_data);
- c2 = connection;
- }
-
- connection_waiting = user_data;
- g_assert (connection_waiting == NULL);
-}
-
-static void
-test_tracker_sparql_connection_locking_async (void)
-{
- tracker_sparql_connection_get_async (NULL, test_tracker_sparql_connection_locking_async_cb, c2);
- tracker_sparql_connection_get_async (NULL, test_tracker_sparql_connection_locking_async_cb, c3);
- c3 = tracker_sparql_connection_get (NULL, NULL);
- g_assert (c3 != NULL);
-}
-
-static void
-test_tracker_sparql_get_connection_async_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
-{
- TrackerSparqlConnection *connection;
- GError *error = NULL;
- static gboolean had_1 = FALSE;
- static gboolean had_2 = FALSE;
-
- connection = tracker_sparql_connection_get_finish (result, &error);
- g_assert_no_error (error);
- g_assert (connection != NULL);
-
- /* Not actually worried about this being called */
- g_print ("Called back for #%d\n", GPOINTER_TO_INT(user_data));
-
- if (GPOINTER_TO_INT(user_data) == 1)
- had_1 = TRUE;
- if (GPOINTER_TO_INT(user_data) == 2)
- had_2 = TRUE;
-
- if (had_1 && had_2) {
- g_print ("Called back ALL\n");
- g_main_loop_quit (main_loop);
- }
-}
-
-static void
-test_tracker_sparql_get_connection_async_subprocess (void)
-{
- main_loop = g_main_loop_new (NULL, TRUE);
-
- g_print ("\n");
- g_print ("Calling #1 - tracker_sparql_connection_get_async()\n");
- tracker_sparql_connection_get_async (NULL, test_tracker_sparql_get_connection_async_cb,
GINT_TO_POINTER(1));
-
- g_print ("Calling #2 - tracker_sparql_connection_get_async()\n");
- tracker_sparql_connection_get_async (NULL, test_tracker_sparql_get_connection_async_cb,
GINT_TO_POINTER(2));
-
- g_print ("Calling both finished\n");
- g_main_loop_run (main_loop);
-}
-
-static void
-test_tracker_sparql_get_connection_async (void)
-{
- /* Regression test for an issue where a second
- * tracker_sparql_connection_get_async would never return.
- */
- g_test_trap_subprocess ("/libtracker-sparql/tracker-sparql/get_connection_async/subprocess",
- G_USEC_PER_SEC * 5,
- G_TEST_SUBPROCESS_INHERIT_STDOUT |
- G_TEST_SUBPROCESS_INHERIT_STDERR);
-
- g_test_trap_assert_passed ();
-
- /* Check we called the functions in the test */
- g_test_trap_assert_stdout ("*Calling #1*");
- g_test_trap_assert_stdout ("*Calling #2*");
- g_test_trap_assert_stdout ("*Calling both finished*");
-
- /* Check the callbacks from the functions we called were
- * called in the test */
- g_test_trap_assert_stdout ("*Called back for #1*");
- g_test_trap_assert_stdout ("*Called back for #2*");
- g_test_trap_assert_stdout ("*Called back ALL*");
-}
-
static void
test_tracker_sparql_connection_interleaved (void)
{
@@ -341,10 +217,6 @@ test_tracker_sparql_connection_interleaved (void)
g_assert_no_error (error);
/* intentionally not freeing cursor1 here */
- g_object_unref(connection);
-
- connection = tracker_sparql_connection_get (NULL, &error);
- g_assert_no_error (error);
cursor2 = tracker_sparql_connection_query (connection, query, 0, &error);
g_assert_no_error (error);
@@ -375,23 +247,12 @@ main (gint argc, gchar **argv)
g_test_init (&argc, &argv, NULL);
- /* NOTE: this first test must come BEFORE any others because
- * connections are cached by libtracker-sparql.
- */
- g_test_add_func ("/libtracker-sparql/tracker-sparql/get_connection_async",
- test_tracker_sparql_get_connection_async);
- g_test_add_func ("/libtracker-sparql/tracker-sparql/get_connection_async/subprocess",
- test_tracker_sparql_get_connection_async_subprocess);
g_test_add_func ("/libtracker-sparql/tracker-sparql/tracker_sparql_escape_string",
test_tracker_sparql_escape_string);
g_test_add_func ("/libtracker-sparql/tracker-sparql/tracker_sparql_escape_uri_vprintf",
test_tracker_sparql_escape_uri_vprintf);
g_test_add_func ("/libtracker-sparql/tracker-sparql/tracker_sparql_connection_interleaved",
test_tracker_sparql_connection_interleaved);
- g_test_add_func ("/libtracker-sparql/tracker-sparql/tracker_sparql_connection_locking_sync",
- test_tracker_sparql_connection_locking_sync);
- g_test_add_func ("/libtracker-sparql/tracker-sparql/tracker_sparql_connection_locking_async",
- test_tracker_sparql_connection_locking_async);
g_test_add_func ("/libtracker-sparql/tracker-sparql/tracker_sparql_cursor_next_async",
test_tracker_sparql_cursor_next_async);
g_test_add_func ("/libtracker-sparql/tracker-sparql/tracker_check_version",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]