From 7994a09a9b705832a5326a0c42f197b3110f3ada Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 26 Oct 2013 14:35:35 +0200 Subject: [PATCH] * tests/test_sha512sum.in: New test. --- ChangeLog | 4 ++++ Makefile.util.def | 6 ++++++ tests/test_sha512sum.in | 27 +++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 tests/test_sha512sum.in diff --git a/ChangeLog b/ChangeLog index 1b4f29d65..0c3856218 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-10-26 BVK Chaitanya + + * tests/test_sha512sum.in: New test. + 2013-10-26 Vladimir Serbinenko * grub-core/fs/iso9660.c: Replace strncat with memcpy. diff --git a/Makefile.util.def b/Makefile.util.def index cdeb733f4..15f28a0ec 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -857,6 +857,12 @@ script = { common = tests/grub_script_strcmp.in; }; +script = { + testcase; + name = test_sha512sum; + common = tests/test_sha512sum.in; +}; + script = { testcase; name = grub_func_test; diff --git a/tests/test_sha512sum.in b/tests/test_sha512sum.in new file mode 100644 index 000000000..9108db5e5 --- /dev/null +++ b/tests/test_sha512sum.in @@ -0,0 +1,27 @@ +#! /bin/bash + +# create a randome file +file=`mktemp` +cat >$file <$outfile1 <$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 -- 2.47.2