tests: Handle EPIPE failures when head terminates

When using musl, it appears that the default is line buffered output, so
when `head -1` reads from a pipe we have to handle the source end of the
pipe getting EPIPE.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
This commit is contained in:
Alex Kiernan 2019-10-31 11:30:00 +00:00
parent 4d17cd917f
commit fb519f0361
2 changed files with 3 additions and 3 deletions

View File

@ -177,7 +177,7 @@ if ! skip_one_without_user_xattrs; then
${CMD_PREFIX} ostree --repo=cacherepo pull-local ostree-srv/gnomerepo main
rev=$(ostree --repo=cacherepo rev-parse main)
${CMD_PREFIX} ostree --repo=cacherepo ls -R -C main > ls.txt
regfile_hash=$(grep -E -e '^-0' ls.txt | head -1 | awk '{ print $5 }')
regfile_hash=$((grep -E -e '^-0' ls.txt || true) | head -1 | awk '{ print $5 }')
${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false corruptrepo $(cat httpd-address)/ostree/corruptrepo
# Make this a loop so in the future we can add more object types like commit etc.
for object in ${regfile_hash}.file; do

View File

@ -47,12 +47,12 @@ setup_mirror content_mirror3
# Let's delete a file from 1 so that it falls back on 2
cd ${test_tmpdir}/content_mirror1/ostree/gnomerepo
filez=$(find objects/ -name '*.filez' | head -n 1)
filez=$((find objects/ -name '*.filez' || true) | head -n 1)
rm ${filez}
# Let's delete a file from 1 and 2 so that it falls back on 3
cd ${test_tmpdir}/content_mirror1/ostree/gnomerepo
filez=$(find objects/ -name '*.filez' | head -n 1)
filez=$((find objects/ -name '*.filez' || true) | head -n 1)
rm ${filez}
cd ${test_tmpdir}/content_mirror2/ostree/gnomerepo
rm ${filez}