1import os 2 3import infra.basetest 4 5 6class TestZfsGlibc(infra.basetest.BRTest): 7 config = \ 8 """ 9 BR2_x86_64=y 10 BR2_x86_corei7=y 11 BR2_TOOLCHAIN_EXTERNAL=y 12 BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_64_CORE_I7_GLIBC_STABLE=y 13 BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y 14 BR2_LINUX_KERNEL=y 15 BR2_LINUX_KERNEL_CUSTOM_VERSION=y 16 BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.12.13" 17 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y 18 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86_64/linux.config" 19 BR2_PACKAGE_ZFS=y 20 BR2_PACKAGE_PYTHON3=y 21 BR2_PACKAGE_PYTHON_CFFI=y 22 BR2_PACKAGE_PYTHON_SETUPTOOLS=y 23 BR2_PACKAGE_ZLIB_NG=y 24 BR2_PACKAGE_LIBRESSL=y 25 BR2_TARGET_ROOTFS_CPIO=y 26 # BR2_TARGET_ROOTFS_TAR is not set 27 """ 28 29 def test_run(self): 30 kernel = os.path.join(self.builddir, "images", "bzImage") 31 cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") 32 self.emulator.boot( 33 arch="x86_64", 34 kernel=kernel, 35 kernel_cmdline=["console=ttyS0"], 36 options=["-cpu", "Nehalem", "-m", "320", "-initrd", cpio_file], 37 ) 38 self.emulator.login() 39 40 cmds = [ 41 # Init 42 "modprobe zfs", 43 "mount -o remount,size=132M /tmp", 44 "fallocate -l 64M /tmp/container1.raw", 45 "fallocate -l 64M /tmp/container2.raw", 46 "zpool create -m /pool pool raidz /tmp/container1.raw /tmp/container2.raw", 47 "dd if=/dev/urandom bs=1M count=8 of=/pool/urandom", 48 "sha256sum /pool/urandom > /tmp/urandom.sha256", 49 # Check ZFS 50 "zpool export pool", 51 "zpool import pool -d /tmp/container1.raw -d /tmp/container2.raw", 52 "dd conv=notrunc bs=1M count=32 seek=16 if=/dev/urandom of=/tmp/container1.raw", 53 "zpool scrub -w pool", 54 "sha256sum -c /tmp/urandom.sha256", 55 "zpool status -v", 56 # Check PyZFS 57 "arc_summary", 58 ] 59 for cmd in cmds: 60 self.assertRunOk(cmd) 61 62 63class TestZfsUclibc(infra.basetest.BRTest): 64 config = \ 65 """ 66 BR2_x86_64=y 67 BR2_x86_corei7=y 68 BR2_TOOLCHAIN_EXTERNAL=y 69 BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_64_CORE_I7_UCLIBC_STABLE=y 70 BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y 71 BR2_LINUX_KERNEL=y 72 BR2_LINUX_KERNEL_CUSTOM_VERSION=y 73 BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.12.13" 74 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y 75 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86_64/linux.config" 76 BR2_PACKAGE_ZFS=y 77 BR2_PACKAGE_PYTHON3=y 78 BR2_PACKAGE_PYTHON_CFFI=y 79 BR2_PACKAGE_PYTHON_SETUPTOOLS=y 80 BR2_PACKAGE_ZLIB_NG=y 81 BR2_PACKAGE_LIBRESSL=y 82 BR2_TARGET_ROOTFS_CPIO=y 83 # BR2_TARGET_ROOTFS_TAR is not set 84 """ 85 86 def test_run(self): 87 kernel = os.path.join(self.builddir, "images", "bzImage") 88 cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") 89 self.emulator.boot( 90 arch="x86_64", 91 kernel=kernel, 92 kernel_cmdline=["console=ttyS0"], 93 options=["-cpu", "Nehalem", "-m", "320", "-initrd", cpio_file], 94 ) 95 self.emulator.login() 96 97 cmds = [ 98 # Init 99 "modprobe zfs", 100 "mount -o remount,size=132M /tmp", 101 "fallocate -l 64M /tmp/container1.raw", 102 "fallocate -l 64M /tmp/container2.raw", 103 "zpool create -m /pool pool raidz /tmp/container1.raw /tmp/container2.raw", 104 "dd if=/dev/urandom bs=1M count=8 of=/pool/urandom", 105 "sha256sum /pool/urandom > /tmp/urandom.sha256", 106 # Check ZFS 107 "zpool export pool", 108 "zpool import pool -d /tmp/container1.raw -d /tmp/container2.raw", 109 "dd conv=notrunc bs=1M count=32 seek=16 if=/dev/urandom of=/tmp/container1.raw", 110 "zpool scrub -w pool", 111 "sha256sum -c /tmp/urandom.sha256", 112 "zpool status -v", 113 # Check PyZFS 114 "arc_summary", 115 ] 116 for cmd in cmds: 117 self.assertRunOk(cmd) 118