mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 02:06:18 +01:00
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
This commit is contained in:
parent
2793b39ea3
commit
26f1e0938e
@ -420,6 +420,17 @@ test_create_delete (gconstpointer d)
|
|||||||
error = NULL;
|
error = NULL;
|
||||||
data->monitor = g_file_monitor_file (data->file, 0, NULL, &error);
|
data->monitor = g_file_monitor_file (data->file, 0, NULL, &error);
|
||||||
g_assert_no_error (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_file_monitor_set_rate_limit (data->monitor, 100);
|
||||||
|
|
||||||
g_signal_connect (data->monitor, "changed", G_CALLBACK (monitor_changed), data);
|
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_assert (g_file_monitor_is_cancelled (data->monitor));
|
||||||
|
|
||||||
g_main_loop_unref (data->loop);
|
g_main_loop_unref (data->loop);
|
||||||
g_object_unref (data->monitor);
|
|
||||||
g_object_unref (data->ostream);
|
g_object_unref (data->ostream);
|
||||||
g_object_unref (data->istream);
|
g_object_unref (data->istream);
|
||||||
|
|
||||||
|
skip:
|
||||||
|
g_object_unref (data->monitor);
|
||||||
g_object_unref (data->file);
|
g_object_unref (data->file);
|
||||||
free (data->monitor_path);
|
free (data->monitor_path);
|
||||||
g_free (data->buffer);
|
g_free (data->buffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user