xref: /OK3568_Linux_fs/buildroot/support/testing/tests/fs/test_squashfs.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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
14    def test_run(self):
15        unsquashfs_cmd = ["host/bin/unsquashfs", "-s", "images/rootfs.squashfs"]
16        out = infra.run_cmd_on_host(self.builddir, unsquashfs_cmd)
17        out = out.splitlines()
18        self.assertEqual(out[0],
19                         "Found a valid SQUASHFS 4:0 superblock on images/rootfs.squashfs.")
20        self.assertEqual(out[3], "Compression lzo")
21
22        img = os.path.join(self.builddir, "images", "rootfs.squashfs")
23        infra.img_round_power2(img)
24
25        self.emulator.boot(arch="armv7",
26                           kernel="builtin",
27                           kernel_cmdline=["root=/dev/mmcblk0",
28                                           "rootfstype=squashfs"],
29                           options=["-drive", "file={},if=sd,format=raw".format(img)])
30        self.emulator.login()
31
32        cmd = "mount | grep '/dev/root on / type squashfs'"
33        self.assertRunOk(cmd)
34