test-basic-c: Don't assert that extended attributes are available
authorSimon McVittie <smcv@debian.org>
Fri, 17 Jun 2022 13:15:35 +0000 (14:15 +0100)
committerSimon McVittie <smcv@collabora.com>
Fri, 17 Jun 2022 13:42:01 +0000 (14:42 +0100)
Not all filesystems support extended attributes. This test uses
/var/tmp to try to get an extended-attributes-capable filesystem,
but that might not succeed.

Signed-off-by: Simon McVittie <smcv@debian.org>
tests/test-basic-c.c

index 1886feb2ddaefedd72175603aa01811b022ae29b..fc995298c15dbb59067c47755166090c0f5286c3 100644 (file)
@@ -514,8 +514,15 @@ test_read_xattrs (void)
     g_assert_no_error (local_error);
   
     int r = fsetxattr (tmpd.fd, "user.ostreetesting", value, sizeof (value), 0);
-    g_assert_cmpint (r, ==, 0);
-  
+
+    if (r != 0)
+      {
+        g_autofree gchar *message = g_strdup_printf ("Unable to set extended attributes in /var/tmp: %s",
+                                                     g_strerror (errno));
+        g_test_skip (message);
+        return;
+      }
+
     g_autoptr(GVariant) new_xattrs = ostree_fs_get_all_xattrs (tmpd.fd, NULL, error);
     g_assert_no_error (local_error);