From: Max Kellermann Date: Mon, 2 Oct 2023 12:05:25 +0000 (+0200) Subject: test/test-chown-rec: skip ACL tests if kernel has no ACL support X-Git-Tag: v255-rc1~359^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ec757e920c9f57a89a4378c10cd96264b058f418;p=thirdparty%2Fsystemd.git test/test-chown-rec: skip ACL tests if kernel has no ACL support The second half of `chown_recursive` works only if the kernel has ACL support. --- diff --git a/src/test/test-chown-rec.c b/src/test/test-chown-rec.c index dcff17efec2..5d83f5915a4 100644 --- a/src/test/test-chown-rec.c +++ b/src/test/test-chown-rec.c @@ -44,6 +44,7 @@ TEST(chown_recursive) { const char *p; const uid_t uid = getuid(); const gid_t gid = getgid(); + int r; umask(022); assert_se(mkdtemp_malloc(NULL, &t) >= 0); @@ -95,7 +96,11 @@ TEST(chown_recursive) { /* We now apply an xattr to the dir, and check it again */ p = strjoina(t, "/dir"); - assert_se(setxattr(p, "system.posix_acl_access", acl, sizeof(acl), 0) >= 0); + r = RET_NERRNO(setxattr(p, "system.posix_acl_access", acl, sizeof(acl), 0)); + if (ERRNO_IS_NEG_NOT_SUPPORTED(r)) + return (void) log_tests_skipped_errno(r, "no acl supported on /tmp"); + + assert_se(r >= 0); assert_se(setxattr(p, "system.posix_acl_default", default_acl, sizeof(default_acl), 0) >= 0); assert_se(lstat(p, &st) >= 0); assert_se(S_ISDIR(st.st_mode));