]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Add boot test to checks
authorSasha Levin <levinsasha928@gmail.com>
Fri, 13 May 2011 15:39:12 +0000 (18:39 +0300)
committerPekka Enberg <penberg@kernel.org>
Sat, 14 May 2011 12:00:06 +0000 (15:00 +0300)
'make check' will now try booting a kernel and will exit
gracefully once the kernel has finished loading.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/.gitignore
tools/kvm/Makefile
tools/kvm/tests/Makefile
tools/kvm/tests/boot/Makefile [new file with mode: 0644]
tools/kvm/tests/boot/init.c [new file with mode: 0644]

index 197ccb7e53253bd37c2027759fabd2f9306d8b89..12c9e48067ce3adea1440601e8b6e7d1e66e066b 100644 (file)
@@ -4,3 +4,5 @@
 .cscope
 tags
 include/common-cmds.h
+tests/boot/boot_test.iso
+tests/boot/rootfs/
index 1aaed24489a547ca6b54458a19340eef0cdc386c..64fdcbee21611b749732f0e446398d7704ea667d 100644 (file)
@@ -148,6 +148,7 @@ bios/bios-rom.bin: bios/bios-rom.S bios/e820.c
 check: $(PROGRAM)
        $(MAKE) -C tests
        ./$(PROGRAM) run tests/pit/tick.bin
+       ./$(PROGRAM) run -d tests/boot/boot_test.iso -p "init=init"
 .PHONY: check
 
 clean:
@@ -156,6 +157,8 @@ clean:
        $(Q) rm -f bios/*.elf
        $(Q) rm -f bios/*.o
        $(Q) rm -f bios/bios-rom.h
+       $(Q) rm -f tests/boot/boot_test.iso
+       $(Q) rm -rf tests/boot/rootfs/
        $(Q) rm -f $(DEPS) $(OBJS) $(PROGRAM)
        $(Q) rm -f cscope.*
        $(Q) rm -f $(KVM_INCLUDE)/common-cmds.h
index 94b411d8deafb596afa8c3cb0f4655d54b0c5391..cad14ecbae1b1df216ab872308388370af11f5c2 100644 (file)
@@ -1,4 +1,4 @@
-all: kernel pit
+all: kernel pit boot
 
 kernel:
        $(MAKE) -C kernel
@@ -8,7 +8,12 @@ pit:
        $(MAKE) -C pit
 .PHONY: pit
 
+boot:
+       $(MAKE) -C boot
+.PHONY: boot
+
 clean:
        $(MAKE) -C kernel clean
        $(MAKE) -C pit clean
+       $(MAKE) -C boot clean
 .PHONY: clean
diff --git a/tools/kvm/tests/boot/Makefile b/tools/kvm/tests/boot/Makefile
new file mode 100644 (file)
index 0000000..40cba68
--- /dev/null
@@ -0,0 +1,13 @@
+NAME   := init
+
+OBJ    := $(NAME).o
+
+all: $(.o)
+       rm -rf rootfs
+       mkdir rootfs
+       gcc -static init.c -o rootfs/init
+       mkisofs rootfs > boot_test.iso
+
+clean:
+       rm -rf rootfs boot_test.iso
+.PHONY: clean
diff --git a/tools/kvm/tests/boot/init.c b/tools/kvm/tests/boot/init.c
new file mode 100644 (file)
index 0000000..094f8ba
--- /dev/null
@@ -0,0 +1,11 @@
+#include <linux/reboot.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[])
+{
+       puts("hello, KVM guest!\r");
+
+       reboot(LINUX_REBOOT_CMD_RESTART);
+
+       return 0;
+}