From e5f7fbe52707aea61059a0197ac32835b4852e65 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 19 Feb 2024 16:07:13 +0000 Subject: [PATCH] tests: Use skip_without_ostree_feature to detect libarchive, composefs 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 Forwarded: https://github.com/ostreedev/ostree/pull/3184 Gbp-Pq: Name tests-Use-skip_without_ostree_feature-to-detect-libarchiv.patch --- tests/test-composefs.sh | 6 +----- tests/test-export.sh | 6 +----- tests/test-libarchive.sh | 7 ++----- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/tests/test-composefs.sh b/tests/test-composefs.sh index d05579f5f..f0f5cac11 100755 --- a/tests/test-composefs.sh +++ b/tests/test-composefs.sh @@ -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" diff --git a/tests/test-export.sh b/tests/test-export.sh index 6b8de94c4..23e51666d 100755 --- a/tests/test-export.sh +++ b/tests/test-export.sh @@ -19,13 +19,9 @@ 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' diff --git a/tests/test-libarchive.sh b/tests/test-libarchive.sh index 631750233..d9ce37b29 100755 --- a/tests/test-libarchive.sh +++ b/tests/test-libarchive.sh @@ -19,13 +19,10 @@ 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"