From 3f9634e550265cddfcc27d979f9db3d4c24d01d7 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 30 Apr 2013 17:41:32 +0200 Subject: [PATCH] Add few more tests. --- ChangeLog | 4 + Makefile.util.def | 12 +++ tests/ahci_test.in | 3 +- tests/cdboot_test.in | 3 +- tests/core_compress_test.in | 2 +- tests/ehci_test.in | 3 +- tests/fddboot_test.in | 5 +- tests/grub_cmd_date.in | 17 +++- tests/grub_cmd_set_date.in | 35 ++++++++ tests/grub_cmd_sleep.in | 20 +++++ tests/hddboot_test.in | 3 +- tests/netboot_test.in | 3 +- tests/ohci_test.in | 3 +- tests/partmap_test.in | 160 +++++++++++++++++++++++++++++++++++- tests/pata_test.in | 3 +- tests/uhci_test.in | 3 +- tests/util/grub-shell.in | 6 +- 17 files changed, 265 insertions(+), 20 deletions(-) create mode 100644 tests/grub_cmd_set_date.in create mode 100644 tests/grub_cmd_sleep.in diff --git a/ChangeLog b/ChangeLog index b92445792..642858ce3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-30 Vladimir Serbinenko + + Add few more tests. + 2013-04-30 Vladimir Serbinenko * include/grub/arc/arc.h: Account for missing "other" peripheral on diff --git a/Makefile.util.def b/Makefile.util.def index 3cfc592dc..fbd37ebb6 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -700,6 +700,18 @@ script = { common = tests/grub_cmd_date.in; }; +script = { + testcase; + name = grub_cmd_set_date; + common = tests/grub_cmd_set_date.in; +}; + +script = { + testcase; + name = grub_cmd_sleep; + common = tests/grub_cmd_sleep.in; +}; + script = { testcase; name = grub_script_expansion; diff --git a/tests/ahci_test.in b/tests/ahci_test.in index fa5314c97..e7d26ac07 100644 --- a/tests/ahci_test.in +++ b/tests/ahci_test.in @@ -20,12 +20,13 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # PLATFORM: Don't mess with real devices when OS is active *-emu) exit 0;; # FIXME: qemu gets bonito DMA wrong mipsel-loongson) exit 0;; - # no AHCI on ARC and qemu-mips platforms + # PLATFORM: no AHCI on ARC and qemu-mips platforms mips*-arc | mips*-qemu_mips) exit 0;; # FIXME: No native drivers are available for those diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in index 097964f95..1cc901977 100644 --- a/tests/cdboot_test.in +++ b/tests/cdboot_test.in @@ -20,9 +20,10 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # PLATFORM: emu is different *-emu) exit 0;; - # Flash targets + # PLATFORM: Flash targets i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) exit 0;; # FIXME: currently grub-shell uses only -kernel for loongson diff --git a/tests/core_compress_test.in b/tests/core_compress_test.in index bd57f6f56..f97c0240b 100644 --- a/tests/core_compress_test.in +++ b/tests/core_compress_test.in @@ -19,8 +19,8 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" -# FIXME: Only mips currently supports configurable core compression case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # FIXME: Only mips currently supports configurable core compression *-emu | i386-* | x86_64-* | sparc64-* | ia64-*) exit 0 ;; diff --git a/tests/ehci_test.in b/tests/ehci_test.in index d9999f8e6..5cfe726df 100644 --- a/tests/ehci_test.in +++ b/tests/ehci_test.in @@ -20,12 +20,13 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # PLATFORM: Don't mess with real devices when OS is active *-emu) exit 0;; # FIXME: qemu gets bonito DMA wrong mipsel-loongson) exit 0;; - # no USB on ARC and qemu-mips platforms + # PLATFORM: no USB on ARC and qemu-mips platforms mips*-arc | mips*-qemu_mips) exit 0;; # FIXME: No native drivers are available for those diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in index 0866fdc8e..a05eb3e75 100644 --- a/tests/fddboot_test.in +++ b/tests/fddboot_test.in @@ -20,9 +20,10 @@ grubshell=@builddir@/grub-shell . "@builddir@/grub-core/modinfo.sh" case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in + # PLATFORM: emu is different *-emu) exit 0;; - # Flash targets + # PLATFORM: Flash targets i386-qemu | i386-coreboot | mips-qemu_mips | mipsel-qemu_mips) exit 0;; # FIXME: currently grub-shell uses only -kernel for loongson @@ -40,7 +41,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in # FIXME: QEMU doesn't emulate SCSI floppies mipsel-arc | mips-arc) exit 0;; - # powerpc doesn't boot from floppy except OldWorld Macs which we don't support anyway + # PLATFORM: powerpc doesn't boot from floppy except OldWorld Macs which we don't support anyway powerpc-ieee1275) exit 0;; esac diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in index 0417c67ef..a459353e8 100644 --- a/tests/grub_cmd_date.in +++ b/tests/grub_cmd_date.in @@ -13,8 +13,17 @@ 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; +if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then + echo "Date not in range: $pdt <= $dtg <= $ndt" + exit 1 +fi + +pdt="$(date -u +%s)" +dt=`echo 'insmod datehook; echo $YEAR-$MONTH-$DAY $HOUR:$MINUTE:$SECOND' | @builddir@/grub-shell` +dtg="$(date -u -d "$dt" +%s)" +ndt="$(date -u +%s)" + +if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then + echo "Date not in range: $pdt <= $dtg <= $ndt" + exit 1 fi -echo "Date not in range: $pdt <= $dtg <= $ndt" -exit 1 diff --git a/tests/grub_cmd_set_date.in b/tests/grub_cmd_set_date.in new file mode 100644 index 000000000..c594ae3fc --- /dev/null +++ b/tests/grub_cmd_set_date.in @@ -0,0 +1,35 @@ +#! /bin/bash +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 <