Skip to content

Commit

Permalink
tests: Use skip_without_ostree_feature to detect libarchive, composefs
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
smcv committed Feb 19, 2024
1 parent a84e56d commit 37466ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
6 changes: 1 addition & 5 deletions tests/test-composefs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 1 addition & 5 deletions tests/test-export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 2 additions & 5 deletions tests/test-libarchive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 37466ec

Please sign in to comment.