1import os 2 3import infra.basetest 4 5 6class TestSquashfs(infra.basetest.BRTest): 7 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ 8 """ 9 BR2_TARGET_ROOTFS_SQUASHFS=y 10 BR2_TARGET_ROOTFS_SQUASHFS4_LZO=y 11 # BR2_TARGET_ROOTFS_TAR is not set 12 """ 13 expected_blocksize_in_bytes = 128*1024 14 15 def test_run(self): 16 unsquashfs_cmd = ["host/bin/unsquashfs", "-s", "images/rootfs.squashfs"] 17 out = infra.run_cmd_on_host(self.builddir, unsquashfs_cmd) 18 out = out.splitlines() 19 self.assertEqual(out[0], 20 "Found a valid SQUASHFS 4:0 superblock on images/rootfs.squashfs.") 21 self.assertEqual(out[3], "Compression lzo") 22 self.assertEqual(out[4], "Block size {}".format(self.expected_blocksize_in_bytes)) 23 24 img = os.path.join(self.builddir, "images", "rootfs.squashfs") 25 infra.img_round_power2(img) 26 27 self.emulator.boot(arch="armv7", 28 kernel="builtin", 29 kernel_cmdline=["root=/dev/mmcblk0", 30 "rootfstype=squashfs"], 31 options=["-drive", "file={},if=sd,format=raw".format(img)]) 32 self.emulator.login() 33 34 cmd = "mount | grep '/dev/root on / type squashfs'" 35 self.assertRunOk(cmd) 36 37 38class TestSquashfsMinBlocksize(TestSquashfs): 39 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ 40 """ 41 BR2_TARGET_ROOTFS_SQUASHFS=y 42 BR2_TARGET_ROOTFS_SQUASHFS_BS_4K=y 43 BR2_TARGET_ROOTFS_SQUASHFS4_LZO=y 44 # BR2_TARGET_ROOTFS_TAR is not set 45 """ 46 expected_blocksize_in_bytes = 4*1024 47 48 49class TestSquashfsMaxBlocksize(TestSquashfs): 50 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ 51 """ 52 BR2_TARGET_ROOTFS_SQUASHFS=y 53 BR2_TARGET_ROOTFS_SQUASHFS_BS_1024K=y 54 BR2_TARGET_ROOTFS_SQUASHFS4_LZO=y 55 # BR2_TARGET_ROOTFS_TAR is not set 56 """ 57 expected_blocksize_in_bytes = 1024*1024 58