diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-03-20 21:36:52 +0100 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2017-05-07 22:04:54 +0200 |
commit | bf4a6490e4ee70f0a46e588602995ba34e6c872a (patch) | |
tree | ea72b284a2039582c29f4e8e5f4bf59b3d6fa516 /support/testing/tests/fs/test_jffs2.py | |
parent | 96e21b617d72fc94445e18b6fb1e653850e0885e (diff) | |
download | buildroot-bf4a6490e4ee70f0a46e588602995ba34e6c872a.tar.gz buildroot-bf4a6490e4ee70f0a46e588602995ba34e6c872a.zip |
support/testing: add fs tests
This commit adds a number of test cases for various filesystem formats:
ext2/3/4, iso9660, jffs2, squashfs, ubi/ubifs and yaffs2. All of them
except yaffs2 are runtime tested. The iso9660 set of test cases is
particularly rich, testing the proper operation of the iso9660 support
with all of grub, grub2 and isolinux.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support/testing/tests/fs/test_jffs2.py')
-rw-r--r-- | support/testing/tests/fs/test_jffs2.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/support/testing/tests/fs/test_jffs2.py b/support/testing/tests/fs/test_jffs2.py new file mode 100644 index 0000000000..0d45af209b --- /dev/null +++ b/support/testing/tests/fs/test_jffs2.py @@ -0,0 +1,45 @@ +import os +import subprocess + +import infra.basetest + +def jffs2dump_find_file(files_list, fname): + for file_name in files_list: + file_name = file_name.strip() + if file_name.startswith("Dirent") and file_name.endswith(fname): + return True + return False + +class TestJffs2(infra.basetest.BRTest): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ +""" +BR2_TARGET_ROOTFS_JFFS2=y +BR2_TARGET_ROOTFS_JFFS2_CUSTOM=y +BR2_TARGET_ROOTFS_JFFS2_CUSTOM_EBSIZE=0x80000 +BR2_TARGET_ROOTFS_JFFS2_NOCLEANMARKER=y +BR2_TARGET_ROOTFS_JFFS2_PAD=y +BR2_TARGET_ROOTFS_JFFS2_PADSIZE=0x4000000 +# BR2_TARGET_ROOTFS_TAR is not set +""" + + # TODO: there are some scary JFFS2 messages when one starts to + # write files in the rootfs: "jffs2: Newly-erased block contained + # word 0x0 at offset 0x046c0000". To be investigated. + + def test_run(self): + img = os.path.join(self.builddir, "images", "rootfs.jffs2") + out = subprocess.check_output(["host/usr/sbin/jffs2dump", "-c", img], + cwd=self.builddir, + env={"LANG": "C"}) + out = out.splitlines() + self.assertTrue(jffs2dump_find_file(out, "busybox")) + + self.emulator.boot(arch="armv7", + kernel="builtin", + kernel_cmdline=["root=/dev/mtdblock0", + "rootfstype=jffs2"], + options=["-drive", "file={},if=pflash".format(img)]) + self.emulator.login() + cmd = "mount | grep '/dev/root on / type jffs2'" + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, 0) |