From e62e94a24030e35be0ae4d976e399a32645b0e67 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Fri, 19 May 2017 11:50:01 +0100 Subject: [PATCH] tests: Run config tests on all kernels we support - Add a test for the kernel config for each supported kernel - simplify YAML files: no need for ca certificates nor DHCP - Explicitly state that the kernel module tests are for the 4.9 kernel. Signed-off-by: Rolf Neugebauer --- .../000_config_4.4.x/test-kernel-config.yml | 16 +++++++++++++ .../{000_config => 000_config_4.4.x}/test.sh | 0 .../test-kernel-config.yml | 12 ---------- .../cases/020_kernel/001_config_4.9.x/test.sh | 23 +++++++++++++++++++ .../002_config_4.10.x/test-kernel-config.yml | 16 +++++++++++++ .../020_kernel/002_config_4.10.x/test.sh | 23 +++++++++++++++++++ .../003_config_4.11.x/test-kernel-config.yml | 16 +++++++++++++ .../020_kernel/003_config_4.11.x/test.sh | 23 +++++++++++++++++++ .../{010_kmod => 010_kmod_4.9.x}/Dockerfile | 0 .../{010_kmod => 010_kmod_4.9.x}/check.sh | 0 .../{010_kmod => 010_kmod_4.9.x}/kmod.yml | 0 .../{010_kmod => 010_kmod_4.9.x}/src/Makefile | 0 .../src/hello_world.c | 0 .../{010_kmod => 010_kmod_4.9.x}/test.sh | 0 14 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 test/cases/020_kernel/000_config_4.4.x/test-kernel-config.yml rename test/cases/020_kernel/{000_config => 000_config_4.4.x}/test.sh (100%) rename test/cases/020_kernel/{000_config => 001_config_4.9.x}/test-kernel-config.yml (60%) create mode 100644 test/cases/020_kernel/001_config_4.9.x/test.sh create mode 100644 test/cases/020_kernel/002_config_4.10.x/test-kernel-config.yml create mode 100644 test/cases/020_kernel/002_config_4.10.x/test.sh create mode 100644 test/cases/020_kernel/003_config_4.11.x/test-kernel-config.yml create mode 100644 test/cases/020_kernel/003_config_4.11.x/test.sh rename test/cases/020_kernel/{010_kmod => 010_kmod_4.9.x}/Dockerfile (100%) rename test/cases/020_kernel/{010_kmod => 010_kmod_4.9.x}/check.sh (100%) rename test/cases/020_kernel/{010_kmod => 010_kmod_4.9.x}/kmod.yml (100%) rename test/cases/020_kernel/{010_kmod => 010_kmod_4.9.x}/src/Makefile (100%) rename test/cases/020_kernel/{010_kmod => 010_kmod_4.9.x}/src/hello_world.c (100%) rename test/cases/020_kernel/{010_kmod => 010_kmod_4.9.x}/test.sh (100%) diff --git a/test/cases/020_kernel/000_config_4.4.x/test-kernel-config.yml b/test/cases/020_kernel/000_config_4.4.x/test-kernel-config.yml new file mode 100644 index 000000000..6c0db2dfb --- /dev/null +++ b/test/cases/020_kernel/000_config_4.4.x/test-kernel-config.yml @@ -0,0 +1,16 @@ +kernel: + image: "linuxkit/kernel:4.4.x" + cmdline: "console=ttyS0" +init: + - linuxkit/init:cbd7ae748f0a082516501a3e914fa0c924ee941e + - linuxkit/runc:24dfe632ed3ff53a026ee3fac046fd544434e2d6 + - linuxkit/containerd:f1130450206d4f64f0ddc13d15bb68435aa1ff61 +onboot: + - name: check-kernel-config + image: "linuxkit/test-kernel-config:ecff41279ccbc408079a3996a956432651c6eb9c" + readonly: true + - name: poweroff + image: "linuxkit/poweroff:a8f1e4ad8d459f1fdaad9e4b007512cb3b504ae8" + command: ["/bin/sh", "/poweroff.sh", "3"] +outputs: + - format: kernel+initrd diff --git a/test/cases/020_kernel/000_config/test.sh b/test/cases/020_kernel/000_config_4.4.x/test.sh similarity index 100% rename from test/cases/020_kernel/000_config/test.sh rename to test/cases/020_kernel/000_config_4.4.x/test.sh diff --git a/test/cases/020_kernel/000_config/test-kernel-config.yml b/test/cases/020_kernel/001_config_4.9.x/test-kernel-config.yml similarity index 60% rename from test/cases/020_kernel/000_config/test-kernel-config.yml rename to test/cases/020_kernel/001_config_4.9.x/test-kernel-config.yml index 8146aa2fb..ac928292b 100644 --- a/test/cases/020_kernel/000_config/test-kernel-config.yml +++ b/test/cases/020_kernel/001_config_4.9.x/test-kernel-config.yml @@ -5,19 +5,7 @@ init: - linuxkit/init:cbd7ae748f0a082516501a3e914fa0c924ee941e - linuxkit/runc:24dfe632ed3ff53a026ee3fac046fd544434e2d6 - linuxkit/containerd:f1130450206d4f64f0ddc13d15bb68435aa1ff61 - - linuxkit/ca-certificates:4e9a83e890e6477dcd25029fc4f1ced61d0642f4 onboot: - - name: dhcpcd - image: "linuxkit/dhcpcd:cb96c09a33c166eca6530f166f0f79927c3e83b0" - binds: - - /var:/var - - /tmp:/etc - capabilities: - - CAP_NET_ADMIN - - CAP_NET_BIND_SERVICE - - CAP_NET_RAW - net: host - command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] - name: check-kernel-config image: "linuxkit/test-kernel-config:ecff41279ccbc408079a3996a956432651c6eb9c" readonly: true diff --git a/test/cases/020_kernel/001_config_4.9.x/test.sh b/test/cases/020_kernel/001_config_4.9.x/test.sh new file mode 100644 index 000000000..7883df33b --- /dev/null +++ b/test/cases/020_kernel/001_config_4.9.x/test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# SUMMARY: Sanity check on the kernel config file +# LABELS: +# REPEAT: +# AUTHOR: Dave Tucker + +set -e + +# Source libraries. Uncomment if needed/defined +#. "${RT_LIB}" +. "${RT_PROJECT_ROOT}/_lib/lib.sh" + +clean_up() { + find . -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \; +} +trap clean_up EXIT + +# Test code goes here +moby build test-kernel-config +RESULT="$(linuxkit run qemu test-kernel-config)" +echo "${RESULT}" | grep -q "suite PASSED" + +exit 0 diff --git a/test/cases/020_kernel/002_config_4.10.x/test-kernel-config.yml b/test/cases/020_kernel/002_config_4.10.x/test-kernel-config.yml new file mode 100644 index 000000000..f54ef34a3 --- /dev/null +++ b/test/cases/020_kernel/002_config_4.10.x/test-kernel-config.yml @@ -0,0 +1,16 @@ +kernel: + image: "linuxkit/kernel:4.10.x" + cmdline: "console=ttyS0" +init: + - linuxkit/init:cbd7ae748f0a082516501a3e914fa0c924ee941e + - linuxkit/runc:24dfe632ed3ff53a026ee3fac046fd544434e2d6 + - linuxkit/containerd:f1130450206d4f64f0ddc13d15bb68435aa1ff61 +onboot: + - name: check-kernel-config + image: "linuxkit/test-kernel-config:ecff41279ccbc408079a3996a956432651c6eb9c" + readonly: true + - name: poweroff + image: "linuxkit/poweroff:a8f1e4ad8d459f1fdaad9e4b007512cb3b504ae8" + command: ["/bin/sh", "/poweroff.sh", "3"] +outputs: + - format: kernel+initrd diff --git a/test/cases/020_kernel/002_config_4.10.x/test.sh b/test/cases/020_kernel/002_config_4.10.x/test.sh new file mode 100644 index 000000000..7883df33b --- /dev/null +++ b/test/cases/020_kernel/002_config_4.10.x/test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# SUMMARY: Sanity check on the kernel config file +# LABELS: +# REPEAT: +# AUTHOR: Dave Tucker + +set -e + +# Source libraries. Uncomment if needed/defined +#. "${RT_LIB}" +. "${RT_PROJECT_ROOT}/_lib/lib.sh" + +clean_up() { + find . -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \; +} +trap clean_up EXIT + +# Test code goes here +moby build test-kernel-config +RESULT="$(linuxkit run qemu test-kernel-config)" +echo "${RESULT}" | grep -q "suite PASSED" + +exit 0 diff --git a/test/cases/020_kernel/003_config_4.11.x/test-kernel-config.yml b/test/cases/020_kernel/003_config_4.11.x/test-kernel-config.yml new file mode 100644 index 000000000..412fb2a11 --- /dev/null +++ b/test/cases/020_kernel/003_config_4.11.x/test-kernel-config.yml @@ -0,0 +1,16 @@ +kernel: + image: "linuxkit/kernel:4.11.x" + cmdline: "console=ttyS0" +init: + - linuxkit/init:cbd7ae748f0a082516501a3e914fa0c924ee941e + - linuxkit/runc:24dfe632ed3ff53a026ee3fac046fd544434e2d6 + - linuxkit/containerd:f1130450206d4f64f0ddc13d15bb68435aa1ff61 +onboot: + - name: check-kernel-config + image: "linuxkit/test-kernel-config:ecff41279ccbc408079a3996a956432651c6eb9c" + readonly: true + - name: poweroff + image: "linuxkit/poweroff:a8f1e4ad8d459f1fdaad9e4b007512cb3b504ae8" + command: ["/bin/sh", "/poweroff.sh", "3"] +outputs: + - format: kernel+initrd diff --git a/test/cases/020_kernel/003_config_4.11.x/test.sh b/test/cases/020_kernel/003_config_4.11.x/test.sh new file mode 100644 index 000000000..7883df33b --- /dev/null +++ b/test/cases/020_kernel/003_config_4.11.x/test.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# SUMMARY: Sanity check on the kernel config file +# LABELS: +# REPEAT: +# AUTHOR: Dave Tucker + +set -e + +# Source libraries. Uncomment if needed/defined +#. "${RT_LIB}" +. "${RT_PROJECT_ROOT}/_lib/lib.sh" + +clean_up() { + find . -iname "test-kernel-config*" -not -iname "*.yml" -exec rm -rf {} \; +} +trap clean_up EXIT + +# Test code goes here +moby build test-kernel-config +RESULT="$(linuxkit run qemu test-kernel-config)" +echo "${RESULT}" | grep -q "suite PASSED" + +exit 0 diff --git a/test/cases/020_kernel/010_kmod/Dockerfile b/test/cases/020_kernel/010_kmod_4.9.x/Dockerfile similarity index 100% rename from test/cases/020_kernel/010_kmod/Dockerfile rename to test/cases/020_kernel/010_kmod_4.9.x/Dockerfile diff --git a/test/cases/020_kernel/010_kmod/check.sh b/test/cases/020_kernel/010_kmod_4.9.x/check.sh similarity index 100% rename from test/cases/020_kernel/010_kmod/check.sh rename to test/cases/020_kernel/010_kmod_4.9.x/check.sh diff --git a/test/cases/020_kernel/010_kmod/kmod.yml b/test/cases/020_kernel/010_kmod_4.9.x/kmod.yml similarity index 100% rename from test/cases/020_kernel/010_kmod/kmod.yml rename to test/cases/020_kernel/010_kmod_4.9.x/kmod.yml diff --git a/test/cases/020_kernel/010_kmod/src/Makefile b/test/cases/020_kernel/010_kmod_4.9.x/src/Makefile similarity index 100% rename from test/cases/020_kernel/010_kmod/src/Makefile rename to test/cases/020_kernel/010_kmod_4.9.x/src/Makefile diff --git a/test/cases/020_kernel/010_kmod/src/hello_world.c b/test/cases/020_kernel/010_kmod_4.9.x/src/hello_world.c similarity index 100% rename from test/cases/020_kernel/010_kmod/src/hello_world.c rename to test/cases/020_kernel/010_kmod_4.9.x/src/hello_world.c diff --git a/test/cases/020_kernel/010_kmod/test.sh b/test/cases/020_kernel/010_kmod_4.9.x/test.sh similarity index 100% rename from test/cases/020_kernel/010_kmod/test.sh rename to test/cases/020_kernel/010_kmod_4.9.x/test.sh