]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* tests/grub_cmd_date.in: New test for datetime.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 11 Apr 2013 23:47:38 +0000 (01:47 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 11 Apr 2013 23:47:38 +0000 (01:47 +0200)
ChangeLog
Makefile.util.def
tests/grub_cmd_date.in [new file with mode: 0644]

index 0668a0f13ddf723f039940386b8fe81e1a12b73b..a2f1d5af7e7743e645829e9143b9822e664ecb7a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-04-12  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * tests/grub_cmd_date.in: New test for datetime.
+
 2013-04-12  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * tests/partmap_test.in: Fix missing qemudisk setting.
index 373c25b8bb84125cc41ccca0f2a4ebc71ff0421b..a231b401efcaee1166cefe847152bcf2f58f0baa 100644 (file)
@@ -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 (file)
index 0000000..1c8e7e6
--- /dev/null
@@ -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"