a5bd9f6
From 369b824667cc2a140e0efaccf480d43e07199d8d Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Fri, 12 Apr 2013 01:47:38 +0200
a5bd9f6
Subject: [PATCH 284/364] 	* tests/grub_cmd_date.in: New test for
a5bd9f6
 datetime.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog              |  4 ++++
a5bd9f6
 Makefile.util.def      |  6 ++++++
a5bd9f6
 tests/grub_cmd_date.in | 12 ++++++++++++
a5bd9f6
 3 files changed, 22 insertions(+)
a5bd9f6
 create mode 100644 tests/grub_cmd_date.in
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 0668a0f..a2f1d5a 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,5 +1,9 @@
a5bd9f6
 2013-04-12  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
+	* tests/grub_cmd_date.in: New test for datetime.
a5bd9f6
+
a5bd9f6
+2013-04-12  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
 	* tests/partmap_test.in: Fix missing qemudisk setting.
a5bd9f6
 
a5bd9f6
 2013-04-11  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
diff --git a/Makefile.util.def b/Makefile.util.def
a5bd9f6
index 373c25b..a231b40 100644
a5bd9f6
--- a/Makefile.util.def
a5bd9f6
+++ b/Makefile.util.def
a5bd9f6
@@ -676,6 +676,12 @@ script = {
a5bd9f6
 
a5bd9f6
 script = {
a5bd9f6
   testcase;
a5bd9f6
+  name = grub_cmd_date;
a5bd9f6
+  common = tests/grub_cmd_date.in;
a5bd9f6
+};
a5bd9f6
+
a5bd9f6
+script = {
a5bd9f6
+  testcase;
a5bd9f6
   name = grub_script_expansion;
a5bd9f6
   common = tests/grub_script_expansion.in;
a5bd9f6
 };
a5bd9f6
diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in
a5bd9f6
new file mode 100644
a5bd9f6
index 0000000..1c8e7e6
a5bd9f6
--- /dev/null
a5bd9f6
+++ b/tests/grub_cmd_date.in
a5bd9f6
@@ -0,0 +1,12 @@
a5bd9f6
+#! /bin/bash
a5bd9f6
+set -e
a5bd9f6
+
a5bd9f6
+pdt="$(date -u +%s)"
a5bd9f6
+dt=`echo date | @builddir@/grub-shell`
a5bd9f6
+dtg="$(date -u -d "$dt" +%s)"
a5bd9f6
+ndt="$(date -u +%s)"
a5bd9f6
+
a5bd9f6
+if [ $pdt -le $dtg ] && [ $dtg -le $ndt ]; then
a5bd9f6
+    exit 0;
a5bd9f6
+fi
a5bd9f6
+echo "Date not in range: $pdt <= $dtg <= $ndt"
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6