diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-03-20 21:36:52 +0100 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-05-07 22:04:54 +0200 |
commit | bf4a6490e4ee70f0a46e588602995ba34e6c872a (patch) | |
tree | ea72b284a2039582c29f4e8e5f4bf59b3d6fa516 /support/testing/tests/fs/test_squashfs.py | |
parent | 96e21b617d72fc94445e18b6fb1e653850e0885e (diff) | |
download | buildroot-bf4a6490e4ee70f0a46e588602995ba34e6c872a.tar.gz buildroot-bf4a6490e4ee70f0a46e588602995ba34e6c872a.zip |
support/testing: add fs tests
This commit adds a number of test cases for various filesystem formats:
ext2/3/4, iso9660, jffs2, squashfs, ubi/ubifs and yaffs2. All of them
except yaffs2 are runtime tested. The iso9660 set of test cases is
particularly rich, testing the proper operation of the iso9660 support
with all of grub, grub2 and isolinux.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support/testing/tests/fs/test_squashfs.py')
-rw-r--r-- | support/testing/tests/fs/test_squashfs.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/support/testing/tests/fs/test_squashfs.py b/support/testing/tests/fs/test_squashfs.py new file mode 100644 index 0000000000..edaa087106 --- /dev/null +++ b/support/testing/tests/fs/test_squashfs.py @@ -0,0 +1,37 @@ +import os +import subprocess + +import infra.basetest + +class TestSquashfs(infra.basetest.BRTest): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ +""" +BR2_TARGET_ROOTFS_SQUASHFS=y +# BR2_TARGET_ROOTFS_SQUASHFS4_GZIP is not set +BR2_TARGET_ROOTFS_SQUASHFS4_LZ4=y +# BR2_TARGET_ROOTFS_TAR is not set +""" + + def test_run(self): + unsquashfs_cmd = ["host/usr/bin/unsquashfs", "-s", "images/rootfs.squashfs"] + out = subprocess.check_output(unsquashfs_cmd, + cwd=self.builddir, + env={"LANG": "C"}) + out = out.splitlines() + self.assertEqual(out[0], + "Found a valid SQUASHFS 4:0 superblock on images/rootfs.squashfs.") + self.assertEqual(out[3], "Compression lz4") + + img = os.path.join(self.builddir, "images", "rootfs.squashfs") + subprocess.call(["truncate", "-s", "%1M", 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'" + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, 0) |