[glib: 1/4] tests: Don't run file creation and deletion test on kqueue



commit 70e4ca03403bd773b43775822ebf416cb3b8cbcd
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Sun Jun 3 11:55:04 2018 +0800

    tests: Don't run file creation and deletion test on kqueue
    
    Kqueue isn't good at detecting rapid file creation and deletion. It
    tends to miss events because events returned by the kernel don't include
    filename information. Since the size of struct kevent is fixed, it is
    probably not possible to extend the API to include file names without
    breaking ABI. Therefore, we disables the test here to avoid test failure
    that is impossible to fix in a reliable way.

 gio/tests/file.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/gio/tests/file.c b/gio/tests/file.c
index 04625fd68..7989071fe 100644
--- a/gio/tests/file.c
+++ b/gio/tests/file.c
@@ -477,7 +477,15 @@ test_create_delete (gconstpointer d)
    * 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"))
+  /* This test also doesn't work with GKqueueFileMonitor because of
+   * the same reason. Kqueue is able to return a kevent when a file is
+   * created or deleted in a directory. However, the kernel doesn't tell
+   * the program file names, so GKqueueFileMonitor has to calculate the
+   * difference itself. This is usually too slow for rapid file creation
+   * and deletion tests.
+   */
+  if (strcmp (G_OBJECT_TYPE_NAME (data->monitor), "GPollFileMonitor") == 0 ||
+      strcmp (G_OBJECT_TYPE_NAME (data->monitor), "GKqueueFileMonitor") == 0)
     {
       g_test_skip ("skipping test for this GFileMonitor implementation");
       goto skip;


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