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>
This commit is contained in:
Philip Withnall 2022-03-04 18:59:22 +00:00
parent d497bdebc0
commit 9469922d5c

View File

@ -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);