initial buildroot for linux 5.15
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
VOLNAME_PROP = "Filesystem volume name"
|
||||
REVISION_PROP = "Filesystem revision #"
|
||||
FEATURES_PROP = "Filesystem features"
|
||||
BLOCKCNT_PROP = "Block count"
|
||||
INODECNT_PROP = "Inode count"
|
||||
RESBLKCNT_PROP = "Reserved block count"
|
||||
|
||||
CHECK_FS_TYPE_CMD = "mount | grep '/dev/root on / type {}'"
|
||||
|
||||
|
||||
def dumpe2fs_run(builddir, image):
|
||||
cmd = ["host/sbin/dumpe2fs", os.path.join("images", image)]
|
||||
ret = infra.run_cmd_on_host(builddir, cmd)
|
||||
return ret.strip().splitlines()
|
||||
|
||||
|
||||
def dumpe2fs_getprop(out, prop):
|
||||
for line in out:
|
||||
fields = line.split(": ")
|
||||
if fields[0] == prop:
|
||||
return fields[1].strip()
|
||||
|
||||
|
||||
def boot_img_and_check_fs_type(emulator, builddir, fs_type):
|
||||
img = os.path.join(builddir, "images", "rootfs.{}".format(fs_type))
|
||||
emulator.boot(arch="armv7",
|
||||
kernel="builtin",
|
||||
kernel_cmdline=["root=/dev/mmcblk0",
|
||||
"rootfstype={}".format(fs_type)],
|
||||
options=["-drive", "file={},if=sd,format=raw".format(img)])
|
||||
emulator.login()
|
||||
_, exit_code = emulator.run(CHECK_FS_TYPE_CMD.format(fs_type))
|
||||
return exit_code
|
||||
|
||||
|
||||
class TestExt2(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_2r0=y
|
||||
BR2_TARGET_ROOTFS_EXT2_LABEL="foobaz"
|
||||
BR2_TARGET_ROOTFS_EXT2_SIZE="16384"
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
out = dumpe2fs_run(self.builddir, "rootfs.ext2")
|
||||
self.assertEqual(dumpe2fs_getprop(out, VOLNAME_PROP), "foobaz")
|
||||
self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "0 (original)")
|
||||
|
||||
exit_code = boot_img_and_check_fs_type(self.emulator,
|
||||
self.builddir, "ext2")
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestExt2r1(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_2r1=y
|
||||
BR2_TARGET_ROOTFS_EXT2_LABEL="foobar"
|
||||
BR2_TARGET_ROOTFS_EXT2_SIZE="16384"
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
out = dumpe2fs_run(self.builddir, "rootfs.ext2")
|
||||
self.assertEqual(dumpe2fs_getprop(out, VOLNAME_PROP), "foobar")
|
||||
self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "1 (dynamic)")
|
||||
self.assertNotIn("has_journal", dumpe2fs_getprop(out, FEATURES_PROP))
|
||||
|
||||
exit_code = boot_img_and_check_fs_type(self.emulator,
|
||||
self.builddir, "ext2")
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestExt3(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_3=y
|
||||
BR2_TARGET_ROOTFS_EXT2_SIZE="16384"
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
out = dumpe2fs_run(self.builddir, "rootfs.ext3")
|
||||
self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "1 (dynamic)")
|
||||
self.assertIn("has_journal", dumpe2fs_getprop(out, FEATURES_PROP))
|
||||
self.assertNotIn("extent", dumpe2fs_getprop(out, FEATURES_PROP))
|
||||
|
||||
exit_code = boot_img_and_check_fs_type(self.emulator,
|
||||
self.builddir, "ext3")
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestExt4(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_4=y
|
||||
BR2_TARGET_ROOTFS_EXT2_SIZE="16384"
|
||||
BR2_TARGET_ROOTFS_EXT2_INODES=3000
|
||||
BR2_TARGET_ROOTFS_EXT2_RESBLKS=10
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
out = dumpe2fs_run(self.builddir, "rootfs.ext4")
|
||||
self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "1 (dynamic)")
|
||||
self.assertEqual(dumpe2fs_getprop(out, BLOCKCNT_PROP), "16384")
|
||||
# Yes there are 8 fewer inodes than requested
|
||||
self.assertEqual(dumpe2fs_getprop(out, INODECNT_PROP), "2992")
|
||||
self.assertEqual(dumpe2fs_getprop(out, RESBLKCNT_PROP), "1638")
|
||||
self.assertIn("has_journal", dumpe2fs_getprop(out, FEATURES_PROP))
|
||||
self.assertIn("extent", dumpe2fs_getprop(out, FEATURES_PROP))
|
||||
|
||||
exit_code = boot_img_and_check_fs_type(self.emulator,
|
||||
self.builddir, "ext4")
|
||||
self.assertEqual(exit_code, 0)
|
||||
@@ -0,0 +1,47 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
def dumpf2fs_getprop(out, prop):
|
||||
for line in out:
|
||||
fields = line.split(" = ")
|
||||
if fields[0] == prop:
|
||||
return fields[1].strip()
|
||||
|
||||
|
||||
class TestF2FS(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_F2FS=y
|
||||
BR2_TARGET_ROOTFS_F2FS_SIZE="128M"
|
||||
BR2_TARGET_ROOTFS_F2FS_OVERPROVISION=0
|
||||
BR2_TARGET_ROOTFS_F2FS_DISCARD=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.204"
|
||||
BR2_LINUX_KERNEL_USE_DEFCONFIG=y
|
||||
BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
|
||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{}"
|
||||
""".format(infra.filepath("conf/f2fs-kernel-fragment.config"))
|
||||
|
||||
def test_run(self):
|
||||
img = os.path.join(self.builddir, "images", "rootfs.f2fs")
|
||||
out = infra.run_cmd_on_host(self.builddir, ["host/sbin/dump.f2fs", img])
|
||||
out = out.splitlines()
|
||||
prop = dumpf2fs_getprop(out, "Info: total sectors")
|
||||
self.assertEqual(prop, "262144 (128 MB)")
|
||||
|
||||
kernel = os.path.join(self.builddir, "images", "zImage")
|
||||
kernel_cmdline = ["root=/dev/mmcblk0", "rootfstype=f2fs",
|
||||
"console=ttyAMA0"]
|
||||
dtb = infra.download(self.downloaddir, "vexpress-v2p-ca9.dtb")
|
||||
options = ["-M", "vexpress-a9", "-dtb", dtb,
|
||||
"-drive", "file={},if=sd,format=raw".format(img)]
|
||||
self.emulator.boot(arch="armv7", kernel=kernel,
|
||||
kernel_cmdline=kernel_cmdline,
|
||||
options=options)
|
||||
self.emulator.login()
|
||||
cmd = "mount | grep '/dev/root on / type f2fs'"
|
||||
self.assertRunOk(cmd)
|
||||
@@ -0,0 +1,236 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
BASIC_CONFIG = \
|
||||
"""
|
||||
BR2_x86_pentium4=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
|
||||
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
|
||||
BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-i386-pentium4-full-2017.05-1078-g95b1dae.tar.bz2"
|
||||
BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
|
||||
BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_2=y
|
||||
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
|
||||
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
|
||||
BR2_TOOLCHAIN_EXTERNAL_CXX=y
|
||||
BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
|
||||
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.204"
|
||||
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="{}"
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
""".format(infra.filepath("conf/minimal-x86-qemu-kernel.config"))
|
||||
|
||||
|
||||
def test_mount_internal_external(emulator, builddir, internal=True, efi=False):
|
||||
img = os.path.join(builddir, "images", "rootfs.iso9660")
|
||||
if efi:
|
||||
efi_img = os.path.join(builddir, "images", "OVMF.fd")
|
||||
emulator.boot(arch="i386", options=["-cdrom", img, "-bios", efi_img])
|
||||
else:
|
||||
emulator.boot(arch="i386", options=["-cdrom", img])
|
||||
emulator.login()
|
||||
|
||||
if internal:
|
||||
cmd = "mount | grep 'rootfs on / type rootfs'"
|
||||
else:
|
||||
cmd = "mount | grep '/dev/root on / type iso9660'"
|
||||
|
||||
_, exit_code = emulator.run(cmd)
|
||||
return exit_code
|
||||
|
||||
|
||||
def test_touch_file(emulator):
|
||||
_, exit_code = emulator.run("touch test")
|
||||
return exit_code
|
||||
|
||||
#
|
||||
# Grub 2
|
||||
|
||||
|
||||
class TestIso9660Grub2External(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_ISO9660=y
|
||||
# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set
|
||||
BR2_TARGET_GRUB2=y
|
||||
BR2_TARGET_GRUB2_BOOT_PARTITION="cd"
|
||||
BR2_TARGET_GRUB2_BUILTIN_MODULES_PC="boot linux ext2 fat part_msdos part_gpt normal biosdisk iso9660"
|
||||
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
|
||||
""".format(infra.filepath("conf/grub2.cfg"))
|
||||
|
||||
def test_run(self):
|
||||
exit_code = test_mount_internal_external(self.emulator,
|
||||
self.builddir, internal=False)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
exit_code = test_touch_file(self.emulator)
|
||||
self.assertEqual(exit_code, 1)
|
||||
|
||||
|
||||
class TestIso9660Grub2ExternalCompress(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_ISO9660=y
|
||||
# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set
|
||||
BR2_TARGET_ROOTFS_ISO9660_TRANSPARENT_COMPRESSION=y
|
||||
BR2_TARGET_GRUB2=y
|
||||
BR2_TARGET_GRUB2_BOOT_PARTITION="cd"
|
||||
BR2_TARGET_GRUB2_BUILTIN_MODULES_PC="boot linux ext2 fat part_msdos part_gpt normal biosdisk iso9660"
|
||||
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
|
||||
""".format(infra.filepath("conf/grub2.cfg"))
|
||||
|
||||
def test_run(self):
|
||||
exit_code = test_mount_internal_external(self.emulator,
|
||||
self.builddir, internal=False)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
exit_code = test_touch_file(self.emulator)
|
||||
self.assertEqual(exit_code, 1)
|
||||
|
||||
|
||||
class TestIso9660Grub2Internal(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_ISO9660=y
|
||||
BR2_TARGET_ROOTFS_ISO9660_INITRD=y
|
||||
BR2_TARGET_GRUB2=y
|
||||
BR2_TARGET_GRUB2_BOOT_PARTITION="cd"
|
||||
BR2_TARGET_GRUB2_BUILTIN_MODULES_PC="boot linux ext2 fat part_msdos part_gpt normal biosdisk iso9660"
|
||||
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
|
||||
""".format(infra.filepath("conf/grub2.cfg"))
|
||||
|
||||
def test_run(self):
|
||||
exit_code = test_mount_internal_external(self.emulator,
|
||||
self.builddir, internal=True)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
exit_code = test_touch_file(self.emulator)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestIso9660Grub2EFI(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_ISO9660=y
|
||||
BR2_TARGET_ROOTFS_ISO9660_INITRD=y
|
||||
BR2_TARGET_GRUB2=y
|
||||
BR2_TARGET_GRUB2_I386_EFI=y
|
||||
BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat part_msdos part_gpt normal iso9660"
|
||||
BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="{}"
|
||||
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
|
||||
BR2_TARGET_EDK2=y
|
||||
""".format(infra.filepath("conf/grub2-efi.cfg"),
|
||||
infra.filepath("conf/grub2.cfg"))
|
||||
|
||||
def test_run(self):
|
||||
exit_code = test_mount_internal_external(self.emulator,
|
||||
self.builddir, internal=True,
|
||||
efi=True)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
exit_code = test_touch_file(self.emulator)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestIso9660Grub2Hybrid(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_ISO9660=y
|
||||
BR2_TARGET_ROOTFS_ISO9660_INITRD=y
|
||||
BR2_TARGET_GRUB2=y
|
||||
BR2_TARGET_GRUB2_I386_PC=y
|
||||
BR2_TARGET_GRUB2_I386_EFI=y
|
||||
BR2_TARGET_GRUB2_BOOT_PARTITION="cd"
|
||||
BR2_TARGET_GRUB2_BUILTIN_MODULES_PC="boot linux ext2 fat squash4 part_msdos part_gpt normal iso9660 biosdisk"
|
||||
BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC=""
|
||||
BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_msdos part_gpt normal iso9660 efi_gop"
|
||||
BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="{}"
|
||||
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
|
||||
BR2_TARGET_EDK2=y
|
||||
""".format(infra.filepath("conf/grub2-efi.cfg"),
|
||||
infra.filepath("conf/grub2.cfg"))
|
||||
|
||||
def test_run(self):
|
||||
exit_code = test_mount_internal_external(self.emulator,
|
||||
self.builddir, internal=True,
|
||||
efi=False)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
exit_code = test_touch_file(self.emulator)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
self.emulator.stop()
|
||||
|
||||
exit_code = test_mount_internal_external(self.emulator,
|
||||
self.builddir, internal=True,
|
||||
efi=True)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
exit_code = test_touch_file(self.emulator)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
#
|
||||
# Syslinux
|
||||
|
||||
|
||||
class TestIso9660SyslinuxExternal(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_ISO9660=y
|
||||
# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set
|
||||
BR2_TARGET_ROOTFS_ISO9660_HYBRID=y
|
||||
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
|
||||
BR2_TARGET_SYSLINUX=y
|
||||
""".format(infra.filepath("conf/isolinux.cfg"))
|
||||
|
||||
def test_run(self):
|
||||
exit_code = test_mount_internal_external(self.emulator,
|
||||
self.builddir, internal=False)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
exit_code = test_touch_file(self.emulator)
|
||||
self.assertEqual(exit_code, 1)
|
||||
|
||||
|
||||
class TestIso9660SyslinuxExternalCompress(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_ISO9660=y
|
||||
# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set
|
||||
BR2_TARGET_ROOTFS_ISO9660_TRANSPARENT_COMPRESSION=y
|
||||
BR2_TARGET_ROOTFS_ISO9660_HYBRID=y
|
||||
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
|
||||
BR2_TARGET_SYSLINUX=y
|
||||
""".format(infra.filepath("conf/isolinux.cfg"))
|
||||
|
||||
def test_run(self):
|
||||
exit_code = test_mount_internal_external(self.emulator,
|
||||
self.builddir, internal=False)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
exit_code = test_touch_file(self.emulator)
|
||||
self.assertEqual(exit_code, 1)
|
||||
|
||||
|
||||
class TestIso9660SyslinuxInternal(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_ISO9660=y
|
||||
BR2_TARGET_ROOTFS_ISO9660_INITRD=y
|
||||
BR2_TARGET_ROOTFS_ISO9660_HYBRID=y
|
||||
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
|
||||
BR2_TARGET_SYSLINUX=y
|
||||
""".format(infra.filepath("conf/isolinux.cfg"))
|
||||
|
||||
def test_run(self):
|
||||
exit_code = test_mount_internal_external(self.emulator,
|
||||
self.builddir, internal=True)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
exit_code = test_touch_file(self.emulator)
|
||||
self.assertEqual(exit_code, 0)
|
||||
@@ -0,0 +1,44 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
def jffs2dump_find_file(files_list, fname):
|
||||
for file_name in files_list:
|
||||
file_name = file_name.strip()
|
||||
if file_name.startswith("Dirent") and file_name.endswith(fname):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class TestJffs2(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_JFFS2=y
|
||||
BR2_TARGET_ROOTFS_JFFS2_CUSTOM=y
|
||||
BR2_TARGET_ROOTFS_JFFS2_CUSTOM_EBSIZE=0x40000
|
||||
BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER=y
|
||||
BR2_TARGET_ROOTFS_JFFS2_PAD=y
|
||||
BR2_TARGET_ROOTFS_JFFS2_PADSIZE=0x4000000
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
# TODO: there are some scary JFFS2 messages when one starts to
|
||||
# write files in the rootfs: "jffs2: Newly-erased block contained
|
||||
# word 0x0 at offset 0x046c0000". To be investigated.
|
||||
|
||||
def test_run(self):
|
||||
img = os.path.join(self.builddir, "images", "rootfs.jffs2")
|
||||
cmd = ["host/sbin/jffs2dump", "-c", img]
|
||||
out = infra.run_cmd_on_host(self.builddir, cmd)
|
||||
out = out.splitlines()
|
||||
self.assertTrue(jffs2dump_find_file(out, "busybox"))
|
||||
|
||||
self.emulator.boot(arch="armv7",
|
||||
kernel="builtin",
|
||||
kernel_cmdline=["root=/dev/mtdblock0",
|
||||
"rootfstype=jffs2"],
|
||||
options=["-drive", "file={},if=pflash".format(img)])
|
||||
self.emulator.login()
|
||||
cmd = "mount | grep '/dev/root on / type jffs2'"
|
||||
self.assertRunOk(cmd)
|
||||
@@ -0,0 +1,57 @@
|
||||
import os
|
||||
import shutil
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestOci(infra.basetest.BRTest):
|
||||
config = \
|
||||
"""
|
||||
BR2_aarch64=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.61"
|
||||
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
|
||||
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
|
||||
BR2_PACKAGE_CGROUPFS_MOUNT=y
|
||||
BR2_PACKAGE_CONTAINERD=y
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_SIZE="600M"
|
||||
BR2_TARGET_ROOTFS_OCI=y
|
||||
BR2_TARGET_ROOTFS_OCI_ENTRYPOINT="df"
|
||||
BR2_TARGET_ROOTFS_OCI_ENTRYPOINT_ARGS="-h"
|
||||
BR2_TARGET_ROOTFS_OCI_ARCHIVE=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def login(self):
|
||||
rootfs = os.path.join(self.builddir, "images", "rootfs.ext2")
|
||||
kern = os.path.join(self.builddir, "images", "Image")
|
||||
self.emulator.boot(arch="aarch64",
|
||||
kernel=kern,
|
||||
kernel_cmdline=["root=/dev/vda", "console=ttyAMA0"],
|
||||
options=["-M", "virt",
|
||||
"-cpu", "cortex-a57",
|
||||
"-m", "512M",
|
||||
"-drive", "file={},format=raw,if=virtio".format(rootfs)])
|
||||
self.emulator.login()
|
||||
|
||||
def place_test_oci(self):
|
||||
shutil.copy(os.path.join(self.builddir, 'images', 'rootfs-oci-latest-arm64-linux.oci-image.tar'),
|
||||
os.path.join(self.builddir, 'target', 'oci.tar'))
|
||||
# rebuild to make sure oci.tar ends up in rootfs.ext2
|
||||
self.b.build()
|
||||
|
||||
def test_run(self):
|
||||
self.place_test_oci()
|
||||
self.login()
|
||||
|
||||
cmd = "containerd &"
|
||||
self.assertRunOk(cmd)
|
||||
|
||||
cmd = "ctr image import --base-name buildroot-test /oci.tar"
|
||||
self.assertRunOk(cmd, timeout=120)
|
||||
|
||||
cmd = "ctr run --rm --tty buildroot-test:latest v1"
|
||||
self.assertRunOk(cmd, timeout=120)
|
||||
@@ -0,0 +1,33 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestSquashfs(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_SQUASHFS=y
|
||||
BR2_TARGET_ROOTFS_SQUASHFS4_LZO=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
unsquashfs_cmd = ["host/bin/unsquashfs", "-s", "images/rootfs.squashfs"]
|
||||
out = infra.run_cmd_on_host(self.builddir, unsquashfs_cmd)
|
||||
out = out.splitlines()
|
||||
self.assertEqual(out[0],
|
||||
"Found a valid SQUASHFS 4:0 superblock on images/rootfs.squashfs.")
|
||||
self.assertEqual(out[3], "Compression lzo")
|
||||
|
||||
img = os.path.join(self.builddir, "images", "rootfs.squashfs")
|
||||
infra.img_round_power2(img)
|
||||
|
||||
self.emulator.boot(arch="armv7",
|
||||
kernel="builtin",
|
||||
kernel_cmdline=["root=/dev/mmcblk0",
|
||||
"rootfstype=squashfs"],
|
||||
options=["-drive", "file={},if=sd,format=raw".format(img)])
|
||||
self.emulator.login()
|
||||
|
||||
cmd = "mount | grep '/dev/root on / type squashfs'"
|
||||
self.assertRunOk(cmd)
|
||||
@@ -0,0 +1,38 @@
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestUbi(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_UBIFS=y
|
||||
BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x3ff80
|
||||
BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x1
|
||||
BR2_TARGET_ROOTFS_UBI=y
|
||||
BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x40000
|
||||
BR2_TARGET_ROOTFS_UBI_SUBSIZE=1
|
||||
BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG=y
|
||||
BR2_TARGET_ROOTFS_UBI_CUSTOM_CONFIG_FILE="{}"
|
||||
""".format(
|
||||
infra.filepath("tests/fs/test_ubi/ubinize_qemu_pflash_cfi01.cfg"))
|
||||
|
||||
def test_run(self):
|
||||
img = os.path.join(self.builddir, "images", "rootfs.ubi")
|
||||
out = infra.run_cmd_on_host(self.builddir, ["file", img])
|
||||
out = out.splitlines()
|
||||
self.assertIn("UBI image, version 1", out[0])
|
||||
|
||||
subprocess.call(["truncate", "-s 64M", img])
|
||||
|
||||
self.emulator.boot(arch="armv7",
|
||||
kernel="builtin",
|
||||
kernel_cmdline=["root=ubi0:rootfs",
|
||||
"ubi.mtd=0",
|
||||
"rootfstype=ubifs"],
|
||||
options=["-drive", "file={},if=pflash,format=raw".format(img)])
|
||||
self.emulator.login()
|
||||
cmd = "mount | grep 'ubi0:rootfs on / type ubifs'"
|
||||
_, exit_code = self.emulator.run(cmd)
|
||||
self.assertEqual(exit_code, 0)
|
||||
@@ -0,0 +1,8 @@
|
||||
[ubifs]
|
||||
mode=ubi
|
||||
vol_id=0
|
||||
vol_type=static
|
||||
vol_name=rootfs
|
||||
vol_alignment=1
|
||||
vol_size=64MiB
|
||||
image=BR2_ROOTFS_UBIFS_PATH
|
||||
@@ -0,0 +1,15 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestYaffs2(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
infra.basetest.MINIMAL_CONFIG + \
|
||||
"""
|
||||
BR2_TARGET_ROOTFS_YAFFS2=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
img = os.path.join(self.builddir, "images", "rootfs.yaffs2")
|
||||
self.assertTrue(os.path.exists(img))
|
||||
Reference in New Issue
Block a user