2
1

test_squashfs.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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_LZO=y
  8. # BR2_TARGET_ROOTFS_TAR is not set
  9. """
  10. expected_blocksize_in_bytes = 128*1024
  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 lzo")
  18. self.assertEqual(out[4], "Block size {}".format(self.expected_blocksize_in_bytes))
  19. img = os.path.join(self.builddir, "images", "rootfs.squashfs")
  20. infra.img_round_power2(img)
  21. self.emulator.boot(arch="armv7",
  22. kernel="builtin",
  23. kernel_cmdline=["root=/dev/mmcblk0",
  24. "rootfstype=squashfs"],
  25. options=["-drive", "file={},if=sd,format=raw".format(img)])
  26. self.emulator.login()
  27. cmd = "mount | grep '/dev/root on / type squashfs'"
  28. self.assertRunOk(cmd)
  29. class TestSquashfsMinBlocksize(TestSquashfs):
  30. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  31. """
  32. BR2_TARGET_ROOTFS_SQUASHFS=y
  33. BR2_TARGET_ROOTFS_SQUASHFS_BS_4K=y
  34. BR2_TARGET_ROOTFS_SQUASHFS4_LZO=y
  35. # BR2_TARGET_ROOTFS_TAR is not set
  36. """
  37. expected_blocksize_in_bytes = 4*1024
  38. class TestSquashfsMaxBlocksize(TestSquashfs):
  39. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  40. """
  41. BR2_TARGET_ROOTFS_SQUASHFS=y
  42. BR2_TARGET_ROOTFS_SQUASHFS_BS_1024K=y
  43. BR2_TARGET_ROOTFS_SQUASHFS4_LZO=y
  44. # BR2_TARGET_ROOTFS_TAR is not set
  45. """
  46. expected_blocksize_in_bytes = 1024*1024