[glib: 1/6] tests: fix test_set_contents_full mode check on win32




commit a4e302f503088c51632673df09e05d97e5586e09
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Fri Jan 21 13:40:15 2022 +0400

    tests: fix test_set_contents_full mode check on win32
    
    Fixes:
    GLib:ERROR:../glib/tests/fileutils.c:1348:test_set_contents_full: assertion failed (statbuf.st_mode & 
~S_IFMT == tests[i].new_mode): (438 == 420)
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 glib/tests/fileutils.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c
index bb3b51648..6264d1cd1 100644
--- a/glib/tests/fileutils.c
+++ b/glib/tests/fileutils.c
@@ -1345,7 +1345,17 @@ test_set_contents_full (void)
               g_assert_no_errno (g_lstat (set_contents_name, &statbuf));
 
               if (tests[i].existing_file == EXISTING_FILE_NONE)
-                g_assert_cmpint (statbuf.st_mode & ~S_IFMT, ==, tests[i].new_mode);
+                {
+                  int mode = statbuf.st_mode & ~S_IFMT;
+                  int new_mode = tests[i].new_mode;
+#ifdef G_OS_WIN32
+                  /* on windows, group and others perms handling is different */
+                  /* only check the rwx user permissions */
+                  mode &= (_S_IREAD|_S_IWRITE|_S_IEXEC);
+                  new_mode &= (_S_IREAD|_S_IWRITE|_S_IEXEC);
+#endif
+                  g_assert_cmpint (mode, ==, new_mode);
+                }
 
 #ifndef G_OS_WIN32
               if (tests[i].existing_file == EXISTING_FILE_SYMLINK)


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