Add a test for mkimage

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2017-05-25 10:25:27 +01:00
parent b46084695f
commit 4faf0c86bc
3 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,26 @@
kernel:
image: "linuxkit/kernel:4.9.x"
cmdline: "console=ttyS0"
init:
- linuxkit/init:cbd7ae748f0a082516501a3e914fa0c924ee941e
- linuxkit/runc:24dfe632ed3ff53a026ee3fac046fd544434e2d6
- linuxkit/containerd:f1130450206d4f64f0ddc13d15bb68435aa1ff61
onboot:
- name: mkimage
image: "linuxkit/mkimage:8bb18fe306afaca9ba50fe3148ec12570586c2a6"
- name: poweroff
image: "linuxkit/poweroff:a8f1e4ad8d459f1fdaad9e4b007512cb3b504ae8"
files:
- path: data/kernel
source: run-kernel
- path: data/initrd.img
source: run-initrd.img
- path: data/cmdline
source: run-cmdline
trust:
image:
- linuxkit/kernel
- linuxkit/binfmt
- linuxkit/rngd
outputs:
- format: kernel+initrd

View File

@ -0,0 +1,18 @@
kernel:
image: "linuxkit/kernel:4.9.x"
cmdline: "console=ttyS0"
init:
- linuxkit/init:cbd7ae748f0a082516501a3e914fa0c924ee941e
- linuxkit/runc:24dfe632ed3ff53a026ee3fac046fd544434e2d6
- linuxkit/containerd:1c71f95fa36040ea7e987deb98a7a2a363853f01
- linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4
onboot:
- name: poweroff
image: "linuxkit/poweroff:a8f1e4ad8d459f1fdaad9e4b007512cb3b504ae8"
trust:
image:
- linuxkit/kernel
- linuxkit/binfmt
- linuxkit/rngd
outputs:
- format: kernel+initrd

View File

@ -0,0 +1,25 @@
#!/bin/sh
# SUMMARY: Test the mkimage container by using it to build a bootable qcow2
# LABELS:
# REPEAT:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
clean_up() {
find . -iname "run*" -not -iname "*.yml" -exec rm -rf {} \;
find . -iname "mkimage*" -not -iname "*.yml" -exec rm -rf {} \;
rm -f disk.qcow2
}
trap clean_up EXIT
# Test code goes here
moby build run.yml
moby build mkimage.yml
linuxkit run qemu -disk-size 200 -disk-format qcow2 -disk disk.qcow2 -kernel mkimage
linuxkit run qemu disk.qcow2
exit 0