Initial test hooks

Beginning of a proper test suite, using qemu. Test just runs docker
for now, will add further integration tests.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2016-07-08 15:44:04 +01:00
parent b3cfed22f4
commit 44d68b268a
6 changed files with 45 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
test.log

6
Dockerfile.test Normal file
View File

@ -0,0 +1,6 @@
FROM justincormack/alpine-qemu
COPY alpine/initrd.img.gz .
COPY alpine/kernel/vmlinuz64 .
ENTRYPOINT [ "qemu-system-x86_64", "-serial", "stdio", "-kernel", "vmlinuz64", "-initrd", "initrd.img.gz", "-m", "1024", "-append", "earlyprintk=serial console=ttyS0 noapic mobytest=true", "-vnc", "none" ]

View File

@ -22,10 +22,14 @@ qemu-arm: Dockerfile.qemu.armhf arm
docker build -f Dockerfile.qemu.armhf -t mobyarmqemu:build .
docker run -it --rm mobyarmqemu:build
test: Dockerfile.test all
docker build -f Dockerfile.test -t mobytest:build .
docker run -it --rm mobytest:build | tee test.log | grep 'Moby test suite PASSED'
.PHONY: clean
clean:
$(MAKE) -C alpine clean
$(MAKE) -C xhyve clean
docker images -q mobyqemu:build | xargs docker rmi -f || true
docker images -q justincormack/remora | xargs docker rmi -f || true
docker images -q mobytest:build | xargs docker rmi -f || true

View File

@ -74,6 +74,8 @@ COPY packages/bootflag/bootflag /usr/bin
COPY packages/gummiboot/gummiboot.tar.gz /usr/share/src/
COPY packages/oom/etc /etc
COPY packages/9pmount-vsock/9pmount-vsock /sbin
COPY packages/test/etc /etc
COPY packages/test/mobytest /usr/bin
RUN \
rc-update add swap boot && \
@ -109,6 +111,7 @@ RUN \
rc-update add hv_kvp_daemon default && \
rc-update add hv_vss_daemon default && \
rc-update add oom default && \
rc-update add test default && \
true
# we do not need to restart syslog, as probably not running

View File

@ -0,0 +1,25 @@
#!/sbin/openrc-run
depend()
{
need docker
}
start()
{
cat /proc/cmdline | grep -q 'mobytest' || exit 0
ebegin "Running tests"
if mobytest
then
printf "Moby test suite PASSED\n"
else
printf "Moby test suite FAILED\n"
fi
eend "Tests completed"
# now terminate with extreme prejudice
poweroff -f
}

5
alpine/packages/test/mobytest Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
set -e
docker ps