grub/tests/test_sha512sum.in
Leo Sandoval cdbc6ffbb8 tests: Increase verbosity in *_test.in checks
In this case it does not hurt to increase bash execution verbosity so
we can get more insight in case of issues.

Signed-off-by: Leo Sandoval <lsandova@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2025-11-06 20:50:54 +01:00

38 lines
847 B
Plaintext

#! @BUILD_SHEBANG@
set -ex
# create a randome file
file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
cat >$file <<EOF
hello world!
EOF
. "@builddir@/grub-core/modinfo.sh"
if [ x"${grub_modinfo_platform}" = xemu ]; then
grub_file="(host)$file"
else
grub_file="/boot/grub/file"
fi
outfile1="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
@builddir@/grub-shell --files=/boot/grub/file=$file >$outfile1 <<EOF
sha512sum $grub_file
EOF
outfile2="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
sha512sum $file >$outfile2
SHA1=`cat $outfile1 | tr -d '\n' | cut -f1 -d\ `
SHA2=`cat $outfile2 | cut -f1 -d\ `
if test "$SHA1" = "$SHA2"; then
rm -f ${outfile1} ${outfile2}
exit 0
else
echo "GRUB sha512sum output did not match sha512sum output."
echo "See diff -u ${outfile1} ${outfile2}"
exit 1
fi