tests: Use skip_without_ostree_feature to detect libarchive, composefs
authorSimon McVittie <smcv@collabora.com>
Mon, 19 Feb 2024 16:07:13 +0000 (16:07 +0000)
committerSimon McVittie <smcv@collabora.com>
Mon, 19 Feb 2024 21:01:07 +0000 (21:01 +0000)
This avoids false negatives from `ostree --version | grep -q ...`
exiting with failure under `set -o pipefail` because `grep -q` can exit
as soon as it sees the desired string, leaving `ostree --version` to be
terminated by `SIGPIPE` next time it writes to stdout.

Signed-off-by: Simon McVittie <smcv@collabora.com>
tests/test-composefs.sh
tests/test-export.sh
tests/test-libarchive.sh

index d05579f5f72b3c0df8eae3f3101e8a8f94959f1d..f0f5cac116c1e01f94304540730f576409fbcd34 100755 (executable)
@@ -19,11 +19,7 @@ set -euo pipefail
 
 . $(dirname $0)/libtest.sh
 
-if ! ${CMD_PREFIX} ostree --version | grep -q -e '- composefs'; then
-    echo "1..0 #SKIP no composefs support compiled in"
-    exit 0
-fi
-
+skip_without_ostree_feature composefs
 skip_without_user_xattrs
 
 setup_test_repository "bare-user"
index 6b8de94c4ce068dccb15359d5ab8f0cdbe9f2f75..23e51666d09869b4b065f9bd840a38d521d770d0 100755 (executable)
 
 set -euo pipefail
 
-if ! ostree --version | grep -q -e '- libarchive'; then
-    echo "1..0 #SKIP no libarchive support compiled in"
-    exit 0
-fi
-
 . $(dirname $0)/libtest.sh
 
+skip_without_ostree_feature libarchive
 setup_test_repository "archive"
 
 echo '1..6'
index 631750233c147c79201cf9eafc10032b4a8ae205..d9ce37b29dee64b5657c513bb2e6a341fff74801 100755 (executable)
 
 set -euo pipefail
 
-if ! ostree --version | grep -q -e '- libarchive'; then
-    echo "1..0 #SKIP no libarchive support compiled in"
-    exit 0
-fi
-
 . $(dirname $0)/libtest.sh
 
+skip_without_ostree_feature libarchive
+
 echo "1..18"
 
 setup_test_repository "bare"