[ostree: 18/70] various tests: skip if temp directory lacks xattr support



commit 3e3755c497bd85e22b01829c5715119d46394687
Author: Simon McVittie <smcv debian org>
Date:   Thu Mar 31 11:06:05 2016 +0100

    various tests: skip if temp directory lacks xattr support
    
    Some autobuilder environments place the entire build chroot on tmpfs, so
    even /var/tmp might not have this.
    
    Signed-off-by: Simon McVittie <smcv debian org>
    
    Closes: #232
    Approved by: cgwalters

 tests/libtest.sh               |    8 ++++++++
 tests/test-basic-user.sh       |    6 ++++--
 tests/test-delta.sh            |    2 ++
 tests/test-demo-buildsystem.sh |    2 ++
 tests/test-local-pull.sh       |    6 ++++--
 tests/test-prune.sh            |    2 ++
 tests/test-rofiles-fuse.sh     |    3 +++
 7 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/tests/libtest.sh b/tests/libtest.sh
index 06982d2..21de2e8 100755
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -324,3 +324,11 @@ os_repository_new_commit ()
     ${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo commit  --add-metadata-string 
"version=${version}" -b testos/buildmaster/x86_64-runtime -s "Build"
     cd ${test_tmpdir}
 }
+
+skip_without_user_xattrs () {
+    touch test-xattrs
+    if ! setfattr -n user.testvalue -v somevalue test-xattrs; then
+        echo "1..0 # SKIP this test requires xattr support"
+        exit 0
+    fi
+}
diff --git a/tests/test-basic-user.sh b/tests/test-basic-user.sh
index f53de89..42e6a86 100755
--- a/tests/test-basic-user.sh
+++ b/tests/test-basic-user.sh
@@ -19,10 +19,12 @@
 
 set -euo pipefail
 
-echo "1..1"
-
 . $(dirname $0)/libtest.sh
 
+skip_without_user_xattrs
+
+echo "1..1"
+
 setup_test_repository "bare-user"
 echo "ok setup"
 
diff --git a/tests/test-delta.sh b/tests/test-delta.sh
index 12f54c7..a6fd6f8 100755
--- a/tests/test-delta.sh
+++ b/tests/test-delta.sh
@@ -21,6 +21,8 @@ set -euo pipefail
 
 . $(dirname $0)/libtest.sh
 
+skip_without_user_xattrs
+
 bindatafiles="bash true ostree"
 morebindatafiles="false ls"
 
diff --git a/tests/test-demo-buildsystem.sh b/tests/test-demo-buildsystem.sh
index 500eac6..bffa59c 100755
--- a/tests/test-demo-buildsystem.sh
+++ b/tests/test-demo-buildsystem.sh
@@ -26,6 +26,8 @@ fi
 
 . $(dirname $0)/libtest.sh
 
+skip_without_user_xattrs
+
 echo "1..1"
 
 # Run "triggers" like ldconfig, gtk-update-icon-cache, etc.
diff --git a/tests/test-local-pull.sh b/tests/test-local-pull.sh
index a9beb08..50ecbcb 100755
--- a/tests/test-local-pull.sh
+++ b/tests/test-local-pull.sh
@@ -19,10 +19,12 @@
 
 set -euo pipefail
 
-echo "1..1"
-
 . $(dirname $0)/libtest.sh
 
+skip_without_user_xattrs
+
+echo "1..1"
+
 setup_test_repository "archive-z2"
 echo "ok setup"
 
diff --git a/tests/test-prune.sh b/tests/test-prune.sh
index 7184ea9..e1796a3 100755
--- a/tests/test-prune.sh
+++ b/tests/test-prune.sh
@@ -21,6 +21,8 @@ set -euo pipefail
 
 . $(dirname $0)/libtest.sh
 
+skip_without_user_xattrs
+
 setup_fake_remote_repo1 "archive-z2"
 
 echo '1..2'
diff --git a/tests/test-rofiles-fuse.sh b/tests/test-rofiles-fuse.sh
index 444fbce..ba45959 100755
--- a/tests/test-rofiles-fuse.sh
+++ b/tests/test-rofiles-fuse.sh
@@ -25,6 +25,9 @@ if ! fusermount --version >/dev/null 2>&1; then
 fi
 
 . $(dirname $0)/libtest.sh
+
+skip_without_user_xattrs
+
 setup_test_repository "bare-user"
 
 echo "1..5"


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