From 20c3ab9e51e2441f0285e791cb32bd47c83f91ff Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 12 Apr 2022 13:27:33 +0100 Subject: [PATCH 1/2] tests: Use G_TEST_OPTION_ISOLATE_DIRS in gdbus-peer-object-manager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This might fix a recent test failure: https://gitlab.gnome.org/GNOME/glib/-/jobs/1929015. Unfortunately there’s not much debug information in the logs to go on, and I can’t reproduce it locally. All I have is: ``` 192/272 glib:gio / gdbus-peer-object-manager FAIL 0.43 s (killed by signal 11 SIGSEGV) --- command --- GIO_MODULE_DIR='' G_TEST_BUILDDIR='/builds/GNOME/glib/_build/gio/tests' G_TEST_SRCDIR='/builds/GNOME/glib/gio/tests' /builds/GNOME/glib/_build/gio/tests/gdbus-peer-object-manager --- stdout --- \# random seed: R02Seee9b7325ecd7c19249a3412397aed9b 1..2 \# Start of gdbus tests \# Start of peer-object-manager tests ``` Signed-off-by: Philip Withnall --- gio/tests/gdbus-peer-object-manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/tests/gdbus-peer-object-manager.c b/gio/tests/gdbus-peer-object-manager.c index f101b46bd..4177728e7 100644 --- a/gio/tests/gdbus-peer-object-manager.c +++ b/gio/tests/gdbus-peer-object-manager.c @@ -375,7 +375,7 @@ int main (int argc, char *argv[]) { - g_test_init (&argc, &argv, NULL); + g_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL); g_test_add ("/gdbus/peer-object-manager/normal", Test, "/objects", setup, test_object_manager, teardown); From 77416fc023a3235d39c0e9fa0dff566240fe5801 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 12 Apr 2022 13:28:47 +0100 Subject: [PATCH 2/2] tests: Use g_assert_*() rather than g_assert() in gdbus-peer-object-manager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It won’t get compiled out with `G_DISABLE_ASSERT`. Signed-off-by: Philip Withnall --- gio/tests/gdbus-peer-object-manager.c | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/gio/tests/gdbus-peer-object-manager.c b/gio/tests/gdbus-peer-object-manager.c index 4177728e7..0be403f79 100644 --- a/gio/tests/gdbus-peer-object-manager.c +++ b/gio/tests/gdbus-peer-object-manager.c @@ -180,10 +180,10 @@ on_server_connection (GObject *source, Test *test = user_data; GError *error = NULL; - g_assert (test->server == NULL); + g_assert_null (test->server); test->server = g_dbus_connection_new_finish (result, &error); g_assert_no_error (error); - g_assert (test->server != NULL); + g_assert_nonnull (test->server); if (test->server && test->client) g_main_loop_quit (test->loop); @@ -197,10 +197,10 @@ on_client_connection (GObject *source, Test *test = user_data; GError *error = NULL; - g_assert (test->client == NULL); + g_assert_null (test->client); test->client = g_dbus_connection_new_finish (result, &error); g_assert_no_error (error); - g_assert (test->client != NULL); + g_assert_nonnull (test->client); if (test->server && test->client) g_main_loop_quit (test->loop); @@ -231,7 +231,7 @@ setup (Test *test, g_assert_no_error (error); stream = g_socket_connection_factory_create_connection (socket); - g_assert (stream != NULL); + g_assert_nonnull (stream); g_object_unref (socket); guid = g_dbus_generate_guid (); @@ -247,7 +247,7 @@ setup (Test *test, g_assert_no_error (error); stream = g_socket_connection_factory_create_connection (socket); - g_assert (stream != NULL); + g_assert_nonnull (stream); g_object_unref (socket); g_dbus_connection_new (G_IO_STREAM (stream), NULL, @@ -257,8 +257,8 @@ setup (Test *test, g_main_loop_run (test->loop); - g_assert (test->server); - g_assert (test->client); + g_assert_nonnull (test->server); + g_assert_nonnull (test->client); g_object_unref (stream); } @@ -278,7 +278,7 @@ on_result (GObject *source, gpointer user_data) { Test *test = user_data; - g_assert (test->result == NULL); + g_assert_null (test->result); test->result = g_object_ref (result); g_main_loop_quit (test->loop); @@ -337,28 +337,28 @@ test_object_manager (Test *test, g_clear_object (&test->result); proxy = g_dbus_object_manager_get_interface (client, number1_path, "org.mock.Interface"); - g_assert (proxy != NULL); + g_assert_nonnull (proxy); prop = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Path"); - g_assert (prop != NULL); + g_assert_nonnull (prop); g_assert_cmpstr ((gchar *)g_variant_get_type (prop), ==, (gchar *)G_VARIANT_TYPE_OBJECT_PATH); g_assert_cmpstr (g_variant_get_string (prop, NULL), ==, number1_path); g_variant_unref (prop); prop = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Number"); - g_assert (prop != NULL); + g_assert_nonnull (prop); g_assert_cmpstr ((gchar *)g_variant_get_type (prop), ==, (gchar *)G_VARIANT_TYPE_INT32); g_assert_cmpint (g_variant_get_int32 (prop), ==, 1); g_variant_unref (prop); g_object_unref (proxy); proxy = g_dbus_object_manager_get_interface (client, number2_path, "org.mock.Interface"); - g_assert (proxy != NULL); + g_assert_nonnull (proxy); prop = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Path"); - g_assert (prop != NULL); + g_assert_nonnull (prop); g_assert_cmpstr ((gchar *)g_variant_get_type (prop), ==, (gchar *)G_VARIANT_TYPE_OBJECT_PATH); g_assert_cmpstr (g_variant_get_string (prop, NULL), ==, number2_path); g_variant_unref (prop); prop = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Number"); - g_assert (prop != NULL); + g_assert_nonnull (prop); g_assert_cmpstr ((gchar *)g_variant_get_type (prop), ==, (gchar *)G_VARIANT_TYPE_INT32); g_assert_cmpint (g_variant_get_int32 (prop), ==, 2); g_variant_unref (prop);