Clean up of Qemu run

For all output formats except kernel+initrd, you must use the full path of
the file they want to run. Make the options auto detect.

Split the uefi option to mean "use uefi firmware" not be ISO specific.

Allow specifying a bootable disk image, so we can test disk image output
formats with qemu too.

Add a test case for qcow2 boot under qemu.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack
2017-05-22 17:43:43 +01:00
parent 6b937b37d5
commit 838d845003
8 changed files with 97 additions and 36 deletions

View File

@@ -23,5 +23,5 @@ moby build -name "${NAME}" test.yml
[ -f "${NAME}-kernel" ] || exit 1
[ -f "${NAME}-initrd.img" ] || exit 1
[ -f "${NAME}-cmdline" ]|| exit 1
linuxkit run qemu "${NAME}" | grep -q "Welcome to LinuxKit"
linuxkit run qemu -kernel "${NAME}" | grep -q "Welcome to LinuxKit"
exit 0

View File

@@ -20,5 +20,5 @@ trap clean_up EXIT
moby build -name "${NAME}" test.yml
[ -f "${NAME}.iso" ] || exit 1
linuxkit run qemu -iso "${NAME}" | grep -q "Welcome to LinuxKit"
linuxkit run qemu -iso "${NAME}.iso" | grep -q "Welcome to LinuxKit"
exit 0

View File

@@ -27,5 +27,5 @@ fi
moby build -name "${NAME}" test.yml
[ -f "${NAME}-efi.iso" ] || exit 1
linuxkit run qemu -uefi "${NAME}" | grep -q "Welcome to LinuxKit"
linuxkit run qemu -iso -uefi "${NAME}-efi.iso" | grep -q "Welcome to LinuxKit"
exit 0

View File

@@ -0,0 +1,25 @@
#!/bin/sh
# SUMMARY: Check that qcow2 image boots in qemu
# LABELS:
# AUTHOR: Dave Tucker <dt@docker.com>
# AUTHOR: Justin Cormack <justin.cormack@docker.com>
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=qemu-qcow2
clean_up() {
# remove any files, containers, images etc
rm -rf ${NAME}* || true
}
trap clean_up EXIT
moby build -name "${NAME}" test.yml
[ -f "${NAME}.qcow2" ] || exit 1
linuxkit run qemu -disk-format qcow2 "${NAME}.qcow2" | grep -q "Welcome to LinuxKit"
exit 0

View File

@@ -0,0 +1,16 @@
kernel:
image: "linuxkit/kernel:4.9.x"
cmdline: "console=ttyS0 console=tty0 page_poison=1"
init:
- linuxkit/init:f71c3b30ac1ba4ef16c160c89610fa4976f9752f
- linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9
- linuxkit/containerd:60e2486a74c665ba4df57e561729aec20758daed
onboot:
- name: poweroff
image: "linuxkit/poweroff:a8f1e4ad8d459f1fdaad9e4b007512cb3b504ae8"
command: ["/bin/sh", "/poweroff.sh", "10"]
trust:
image:
- linuxkit/kernel
outputs:
- format: qcow2

View File

@@ -17,7 +17,7 @@ trap clean_up EXIT
# Test code goes here
moby build test-kernel-config
RESULT="$(linuxkit run qemu test-kernel-config)"
RESULT="$(linuxkit run qemu -kernel test-kernel-config)"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@@ -17,7 +17,7 @@ trap clean_up EXIT
# Test code goes here
moby build test-sysctl
RESULT="$(linuxkit run qemu test-sysctl)"
RESULT="$(linuxkit run qemu -kernel test-sysctl)"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0