]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - support/testing/tests/fs/test_squashfs.py
support/testing: standardize defconfig fragments style
[coffee/buildroot.git] / support / testing / tests / fs / test_squashfs.py
1 import os
2 import subprocess
3
4 import infra.basetest
5
6 class TestSquashfs(infra.basetest.BRTest):
7     config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
8         """
9         BR2_TARGET_ROOTFS_SQUASHFS=y
10         # BR2_TARGET_ROOTFS_SQUASHFS4_GZIP is not set
11         BR2_TARGET_ROOTFS_SQUASHFS4_LZ4=y
12         # BR2_TARGET_ROOTFS_TAR is not set
13         """
14
15     def test_run(self):
16         unsquashfs_cmd = ["host/bin/unsquashfs", "-s", "images/rootfs.squashfs"]
17         out = subprocess.check_output(unsquashfs_cmd,
18                                       cwd=self.builddir,
19                                       env={"LANG": "C"})
20         out = out.splitlines()
21         self.assertEqual(out[0],
22                          "Found a valid SQUASHFS 4:0 superblock on images/rootfs.squashfs.")
23         self.assertEqual(out[3], "Compression lz4")
24
25         img = os.path.join(self.builddir, "images", "rootfs.squashfs")
26         subprocess.call(["truncate", "-s", "%1M", img])
27
28         self.emulator.boot(arch="armv7",
29                            kernel="builtin",
30                            kernel_cmdline=["root=/dev/mmcblk0",
31                                            "rootfstype=squashfs"],
32                            options=["-drive", "file={},if=sd,format=raw".format(img)])
33         self.emulator.login()
34
35         cmd = "mount | grep '/dev/root on / type squashfs'"
36         _, exit_code = self.emulator.run(cmd)
37         self.assertEqual(exit_code, 0)