tests: Unify test YAML files to test.yml

While at it also unify the clean-up code and other bits in test.sh

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-09-17 15:20:48 +01:00
parent 6842f10351
commit 4541e8511a
23 changed files with 50 additions and 33 deletions

View File

@ -9,14 +9,16 @@ set -e
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=kconfig
clean_up() {
find . -depth -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
moby build -format kernel+initrd test-kernel-config.yml
RESULT="$(linuxkit run test-kernel-config)"
moby build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run ${NAME})"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@ -9,14 +9,16 @@ set -e
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=kconfig
clean_up() {
find . -depth -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
moby build -format kernel+initrd test-kernel-config.yml
RESULT="$(linuxkit run test-kernel-config)"
moby build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run ${NAME})"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@ -9,14 +9,16 @@ set -e
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=kconfig
clean_up() {
find . -depth -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
moby build -format kernel+initrd test-kernel-config.yml
RESULT="$(linuxkit run test-kernel-config)"
moby build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run ${NAME})"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@ -9,11 +9,12 @@ set -e
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
IMAGE_NAME="kmod-test"
NAME=kmod
IMAGE_NAME=kmod-test
clean_up() {
docker rmi ${IMAGE_NAME} || true
find . -depth -iname "kmod*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf ${NAME}-*
}
trap clean_up EXIT
@ -23,8 +24,8 @@ docker pull linuxkit/kernel:4.9.50
docker build -t ${IMAGE_NAME} .
# Build and run a LinuxKit image with kernel module (and test script)
moby build -format kernel+initrd kmod.yml
RESULT="$(linuxkit run kmod)"
moby build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run ${NAME})"
echo "${RESULT}" | grep -q "Hello LinuxKit"
exit 0

View File

@ -8,15 +8,16 @@ set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=binfmt
clean_up() {
find . -depth -iname "test-binfmt*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
moby build -format kernel+initrd test-binfmt.yml
RESULT="$(linuxkit run test-binfmt)"
moby build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run ${NAME})"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"

View File

@ -8,15 +8,16 @@ set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=ca-certificates
clean_up() {
find . -depth -iname "test-ca-certificates*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
moby build -format kernel+initrd test-ca-certificates.yml
RESULT="$(linuxkit run test-ca-certificates)"
moby build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run $NAME)"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"

View File

@ -9,14 +9,16 @@ set -e
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=containerd
clean_up() {
find . -depth -iname "test-containerd*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
moby build test-containerd.yml
RESULT="$(linuxkit run -mem 2048 -disk size=2G test-containerd)"
moby build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run -mem 2048 -disk size=2G ${NAME})"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@ -9,14 +9,16 @@ set -e
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=dhcpcd
clean_up() {
find . -depth -iname "test-dhcpcd*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
moby build -format kernel+initrd test-dhcpcd.yml
RESULT="$(linuxkit run test-dhcpcd)"
moby build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run $NAME)"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"

View File

@ -12,11 +12,11 @@ set -e
NAME=test-ctr
clean_up() {
find . -depth -iname "test-ctr*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf ${NAME}-*
}
trap clean_up EXIT
moby build "${NAME}.yml"
moby build -format kernel+initrd -name "${NAME}" test.yml
[ -f "${NAME}-kernel" ] || exit 1
[ -f "${NAME}-initrd.img" ] || exit 1
[ -f "${NAME}-cmdline" ]|| exit 1

View File

@ -9,14 +9,16 @@ set -e
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=sysctl
clean_up() {
find . -depth -iname "test-sysctl*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
moby build -format kernel+initrd test-sysctl.yml
RESULT="$(linuxkit run test-sysctl)"
moby build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run ${NAME})"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"

View File

@ -9,14 +9,16 @@ set -e
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=wireguard
clean_up() {
find . -depth -iname "test-wireguard*" -not -iname "*.yml" -exec rm -rf {} \;
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
moby build -format kernel+initrd test-wireguard.yml
RESULT="$(linuxkit run test-wireguard)"
moby build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run ${NAME})"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"