[libglnx] tests/xattrs: Skip on filesystems with no user xattr support



commit 74383ba40529ef05346f617c846b55a73da1810c
Author: Colin Walters <walters verbum org>
Date:   Wed Apr 19 17:47:15 2017 -0400

    tests/xattrs: Skip on filesystems with no user xattr support
    
    Like tmpfs.
    
    See: https://github.com/flatpak/flatpak/issues/686

 tests/test-libglnx-xattrs.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/tests/test-libglnx-xattrs.c b/tests/test-libglnx-xattrs.c
index 0b21133..b6f0ac6 100644
--- a/tests/test-libglnx-xattrs.c
+++ b/tests/test-libglnx-xattrs.c
@@ -244,6 +244,21 @@ test_xattr_races (void)
   if (!glnx_opendirat (AT_FDCWD, tmpdir, TRUE, &dfd, error))
     goto out;
 
+  /* Support people building/testing on tmpfs https://github.com/flatpak/flatpak/issues/686 */
+  if (fsetxattr (dfd, "user.test", "novalue", strlen ("novalue"), 0) < 0)
+    {
+      if (errno == EOPNOTSUPP)
+        {
+          g_test_skip ("no xattr support");
+          return;
+        }
+      else
+        {
+          glnx_set_error_from_errno (error);
+          goto out;
+        }
+    }
+
   for (guint i = 0; i < nprocs; i++)
     {
       struct XattrWorker *worker = &wdata[i];


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