[glib/wip/pwithnall/ci-fixes: 1/3] tests: Allow g_mkdir_with_parents() to fail with EPERM




commit 9469922d5c05c94902529c3cf874e54b9fa8ec08
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Mar 4 18:59:22 2022 +0000

    tests: Allow g_mkdir_with_parents() to fail with EPERM
    
    As well as with `EACCES`. This can happen if the filesystem as a whole
    is read-only, and has been spotted in the wild on macOS:
    ```
    Bail out! GLib:ERROR:../glib/tests/fileutils.c:756:test_mkdir_with_parents: assertion failed (errno == 
EACCES): (1 == 13)
    stderr:
    **
    GLib:ERROR:../glib/tests/fileutils.c:756:test_mkdir_with_parents: assertion failed (errno == EACCES): (1 
== 13)
    ```
    
    See: https://stackoverflow.com/q/68766316/2931197
    See: https://gitlab.gnome.org/GNOME/glib/-/jobs/1866500
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/tests/fileutils.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c
index f0ee25b5d..ae25578f9 100644
--- a/glib/tests/fileutils.c
+++ b/glib/tests/fileutils.c
@@ -753,7 +753,9 @@ test_mkdir_with_parents (void)
   g_assert_cmpint (g_mkdir_with_parents ("\\Windows\\b\\c", 0), ==, -1);
 #else
   g_assert_cmpint (g_mkdir_with_parents ("/usr/b/c", 0), ==, -1);
-  g_assert_cmpint (errno, ==, EACCES);
+  /* EPERM may be returned if the filesystem as a whole is read-only */
+  if (errno != EPERM)
+    g_assert_cmpint (errno, ==, EACCES);
 #endif
 
   g_assert_cmpint (g_mkdir_with_parents (NULL, 0), ==, -1);


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