Skip to contentSkip to conversation

support/testing: test_ubi.py enable qemu's cfi flash01 old multiple chip handling

RFC New Romain Naour 1 participant 2 messages Sep 4, 2021

lore
Share & tools
lore
#0 lore raw

RFC 1/2 support/testing: test_ubi.py enable qemu's cfi flash01 old multiple chip handling

The ubi/ubifs test (test_ubi.py) rely on a Qemu bug present in 2.8.0 that was fixed in Qemu 2.9.0 [1]. The ubi/ubifs settings must be updated to run with Qemu >= 2.9.0 using the new multiple chip handling.

The issue was not detected until now since we are sill using an old qemu (2.8 from Debian stretch) for testing in gitlab (using the Buildroot Docker image used by gitlab-ci.yml). The test will fail with qemu >= 2.9.

In order to be able to the the test with any Qemu version >= 2.9, enable the hw-compat property to retain the old behaviour on 2.8 and earlier versions. (This property is not supported by qemu 2.8.0).

Tested with qemu 2.9.0.

Fixes:
https://gitlab.com/kubu93/buildroot/-/jobs/1543100932

[1] https://git.qemu.org/?p=qemu.git;a=commit;h=feb0b1aa11f14ee71660aba46b46387d1f923c9e

---
This will not work with Qemu 2.8.0 since this property doesn't exist.

I tried to update the ubi/ubifs settings without success.

---
 support/testing/tests/fs/test_ubi.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
support/testing/tests/fs/test_ubi.py +2 -1
index 7321f83da9..9cacf3b4b7 100644
@@ -32,7 +32,8 @@ class TestUbi(infra.basetest.BRTest):
                            kernel_cmdline=["root=ubi0:rootfs",
                                            "ubi.mtd=0",
                                            "rootfstype=ubifs"],
-                           options=["-drive", "file={},if=pflash".format(img)])
+                           options=["-global", "driver=cfi.pflash01,property=old-multiple-chip-handling,value=on",
+                                    "-drive", "file={},if=pflash".format(img)])
         self.emulator.login()
         cmd = "mount | grep 'ubi0:rootfs on / type ubifs'"
         _, exit_code = self.emulator.run(cmd)
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

RFC 2/2 support/testing: test_ubi: reduce the rootfs.ubi size to 64M to match the Qemu emulated flash device

The size of the cfi flash device emulated by Qemu is 64M not 128M [1]. Since Qemu >= 4.0, the size of the device must match the size of the block backend [2].

Fixes:

qemu-system-arm: device requires 67108864 bytes, block backend provides 134217728 bytes

[1] https://git.qemu.org/?p=qemu.git;a=blob;f=hw/arm/vexpress.c;h=58481c07629aedb09864dcc72757ff7947e733bb;hb=f9baca549e44791be0dd98de15add3d8452a8af0#l50
[2] https://git.qemu.org/?p=qemu.git;a=commitdiff;h=06f1521795207359a395996c253c306f4ab7586e

---
 support/testing/tests/fs/test_ubi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/testing/tests/fs/test_ubi.py +1 -1
index 9cacf3b4b7..92cd5cfd3b 100644
@@ -25,7 +25,7 @@ class TestUbi(infra.basetest.BRTest):
         out = out.splitlines()
         self.assertIn("UBI image, version 1", out[0])
 
-        subprocess.call(["truncate", "-s 128M", img])
+        subprocess.call(["truncate", "-s 64M", img])
 
         self.emulator.boot(arch="armv7",
                            kernel="builtin",
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot