xref: /OK3568_Linux_fs/buildroot/support/testing/tests/package/test_dtbocfg.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1import os
2
3import infra.basetest
4
5
6class TestDtbocfg(infra.basetest.BRTest):
7    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
8        """
9        BR2_LINUX_KERNEL=y
10        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
11        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.7"
12        BR2_LINUX_KERNEL_USE_DEFCONFIG=y
13        BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
14        BR2_PACKAGE_DTBOCFG=y
15        BR2_TARGET_ROOTFS_CPIO=y
16        # BR2_TARGET_ROOTFS_TAR is not set
17        """
18
19    def test_run(self):
20        img = os.path.join(self.builddir, "images", "rootfs.cpio")
21        kernel = os.path.join(self.builddir, "images", "zImage")
22        kernel_cmdline = ["console=ttyAMA0"]
23        dtb = infra.download(self.downloaddir, "vexpress-v2p-ca9.dtb")
24        options = ["-M", "vexpress-a9", "-dtb", dtb, "-initrd", img]
25
26        self.emulator.boot(arch="armv7", kernel=kernel,
27                           kernel_cmdline=kernel_cmdline,
28                           options=options)
29        self.emulator.login()
30        self.assertRunOk("modprobe dtbocfg.ko")
31        self.assertRunOk("mkdir /tmp/config && mount -t configfs none /tmp/config")
32
33        # Check that overlays directory is present.
34        # From dtbocfg site (https://github.com/ikwzm/dtbocfg):
35        #   If /config/device-tree/overlays is created, it is ready to use
36        #   dtbocfg
37        self.assertRunOk("ls /tmp/config/device-tree/overlays/")
38