kumquat-buildroot/support/testing/tests/package/test_lxc.py

60 lines
2.3 KiB
Python
Raw Normal View History

import os
import infra.basetest
class TestLxc(infra.basetest.BRTest):
config = \
"""
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
support/testing: test_lxc: bump kernel version to 5.15.38 for complete pidfds support As reported by [1], the lxc test is broken since lxc >= 4.0.11. A patch was added to lxc 4.0.11 to use the new mount api for devpts setup [2] but the fall back code doesn't work when this new mount API is not supported. This API was added in kernel 5.6. (kernel 5.5) DEBUG conf - conf.c:lxc_setup_devpts_child:1682 - No new devpts instance will be mounted since no pts devices are required lxc-start lxc_iperf3 DEBUG conf - conf.c:lxc_setup_dev_console:1966 - Cleared all (0) mounts from "/dev/console" lxc-start lxc_iperf3 ERROR mount_utils - mount_utils.c:mount_at:661 - No such file or directory - Failed to mount "/proc/self/fd/44" to "/proc/self/fd/43" lxc-start lxc_iperf3 ERROR conf - conf.c:lxc_setup_dev_console:1988 - No such file or directory - Failed to mount "10(/dev/pts/0)" on "43" lxc-start lxc_iperf3 ERROR conf - conf.c:lxc_setup_console:2143 - No such file or directory - Failed to setup console (kernel 5.6) lxc-start lxc_iperf3 TRACE mount_utils - mount_utils.c:can_use_mount_api:582 - Kernel supports mount api lxc-start lxc_iperf3 TRACE mount_utils - mount_utils.c:move_detached_mount:328 - Attach detached mount 45 to filesystem at 43 lxc-start lxc_iperf3 TRACE conf - conf.c:lxc_setup_dev_console:1990 - Setup console "/dev/pts/0" Bump the kernel to the current LTS 5.15.38 version that fully support the mount API needed by lxc. Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/2429013708 [1] http://lists.busybox.net/pipermail/buildroot/2022-January/635251.html [2] https://github.com/lxc/lxc/commit/be606e16fd0fa967219d890745a425625eafe251 Signed-off-by: Romain Naour <romain.naour@gmail.com> Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-05-12 22:49:44 +02:00
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15.38"
BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{}"
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
BR2_INIT_SYSTEMD=y
BR2_PACKAGE_LXC=y
BR2_PACKAGE_TINI=y
BR2_PACKAGE_IPERF3=y
BR2_ROOTFS_OVERLAY="{}"
BR2_TARGET_ROOTFS_CPIO=y
""".format(
infra.filepath("tests/package/test_lxc/lxc-kernel.config"),
infra.filepath("tests/package/test_lxc/rootfs-overlay"))
def run_ok(self, cmd):
self.assertRunOk(cmd, 120)
def wait_boot(self):
# the complete boot with systemd takes more time than what the
# default typically allows
self.emulator.login(timeout=600)
def setup_run_test_container(self):
self.run_ok("lxc-create -n lxc_iperf3 -t none -f /usr/share/lxc/config/minimal-iperf3.conf")
self.run_ok("lxc-start -l trace -n lxc_iperf3 -o /tmp/lxc.log -L /tmp/lxc.console.log")
# need to wait for the container to be fully started
self.run_ok("sleep 2")
self.run_ok("iperf3 -c 192.168.1.2 -t 2")
# if the test fails, just cat /tmp/*.log
def test_run(self):
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
kernel_file = os.path.join(self.builddir, "images", "zImage")
dtb_file = os.path.join(self.builddir, "images", "vexpress-v2p-ca9.dtb")
self.emulator.boot(arch="armv7", kernel=kernel_file,
kernel_cmdline=[
"console=ttyAMA0,115200"],
options=["-initrd", cpio_file,
"-dtb", dtb_file,
"-M", "vexpress-a9"])
self.wait_boot()
self.setup_run_test_container()