tests: Avoid generating lots of output in itest-payload-link

We noticed this in a recent PR.  While I'm here, also only do
the `find` once, add `-type l` for good measure, and use our
built in `libtest.sh` assertion functions.

Closes: #1494
Approved by: giuseppe
This commit is contained in:
Colin Walters 2018-03-12 18:02:04 -04:00 committed by Atomic Bot
parent 591f8a68b1
commit 79fc506284

View File

@ -68,18 +68,17 @@ if cp --reflink a b; then
ostree config --repo=repo set core.payload-link-threshold 0
ostree --repo=repo remote add origin --set=gpg-verify=false ${origin}
ostree --repo=repo pull --disable-static-deltas origin ${host_nonremoteref}
if test `find repo -name '*.payload-link' | wc -l` = 0; then
fatal ".payload-link files not found"
fi
find repo -type l -name '*.payload-link' >payload-links.txt
assert_not_streq "$(wc -l < payload-links.txt)" "0"
find repo -name '*.payload-link' | while read i;
do
# Disable logging for inner loop, otherwise it'd be enormous
set +x
cat payload-links.txt | while read i; do
payload_checksum=$(basename $(dirname $i))$(basename $i .payload-link)
payload_checksum_calculated=$(sha256sum $(readlink -f $i) | cut -d ' ' -f 1)
if test $payload_checksum != $payload_checksum_calculated; then
fatal ".payload-link has the wrong checksum"
fi
assert_streq "${payload_checksum}" "${payload_checksum_calculated}"
done
set -x
echo "ok pull creates .payload-link"
else
echo "ok # SKIP no reflink support in the file system"