test: add a case for cgroupv2

Signed-off-by: David Scott <dave@recoil.org>
This commit is contained in:
David Scott 2021-10-26 20:07:38 +01:00
parent 9d16e2a2b9
commit 10599f776a
3 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,14 @@
#!/bin/sh
set -x
function failed {
printf "cgroup not detected, suite FAILED\n" >&1
exit 1
}
DEVICE=/dev/sdb
mount | grep cgroup2 || failed
printf "cgroup2 detected, suite PASSED\n" >&1

View File

@ -0,0 +1,24 @@
#!/bin/sh
# SUMMARY: Run containerd test
# LABELS:
# REPEAT:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=cgroupv2
clean_up() {
rm -rf ${NAME}-*
}
trap clean_up EXIT
# Test code goes here
linuxkit build -format kernel+initrd -name "${NAME}" test.yml
RESULT="$(linuxkit run -mem 3072 ${NAME})"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@ -0,0 +1,19 @@
kernel:
image: linuxkit/kernel:5.10.47
cmdline: "linuxkit.unified_cgroup_hierarchy=1 console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:43c52456571369d62882605e4d510f0df3ed93de
- linuxkit/runc:5f9941eed05f58293f928c9f2f0b6a3f9f6f55c1
onboot:
- name: test
image: alpine:3.13
binds:
- /check.sh:/check.sh
- /run:/run
command: ["sh", "./check.sh"]
- name: poweroff
image: linuxkit/poweroff:afe4b3ab865afe1e3ed5c88e58f57808f4f5119f
command: ["/bin/sh", "/poweroff.sh", "10"]
files:
- path: check.sh
source: ./check.sh