]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - support/testing/tests/fs/test_ubi.py
360932a0bfe0072170bd0a28d7285fd89cb762a5
[coffee/buildroot.git] / support / testing / tests / fs / test_ubi.py
1 import subprocess
2 import os
3
4 import infra.basetest
5
6 class TestUbi(infra.basetest.BRTest):
7     config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
8         """
9         BR2_TARGET_ROOTFS_UBIFS=y
10         BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x7ff80
11         BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE=0x1
12         BR2_TARGET_ROOTFS_UBI=y
13         BR2_TARGET_ROOTFS_UBI_PEBSIZE=0x80000
14         BR2_TARGET_ROOTFS_UBI_SUBSIZE=1
15         """
16
17     # TODO: if you boot Qemu twice on the same UBI image, it fails to
18     # attach the image the second time, with "ubi0 error:
19     # ubi_read_volume_table: the layout volume was not found".
20     # To be investigated.
21     def test_run(self):
22         img = os.path.join(self.builddir, "images", "rootfs.ubi")
23         out = subprocess.check_output(["file", img],
24                                       cwd=self.builddir,
25                                       env={"LANG": "C"})
26         out = out.splitlines()
27
28         subprocess.call(["truncate", "-s 128M", img])
29
30         self.emulator.boot(arch="armv7",
31                            kernel="builtin",
32                            kernel_cmdline=["root=ubi0:rootfs",
33                                            "ubi.mtd=0",
34                                            "rootfstype=ubifs"],
35                            options=["-drive", "file={},if=pflash".format(img)])
36         self.emulator.login()
37         cmd = "mount | grep 'ubi0:rootfs on / type ubifs'"
38         _, exit_code = self.emulator.run(cmd)
39         self.assertEqual(exit_code, 0)