nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0285-tests-grub_cmd_date.in-New-test-for-datetime.patch

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