summaryrefslogtreecommitdiffstats
path: root/support/testing/tests/fs/test_ubi.py
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-03-20 21:36:52 +0100
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-05-07 22:04:54 +0200
commitbf4a6490e4ee70f0a46e588602995ba34e6c872a (patch)
treeea72b284a2039582c29f4e8e5f4bf59b3d6fa516 /support/testing/tests/fs/test_ubi.py
parent96e21b617d72fc94445e18b6fb1e653850e0885e (diff)
downloadbuildroot-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_ubi.py')
-rw-r--r--support/testing/tests/fs/test_ubi.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/support/testing/tests/fs/test_ubi.py b/support/testing/tests/fs/test_ubi.py
new file mode 100644
index 0000000000..ede4999aa1
--- /dev/null
+++ b/support/testing/tests/fs/test_ubi.py
@@ -0,0 +1,39 @@
+import subprocess
+import os
+
+import infra.basetest
+
+class TestUbi(infra.basetest.BRTest):
+ config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+"""
+BR2_TARGET_ROOTFS_UBIFS=y
+BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x7ff80
+BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x1
+BR2_TARGET_ROOTFS_UBI=y
+BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x80000
+BR2_TARGET_ROOTFS_UBI_SUBSIZE=1
+"""
+
+ # TODO: if you boot Qemu twice on the same UBI image, it fails to
+ # attach the image the second time, with "ubi0 error:
+ # ubi_read_volume_table: the layout volume was not found".
+ # To be investigated.
+ def test_run(self):
+ img = os.path.join(self.builddir, "images", "rootfs.ubi")
+ out = subprocess.check_output(["file", img],
+ cwd=self.builddir,
+ env={"LANG": "C"})
+ out = out.splitlines()
+
+ subprocess.call(["truncate", "-s 128M", img])
+
+ self.emulator.boot(arch="armv7",
+ kernel="builtin",
+ kernel_cmdline=["root=ubi0:rootfs",
+ "ubi.mtd=0",
+ "rootfstype=ubifs"],
+ options=["-drive", "file={},if=pflash".format(img)])
+ self.emulator.login()
+ cmd = "mount | grep 'ubi0:rootfs on / type ubifs'"
+ _, exit_code = self.emulator.run(cmd)
+ self.assertEqual(exit_code, 0)
OpenPOWER on IntegriCloud