summaryrefslogtreecommitdiffstats
path: root/tests/grub_cmd_set_date.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:29:51 +0000
commit6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e (patch)
tree32451fa3cdd9321fb2591fada9891b2cb70a9cd1 /tests/grub_cmd_set_date.in
parentInitial commit. (diff)
downloadgrub2-6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e.tar.xz
grub2-6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e.zip
Adding upstream version 2.06.upstream/2.06upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/grub_cmd_set_date.in')
-rw-r--r--tests/grub_cmd_set_date.in35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/grub_cmd_set_date.in b/tests/grub_cmd_set_date.in
new file mode 100644
index 0000000..aac120a
--- /dev/null
+++ b/tests/grub_cmd_set_date.in
@@ -0,0 +1,35 @@
+#! @BUILD_SHEBANG@
+set -e
+
+. "@builddir@/grub-core/modinfo.sh"
+
+case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
+ # FIXME: OpenBIOS on sparc64 doesn't implement RTC
+ sparc64-ieee1275)
+ exit 0;;
+ # PLATFORM: ARC doesn't provide any way to set time
+ *-arc)
+ exit 0;;
+ # PLATFORM: EMU doesn't provide any way to set time
+ # Even if it did we'd need some kind of sandbox to avoid
+ # modifying real system time.
+ *-emu)
+ exit 0;;
+esac
+
+out=$(cat <<EOF | @builddir@/grub-shell
+insmod datehook
+date
+if [ \$YEAR = 2004 -a \$MONTH = 4 -a \$DAY = 4 -a \$HOUR = 20 -a \$MINUTE = 47 ]; then
+ hello
+ halt
+fi
+date 2004-04-04 20:47:00
+reboot
+EOF
+)
+
+if [ "$(echo "$out" | tail -n 1)" != "Hello World" ]; then
+ echo "Test failed: $out"
+ exit 1
+fi