6 def jffs2dump_find_file(files_list, fname):
7 for file_name in files_list:
8 file_name = file_name.strip()
9 if file_name.startswith("Dirent") and file_name.endswith(fname):
13 class TestJffs2(infra.basetest.BRTest):
14 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
16 BR2_TARGET_ROOTFS_JFFS2=y
17 BR2_TARGET_ROOTFS_JFFS2_CUSTOM=y
18 BR2_TARGET_ROOTFS_JFFS2_CUSTOM_EBSIZE=0x80000
19 BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER=y
20 BR2_TARGET_ROOTFS_JFFS2_PAD=y
21 BR2_TARGET_ROOTFS_JFFS2_PADSIZE=0x4000000
22 # BR2_TARGET_ROOTFS_TAR is not set
25 # TODO: there are some scary JFFS2 messages when one starts to
26 # write files in the rootfs: "jffs2: Newly-erased block contained
27 # word 0x0 at offset 0x046c0000". To be investigated.
30 img = os.path.join(self.builddir, "images", "rootfs.jffs2")
31 out = subprocess.check_output(["host/sbin/jffs2dump", "-c", img],
34 out = out.splitlines()
35 self.assertTrue(jffs2dump_find_file(out, "busybox"))
37 self.emulator.boot(arch="armv7",
39 kernel_cmdline=["root=/dev/mtdblock0",
41 options=["-drive", "file={},if=pflash".format(img)])
43 cmd = "mount | grep '/dev/root on / type jffs2'"
44 _, exit_code = self.emulator.run(cmd)
45 self.assertEqual(exit_code, 0)