[tip:tools/kvm] kvm tools: Add boot test to checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  3747b1ae432e871e31578d781ad8cb83746c5bb9
Gitweb:     http://git.kernel.org/tip/3747b1ae432e871e31578d781ad8cb83746c5bb9
Author:     Sasha Levin <levinsasha928@xxxxxxxxx>
AuthorDate: Fri, 13 May 2011 18:39:12 +0300
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Sat, 14 May 2011 15:00:06 +0300

kvm tools: Add boot test to checks

'make check' will now try booting a kernel and will exit
gracefully once the kernel has finished loading.

Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/.gitignore          |    2 ++
 tools/kvm/Makefile            |    3 +++
 tools/kvm/tests/Makefile      |    7 ++++++-
 tools/kvm/tests/boot/Makefile |   13 +++++++++++++
 tools/kvm/tests/boot/init.c   |   11 +++++++++++
 5 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/tools/kvm/.gitignore b/tools/kvm/.gitignore
index 197ccb7..12c9e48 100644
--- a/tools/kvm/.gitignore
+++ b/tools/kvm/.gitignore
@@ -4,3 +4,5 @@
 .cscope
 tags
 include/common-cmds.h
+tests/boot/boot_test.iso
+tests/boot/rootfs/
diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile
index 1aaed24..64fdcbe 100644
--- a/tools/kvm/Makefile
+++ b/tools/kvm/Makefile
@@ -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
diff --git a/tools/kvm/tests/Makefile b/tools/kvm/tests/Makefile
index 94b411d..cad14ec 100644
--- a/tools/kvm/tests/Makefile
+++ b/tools/kvm/tests/Makefile
@@ -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
index 0000000..40cba68
--- /dev/null
+++ b/tools/kvm/tests/boot/Makefile
@@ -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
index 0000000..094f8ba
--- /dev/null
+++ b/tools/kvm/tests/boot/init.c
@@ -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;
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux