test_squashfs.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import os
  2. import infra.basetest
  3. class TestSquashfs(infra.basetest.BRTest):
  4. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  5. """
  6. BR2_TARGET_ROOTFS_SQUASHFS=y
  7. # BR2_TARGET_ROOTFS_SQUASHFS4_GZIP is not set
  8. BR2_TARGET_ROOTFS_SQUASHFS4_LZ4=y
  9. # BR2_TARGET_ROOTFS_TAR is not set
  10. """
  11. def test_run(self):
  12. unsquashfs_cmd = ["host/bin/unsquashfs", "-s", "images/rootfs.squashfs"]
  13. out = infra.run_cmd_on_host(self.builddir, unsquashfs_cmd)
  14. out = out.splitlines()
  15. self.assertEqual(out[0],
  16. "Found a valid SQUASHFS 4:0 superblock on images/rootfs.squashfs.")
  17. self.assertEqual(out[3], "Compression lz4")
  18. img = os.path.join(self.builddir, "images", "rootfs.squashfs")
  19. infra.img_round_power2(img)
  20. self.emulator.boot(arch="armv7",
  21. kernel="builtin",
  22. kernel_cmdline=["root=/dev/mmcblk0",
  23. "rootfstype=squashfs"],
  24. options=["-drive", "file={},if=sd,format=raw".format(img)])
  25. self.emulator.login()
  26. cmd = "mount | grep '/dev/root on / type squashfs'"
  27. self.assertRunOk(cmd)