test_squashfs.py 1.2 KB

123456789101112131415161718192021222324252627282930313233
  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. def test_run(self):
  11. unsquashfs_cmd = ["host/bin/unsquashfs", "-s", "images/rootfs.squashfs"]
  12. out = infra.run_cmd_on_host(self.builddir, unsquashfs_cmd)
  13. out = out.splitlines()
  14. self.assertEqual(out[0],
  15. "Found a valid SQUASHFS 4:0 superblock on images/rootfs.squashfs.")
  16. self.assertEqual(out[3], "Compression lzo")
  17. img = os.path.join(self.builddir, "images", "rootfs.squashfs")
  18. infra.img_round_power2(img)
  19. self.emulator.boot(arch="armv7",
  20. kernel="builtin",
  21. kernel_cmdline=["root=/dev/mmcblk0",
  22. "rootfstype=squashfs"],
  23. options=["-drive", "file={},if=sd,format=raw".format(img)])
  24. self.emulator.login()
  25. cmd = "mount | grep '/dev/root on / type squashfs'"
  26. self.assertRunOk(cmd)