diff --git a/ChangeLog b/ChangeLog index a87c472b6..546cddcc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2012-06-15 Vladimir Serbinenko + + Add loongson tests. + + * tests/util/grub-shell.in: Handle loongson. + * tests/partmap_test.in: Add loongson to the list of platform using ATA + drivers. + * grub-core/tests/boot/linux.init-mips.S (SHUTDOWN_MAGIC3) [REBOOT]: + Reboot instead of shutdown if REBOOT is defined. + 2012-06-15 Vladimir Serbinenko * grub-core/lib/mips/loongson/reboot.c (grub_reboot): Use 32-bit diff --git a/Makefile.am b/Makefile.am index 391cd19bb..db9e930ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -168,6 +168,9 @@ linux.init.ppc: $(srcdir)/grub-core/tests/boot/linux.init-ppc.S linux.init.mipsel: $(srcdir)/grub-core/tests/boot/linux.init-mips.S $(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" +linux.init.loongson: $(srcdir)/grub-core/tests/boot/linux.init-mips.S + $(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -DREBOOT=1 + multiboot.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S $(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -DTARGET_MULTIBOOT=1 -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include @@ -219,6 +222,9 @@ linux-initramfs.ppc: linux.init.ppc Makefile linux-initramfs.mipsel: linux.init.mipsel Makefile TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR +linux-initramfs.loongson: linux.init.loongson Makefile + TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR + linux-initramfs.i386: linux.init.i386 Makefile TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR @@ -288,13 +294,16 @@ bootcheck-linux-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux-mips: linux-initramfs.mips $(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-mips --files=/initrd=linux-initramfs.mips --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.mips --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux-ppc: linux-initramfs.ppc $(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-ppc --files=/initrd=linux-initramfs.ppc --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux-ppc.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.ppc --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux-ppc.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux-mipsel: linux-initramfs.mipsel $(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell - timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-mipsel --files=/initrd=linux-initramfs.mipsel --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.mipsel --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null + +bootcheck-linux-loongson: linux-initramfs.loongson $(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell + timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.loongson --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null bootcheck-linux16-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null @@ -349,12 +358,20 @@ if COND_i386_pc BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386 bootcheck-pc-chainloader bootcheck-ntldr bootcheck-linux16-i386 bootcheck-linux16-x86_64 bootcheck-knetbsd-i386 endif +if COND_mips_loongson +BOOTCHECKS = bootcheck-linux-loongson +endif + if COND_mipsel +if COND_mips_qemu_mips BOOTCHECKS = bootcheck-linux-mipsel endif +endif if COND_mipseb +if COND_mips_qemu_mips BOOTCHECKS = bootcheck-linux-mips endif +endif if COND_powerpc_ieee1275 BOOTCHECKS = bootcheck-linux-ppc diff --git a/grub-core/tests/boot/linux.init-mips.S b/grub-core/tests/boot/linux.init-mips.S index 731f38130..5ef4c3794 100644 --- a/grub-core/tests/boot/linux.init-mips.S +++ b/grub-core/tests/boot/linux.init-mips.S @@ -23,8 +23,11 @@ #define STDOUT 1 #define SHUTDOWN_MAGIC1 0xfee1dead #define SHUTDOWN_MAGIC2 0x28121969 +#ifdef REBOOT +#define SHUTDOWN_MAGIC3 0x01234567 +#else #define SHUTDOWN_MAGIC3 0x4321fedc - +#endif .text .global start, _start, __start __start: diff --git a/tests/partmap_test.in b/tests/partmap_test.in index 1eb2868b9..150722026 100644 --- a/tests/partmap_test.in +++ b/tests/partmap_test.in @@ -56,7 +56,7 @@ list_parts () { } case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in - mips-qemu_mips | mipsel-qemu_mips | i386-qemu | i386-multiboot | i386-coreboot) + mips-qemu_mips | mipsel-qemu_mips | i386-qemu | i386-multiboot | i386-coreboot | mipsel-loongson) disk=ata0 ;; powerpc-ieee1275) diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index a1bf084d1..25a7e8d1f 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -61,6 +61,7 @@ EOF qemuopts="${GRUB_QEMU_OPTS}" serial_port=com0 serial_null= +hald_cmd=halt case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in powerpc-ieee1275) boot=cd @@ -82,6 +83,14 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in qemuopts="$qemuopts -M mips" console=vga_text ;; + mipsel-loongson) + boot=mipsel_fulong2e + qemu=qemu-system-mips64el + qemuopts="$qemuopts -no-reboot -M fulong2e" + console= + halt_cmd=reboot + trim=1 + ;; i386-coreboot) boot=coreboot qemu=qemu-system-i386 @@ -157,7 +166,8 @@ for option in "$@"; do elif [ "$dev" = "qemu" ] ; then boot=qemu; elif [ "$dev" = "coreboot" ] ; then boot=coreboot; elif [ "$dev" = "mips_qemu" ] ; then boot=mips_qemu; - elif [ "$dev" = "mipsel_qemu" ] ; then boot=mips_qemu; + elif [ "$dev" = "mipsel_qemu" ] ; then boot=mipsel_qemu; + elif [ "$dev" = "mipsel_fulong2e" ] ; then boot=mipsel_fulong2e; else echo "Unrecognized boot method \`$dev'" 1>&2 usage @@ -211,9 +221,11 @@ done cat <>${cfgfile} source /boot/grub/testcase.cfg # Stop serial output to suppress "ACPI shutdown failed" error. -terminal_output $console -halt EOF +if [ x$console != x ]; then + echo "terminal_output $console" >>${cfgfile} +fi +echo "$halt_cmd" >>${cfgfile} isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 if [ x$boot != xnet ]; then @@ -245,6 +257,11 @@ if [ x$boot = xmipsel_qemu ]; then device=cdrom fi +if [ x$boot = xmipsel_fulong2e ]; then + bootdev="-kernel ${rom_directory}/mipsel-loongson.elf -append machtype=lemote-fuloong-2e" + device=cdrom +fi + if [ x$boot = xmips_qemu ]; then bootdev="-kernel ${rom_directory}/mips-qemu_mips.elf" device=cdrom