support/testing/tests: fix tests to use infra.img_round_power2()
authorThomas Petazzoni <thomas.petazzoni@bootlin.com>
Mon, 21 Jun 2021 20:25:45 +0000 (22:25 +0200)
committerYann E. MORIN <yann.morin.1998@free.fr>
Sat, 26 Jun 2021 20:16:40 +0000 (22:16 +0200)
All the tests that are using if=sd as a Qemu options are changed to
use infra.img_round_power2() instead of simply extending the size of
the image to the next MB boundary, which is not longer sufficient with
Qemu >= 5.1.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[yann.morin.1998@free.fr: drop now-useless imports]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
support/testing/tests/core/test_file_capabilities.py
support/testing/tests/fs/test_squashfs.py
support/testing/tests/init/base.py

index b9ece18d7b95ee68edf9eb5517319c32a1af3118..d797769dddce49ed70f30a4cf678d9ac39b048c1 100644 (file)
@@ -1,5 +1,4 @@
 import os
-import subprocess
 
 import infra.basetest
 
@@ -28,7 +27,7 @@ class TestFileCapabilities(infra.basetest.BRTest):
 
     def test_run(self):
         img = os.path.join(self.builddir, "images", "rootfs.squashfs")
-        subprocess.call(["truncate", "-s", "%1M", img])
+        infra.img_round_power2(img)
 
         self.emulator.boot(arch="armv7",
                            kernel=os.path.join(self.builddir, "images", "zImage"),
index 3e58a12ab7721d224311298227244a05afd2b95d..745f93ee55fda882fce10af87940a06ee2014207 100644 (file)
@@ -1,5 +1,4 @@
 import os
-import subprocess
 
 import infra.basetest
 
@@ -22,7 +21,7 @@ class TestSquashfs(infra.basetest.BRTest):
         self.assertEqual(out[3], "Compression lz4")
 
         img = os.path.join(self.builddir, "images", "rootfs.squashfs")
-        subprocess.call(["truncate", "-s", "%1M", img])
+        infra.img_round_power2(img)
 
         self.emulator.boot(arch="armv7",
                            kernel="builtin",
index 80f7731ba33aea62d7a307a21e41af2020d7f73a..6a85b8778397783c67d4ebaee164c7fb45d82620 100644 (file)
@@ -1,5 +1,4 @@
 import os
-import subprocess
 import infra.basetest
 
 
@@ -7,7 +6,7 @@ class InitSystemBase(infra.basetest.BRTest):
 
     def start_emulator(self, fs_type, kernel=None, dtb=None, init=None):
         img = os.path.join(self.builddir, "images", "rootfs.{}".format(fs_type))
-        subprocess.call(["truncate", "-s", "%1M", img])
+        infra.img_round_power2(img)
 
         options = ["-drive",
                    "file={},if=sd,format=raw".format(img),