File: grub_cmd_set_date.in

package info (click to toggle)
grub2 2.14~git20250718.0e36779-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 60,688 kB
  • sloc: ansic: 541,811; asm: 68,074; sh: 9,803; cpp: 2,095; makefile: 1,895; python: 1,518; sed: 446; lex: 393; yacc: 268; awk: 85; lisp: 54; perl: 31
file content (38 lines) | stat: -rw-r--r-- 811 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! @BUILD_SHEBANG@
set -e

echo "Skipping flaky test."
exit 77

. "@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 77;;
    # PLATFORM: ARC doesn't provide any way to set time
    *-arc)
	exit 77;;
    # 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 77;;
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