libtest: Allow skipping single checks without user xattrs
authorSimon McVittie <smcv@collabora.com>
Tue, 29 Aug 2017 16:02:18 +0000 (17:02 +0100)
committerSimon McVittie <smcv@debian.org>
Tue, 29 Aug 2017 17:18:49 +0000 (18:18 +0100)
Signed-off-by: Simon McVittie <smcv@debian.org>
Gbp-Pq: Name libtest-Allow-skipping-single-checks-without-user-xattrs.patch

tests/libtest.sh

index ff096505328dccc8837a1b69154f2fc70c297f5b..7f334c02273d90c092622dff8719eb55029a5d14 100755 (executable)
@@ -489,6 +489,17 @@ os_repository_new_commit ()
     cd ${test_tmpdir}
 }
 
+# Usage: if ! skip_one_without_user_xattrs; then ... more tests ...; fi
+skip_one_without_user_xattrs () {
+    touch test-xattrs
+    if ! setfattr -n user.testvalue -v somevalue test-xattrs; then
+        echo "ok # SKIP - this test requires xattr support"
+        return 0
+    else
+        return 1
+    fi
+}
+
 skip_without_user_xattrs () {
     touch test-xattrs
     setfattr -n user.testvalue -v somevalue test-xattrs || \