kumquat-buildroot/support/testing/tests/fs/test_ubi.py
Ricardo Martincoski 2927f412be support/testing: standardize defconfig fragments style
Change all defconfig fragments to take advantage of
"cf3cd4388a support/tests: allow properly indented config fragment".

Make each defconfig fragment:
 - start after a backslash;
 - be declared as a multi-line string literal;
 - be indented one level more than the variable that contains it.

Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2017-10-06 18:56:06 +02:00

40 lines
1.5 KiB
Python

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)