tests/libtest: check that we have setfattr
authorJonathan Lebon <jlebon@redhat.com>
Wed, 20 Sep 2017 17:07:54 +0000 (17:07 +0000)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 21 Sep 2017 21:50:40 +0000 (21:50 +0000)
We use `setfattr` to determine whether the filesystem we're on supports
xattrs, but we need to check that `setfattr` itself is available. We
just make it a hard requirement but only if trying to run tests that ask
about xattr support.

Closes: #1207
Approved by: cgwalters

tests/libtest.sh

index 2b30e654596220e704e4ec263b47ca9033134a95..9bfc199f4f93861120e5e38ad50d88226c6a2da7 100755 (executable)
@@ -517,6 +517,9 @@ os_repository_new_commit ()
 # Usage: if ! skip_one_without_user_xattrs; then ... more tests ...; fi
 _have_user_xattrs=''
 have_user_xattrs() {
+    if ! which setfattr 2>/dev/null; then
+        fatal "no setfattr available to determine xattr support"
+    fi
     if test "${_have_user_xattrs}" = ''; then
         touch test-xattrs
         if setfattr -n user.testvalue -v somevalue test-xattrs 2>/dev/null; then