vaseboot/tests/test_sha512sum.in

37 lines
866 B
Bash

#! /bin/bash
# create a randome file
file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
cat >$file <<EOF
hello world!
EOF
. "@builddir@/VasEBoot-core/modinfo.sh"
if [ x"${VasEBoot_modinfo_platform}" = xemu ]; then
VasEBoot_file="(host)$file"
else
VasEBoot_file="/boot/VasEBoot/file"
fi
outfile1="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
@builddir@/VasEBoot-shell --files=/boot/VasEBoot/file=$file >$outfile1 <<EOF
sha512sum $VasEBoot_file
EOF
outfile2="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
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 "VasEBoot sha512sum output did not match sha512sum output."
echo "See diff -u ${outfile1} ${outfile2}"
exit 1
fi