2
1

test_jffs2.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import os
  2. import infra.basetest
  3. def jffs2dump_find_file(files_list, fname):
  4. for file_name in files_list:
  5. file_name = file_name.strip()
  6. if file_name.startswith("Dirent") and file_name.endswith(fname):
  7. return True
  8. return False
  9. class TestJffs2(infra.basetest.BRTest):
  10. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  11. """
  12. BR2_TARGET_ROOTFS_JFFS2=y
  13. BR2_TARGET_ROOTFS_JFFS2_CUSTOM=y
  14. BR2_TARGET_ROOTFS_JFFS2_CUSTOM_EBSIZE=0x40000
  15. BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER=y
  16. BR2_TARGET_ROOTFS_JFFS2_PAD=y
  17. BR2_TARGET_ROOTFS_JFFS2_PADSIZE=0x4000000
  18. # BR2_TARGET_ROOTFS_TAR is not set
  19. """
  20. # TODO: there are some scary JFFS2 messages when one starts to
  21. # write files in the rootfs: "jffs2: Newly-erased block contained
  22. # word 0x0 at offset 0x046c0000". To be investigated.
  23. def test_run(self):
  24. img = os.path.join(self.builddir, "images", "rootfs.jffs2")
  25. cmd = ["host/sbin/jffs2dump", "-c", img]
  26. out = infra.run_cmd_on_host(self.builddir, cmd)
  27. out = out.splitlines()
  28. self.assertTrue(jffs2dump_find_file(out, "busybox"))
  29. self.emulator.boot(arch="armv7",
  30. kernel="builtin",
  31. kernel_cmdline=["root=/dev/mtdblock0",
  32. "rootfstype=jffs2"],
  33. options=["-drive", "file={},if=pflash".format(img)])
  34. self.emulator.login()
  35. cmd = "mount | grep '/dev/root on / type jffs2'"
  36. self.assertRunOk(cmd)