From 26f1e0938eeb61c7f93b651aa316e33f3b0d6292 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 3 Feb 2012 11:35:26 -0500 Subject: [PATCH] gio/tests/file: skip the file monitor tests if using GPollFileMonitor test_create_delete() assumes that if it creates a file and then immediately deletes it, that the file monitor will notice this and record it as a create followed by a delete. But that won't work with GPollFileMonitor, which will just think nothing changed. So skip the test in that case. https://bugzilla.gnome.org/show_bug.cgi?id=669331 --- gio/tests/file.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gio/tests/file.c b/gio/tests/file.c index 5fed88b56..c707d0df0 100644 --- a/gio/tests/file.c +++ b/gio/tests/file.c @@ -420,6 +420,17 @@ test_create_delete (gconstpointer d) error = NULL; data->monitor = g_file_monitor_file (data->file, 0, NULL, &error); g_assert_no_error (error); + + /* This test doesn't work with GPollFileMonitor, because it assumes + * that the monitor will notice a create immediately followed by a + * delete, rather than coalescing them into nothing. + */ + if (!strcmp (G_OBJECT_TYPE_NAME (data->monitor), "GPollFileMonitor")) + { + g_print ("skipping test for this GFileMonitor implementation"); + goto skip; + } + g_file_monitor_set_rate_limit (data->monitor, 100); g_signal_connect (data->monitor, "changed", G_CALLBACK (monitor_changed), data); @@ -441,9 +452,11 @@ test_create_delete (gconstpointer d) g_assert (g_file_monitor_is_cancelled (data->monitor)); g_main_loop_unref (data->loop); - g_object_unref (data->monitor); g_object_unref (data->ostream); g_object_unref (data->istream); + + skip: + g_object_unref (data->monitor); g_object_unref (data->file); free (data->monitor_path); g_free (data->buffer);