From: Vladimir 'phcoder' Serbinenko Date: Thu, 11 Apr 2013 23:47:38 +0000 (+0200) Subject: * tests/grub_cmd_date.in: New test for datetime. X-Git-Tag: grub-2.02-beta1~1178 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e3734b84cf57d60196cdf126738c98dfaca1f92d;p=thirdparty%2Fgrub.git * tests/grub_cmd_date.in: New test for datetime. --- diff --git a/ChangeLog b/ChangeLog index 0668a0f13..a2f1d5af7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Vladimir Serbinenko + + * tests/grub_cmd_date.in: New test for datetime. + 2013-04-12 Vladimir Serbinenko * tests/partmap_test.in: Fix missing qemudisk setting. diff --git a/Makefile.util.def b/Makefile.util.def index 373c25b8b..a231b401e 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -674,6 +674,12 @@ script = { common = tests/grub_cmd_regexp.in; }; +script = { + testcase; + name = grub_cmd_date; + common = tests/grub_cmd_date.in; +}; + script = { testcase; name = grub_script_expansion; diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in new file mode 100644 index 000000000..1c8e7e667 --- /dev/null +++ b/tests/grub_cmd_date.in @@ -0,0 +1,12 @@ +#! /bin/bash +set -e + +pdt="$(date -u +%s)" +dt=`echo date | @builddir@/grub-shell` +dtg="$(date -u -d "$dt" +%s)" +ndt="$(date -u +%s)" + +if [ $pdt -le $dtg ] && [ $dtg -le $ndt ]; then + exit 0; +fi +echo "Date not in range: $pdt <= $dtg <= $ndt"