All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package
@ 2021-06-07 20:42 Thomas Petazzoni
  2021-06-07 20:42 ` [Buildroot] [PATCH v5 1/5] package/bmap-tools: new package Thomas Petazzoni
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2021-06-07 20:42 UTC (permalink / raw)
  To: buildroot

Hello,

Back in 2019, Nicolas Carrier started a patch series on bmap-tools,
which was kind of abandonned after 4 iterations. I'm now trying to
pick it up and revive it.

Compared to the v4 from Nicolas:

 - Checked the list of optional runtime dependencies that bmap-tools
   can use, as suggested by Romain Naour, and added some explanations
   in the Config.in help text about them. There is not much more we
   can do about them in Buildroot: they are not optional build time
   dependencies, but only runtime dependencies, and only needed when
   certain features are needed (so there is no reason to make them
   mandatory dependencies).

 - Added the missing pyexpat runtime dependency.

 - Drop incorrect build-time dependencies, which are only runtime ones
   (target python-setuptools)

 - Update to the latest version of bmap-tools

 - Misc improvements to the test cases, migration to a newer toolchain
   that doesn't exhibit an fallocate() bug. Moving to a newer
   toolchain requires updating the pre-built kernel image used for the
   runtime test infrastructure.

 - Added a host variant for the bmap-tools package, as this tool can
   also be very useful on the host to optimize the time needed to
   write an image. This host bmap-tools package comes with a test case
   as well.

Thanks!

Thomas Petazzoni

Nicolas Carrier (2):
  package/bmap-tools: new package
  support/testing/tests/package/test_bmap_tools: new test

Thomas Petazzoni (3):
  package/bmap-tools: enable host package
  support/testing/infra/emulator.py: update pre-built kernels
  support/testing/tests/package/test_bmap_tools: add test for host
    bmap-tools

 DEVELOPERS                                    |  6 ++
 package/Config.in                             |  1 +
 package/Config.in.host                        |  1 +
 package/bmap-tools/Config.in                  | 44 ++++++++++
 package/bmap-tools/Config.in.host             | 12 +++
 package/bmap-tools/bmap-tools.hash            |  3 +
 package/bmap-tools/bmap-tools.mk              | 14 +++
 support/testing/infra/emulator.py             |  8 +-
 .../tests/package/sample_bmap_tools.sh        | 15 ++++
 .../testing/tests/package/test_bmap_tools.py  | 88 +++++++++++++++++++
 10 files changed, 188 insertions(+), 4 deletions(-)
 create mode 100644 package/bmap-tools/Config.in
 create mode 100644 package/bmap-tools/Config.in.host
 create mode 100644 package/bmap-tools/bmap-tools.hash
 create mode 100644 package/bmap-tools/bmap-tools.mk
 create mode 100755 support/testing/tests/package/sample_bmap_tools.sh
 create mode 100644 support/testing/tests/package/test_bmap_tools.py

-- 
2.31.1

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 1/5] package/bmap-tools: new package
  2021-06-07 20:42 [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Thomas Petazzoni
@ 2021-06-07 20:42 ` Thomas Petazzoni
  2021-06-07 20:42 ` [Buildroot] [PATCH v5 2/5] package/bmap-tools: enable host package Thomas Petazzoni
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2021-06-07 20:42 UTC (permalink / raw)
  To: buildroot

From: Nicolas Carrier <nicolas.carrier@orolia.com>

Signed-off-by: Nicolas Carrier <nicolas.carrier@orolia.com>
[Thomas: numerous reworks, add myself in DEVELOPERS]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 DEVELOPERS                         |  2 ++
 package/Config.in                  |  1 +
 package/bmap-tools/Config.in       | 44 ++++++++++++++++++++++++++++++
 package/bmap-tools/bmap-tools.hash |  3 ++
 package/bmap-tools/bmap-tools.mk   | 13 +++++++++
 5 files changed, 63 insertions(+)
 create mode 100644 package/bmap-tools/Config.in
 create mode 100644 package/bmap-tools/bmap-tools.hash
 create mode 100644 package/bmap-tools/bmap-tools.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 0ab898d94d..973aab8824 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1976,6 +1976,7 @@ F:	board/intel/galileo/
 F:	configs/galileo_defconfig
 
 N:	Nicolas Carrier <nicolas.carrier@orolia.com>
+F:	package/bmap-tools/
 F:	package/php-xdebug/
 
 N:	Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
@@ -2626,6 +2627,7 @@ F:	configs/stm32mp157c_dk2_defconfig
 F:	package/android-tools/
 F:	package/b43-firmware/
 F:	package/b43-fwcutter/
+F:	package/bmap-tools/
 F:	package/c-periphery/
 F:	package/cdrkit/
 F:	package/cifs-utils/
diff --git a/package/Config.in b/package/Config.in
index e42f579494..1fc68c7a06 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -196,6 +196,7 @@ menu "Filesystem and flash utilities"
 	source "package/aufs/Config.in"
 	source "package/aufs-util/Config.in"
 	source "package/autofs/Config.in"
+	source "package/bmap-tools/Config.in"
 	source "package/btrfs-progs/Config.in"
 	source "package/cifs-utils/Config.in"
 	source "package/cpio/Config.in"
diff --git a/package/bmap-tools/Config.in b/package/bmap-tools/Config.in
new file mode 100644
index 0000000000..83b4d92786
--- /dev/null
+++ b/package/bmap-tools/Config.in
@@ -0,0 +1,44 @@
+config BR2_PACKAGE_BMAP_TOOLS
+	bool "bmap-tools"
+	depends on BR2_PACKAGE_PYTHON3 || BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON3_PYEXPAT if BR2_PACKAGE_PYTHON3 # runtime
+	select BR2_PACKAGE_PYTHON_PYEXPAT if BR2_PACKAGE_PYTHON # runtime
+	select BR2_PACKAGE_PYTHON_SETUPTOOLS # runtime, pkg_resources
+	select BR2_PACKAGE_PYTHON_SIX # runtime
+	help
+	  Tool to flash image files to block devices using the block map
+	  bmaptool is a generic tool for creating the block map (bmap)
+	  for a file, and copying files using the block map. The idea is
+	  that large file containing unused blocks, like raw system
+	  image files, can be copied or flashed a lot faster with
+	  bmaptool than with traditional tools like "dd" or "cp".
+
+	  Relevant optional dependencies:
+
+	  - Busybox compiled with CONFIG_BZIP2, or BR2_PACKAGE_BZIP2,
+	    to support bz2 compressed images
+
+	  - BR2_PACKAGE_PIGZ for optimized gzip decompression
+
+	  - Busybox compiled with CONFIG_LZOP, or BR2_PACKAGE_LZOP, to
+	    support lzo compressed images.
+
+	  - BR2_PACKAGE_ZIP to support zip compressed images
+
+	  - BR2_PACKAGE_LZ4 to support lz4 compressed images
+
+	  - BR2_PACKAGE_ZSTD to support zstd compressed images
+
+	  - Busybox compiled CONFIG_FEATURE_SEAMLESS_* or
+	    BR2_PACKAGE_TAR to support tar compressed images
+
+	  - BR2_PACKAGE_OPENSSH to retrieve images over SSH.
+
+	  - BR2_PACKAGE_SSHPASS to retrieve images over SSH if
+	    password authentication is used.
+
+	  Image signature verification is not supported as
+	  python-gpgme is not available. Optimized bzip2 decompression
+	  is not supported as pbzip2 is not available.
+
+	  https://github.com/intel/bmap-tools
diff --git a/package/bmap-tools/bmap-tools.hash b/package/bmap-tools/bmap-tools.hash
new file mode 100644
index 0000000000..82a570ecac
--- /dev/null
+++ b/package/bmap-tools/bmap-tools.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  0658afb972e7221aa16fece3f84e29e5102e901c929253d7fb6040bde28243f7  bmap-tools-3.6.tar.gz
+sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
diff --git a/package/bmap-tools/bmap-tools.mk b/package/bmap-tools/bmap-tools.mk
new file mode 100644
index 0000000000..c8b41c225f
--- /dev/null
+++ b/package/bmap-tools/bmap-tools.mk
@@ -0,0 +1,13 @@
+################################################################################
+#
+# bmap-tools
+#
+################################################################################
+
+BMAP_TOOLS_VERSION = 3.6
+BMAP_TOOLS_SITE = $(call github,intel,bmap-tools,v$(BMAP_TOOLS_VERSION))
+BMAP_TOOLS_LICENSE = GPL-2.0
+BMAP_TOOLS_LICENSE_FILES = COPYING
+BMAP_TOOLS_SETUP_TYPE = setuptools
+
+$(eval $(python-package))
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 2/5] package/bmap-tools: enable host package
  2021-06-07 20:42 [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Thomas Petazzoni
  2021-06-07 20:42 ` [Buildroot] [PATCH v5 1/5] package/bmap-tools: new package Thomas Petazzoni
@ 2021-06-07 20:42 ` Thomas Petazzoni
  2021-06-07 20:42 ` [Buildroot] [PATCH v5 3/5] support/testing/infra/emulator.py: update pre-built kernels Thomas Petazzoni
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2021-06-07 20:42 UTC (permalink / raw)
  To: buildroot

bmaptool allows to drastically reduce the amount of data to transfer
when writing to an SD card. Example with a 544 MiB sdcard.img:

$ bmaptool create sdcard.img > sdcard.bmap
$ gzip sdcard.img
$ bmaptool copy sdcard.img.gz /dev/sdc
bmaptool: info: discovered bmap file 'sdcard.bmap'
bmaptool: info: block map format version 2.0
bmaptool: info: 139265 blocks of size 4096 (544.0 MiB), mapped 23918 blocks (93.4 MiB or 17.2%)
bmaptool: info: copying image 'sdcard.img.gz' to block device '/dev/sdc' using bmap file 'sdcard.bmap'
bmaptool: info: 100% copied
bmaptool: info: synchronizing '/dev/sdc'
bmaptool: info: copying time: 7.7s, copying speed 12.1 MiB/sec

So it means that instead of writing 544 MiB, only 93.4 MiB had to be
written.

In terms of implementation details, compared to the target bmap-tools
package, there are fewer "selects" that are needed because:

 - The dependency on setuptools is not needed, because the package
   uses the setuptools SETUP_TYPE, so host-python-setuptools is
   already a build dependency.

 - host-python and host-python3 are always built with Expat XML
   support.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/Config.in.host            |  1 +
 package/bmap-tools/Config.in.host | 12 ++++++++++++
 package/bmap-tools/bmap-tools.mk  |  1 +
 3 files changed, 14 insertions(+)
 create mode 100644 package/bmap-tools/Config.in.host

diff --git a/package/Config.in.host b/package/Config.in.host
index 064c98af3d..8d443ea255 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -5,6 +5,7 @@ menu "Host utilities"
 	source "package/android-tools/Config.in.host"
 	source "package/asn1c/Config.in.host"
 	source "package/babeltrace2/Config.in.host"
+	source "package/bmap-tools/Config.in.host"
 	source "package/btrfs-progs/Config.in.host"
 	source "package/cbootimage/Config.in.host"
 	source "package/checkpolicy/Config.in.host"
diff --git a/package/bmap-tools/Config.in.host b/package/bmap-tools/Config.in.host
new file mode 100644
index 0000000000..a20829030d
--- /dev/null
+++ b/package/bmap-tools/Config.in.host
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_HOST_BMAP_TOOLS
+	bool "host bmap-tools"
+	select BR2_PACKAGE_HOST_PYTHON_SIX # runtime
+	help
+	  Tool to flash image files to block devices using the block map
+	  bmaptool is a generic tool for creating the block map (bmap)
+	  for a file, and copying files using the block map. The idea is
+	  that large file containing unused blocks, like raw system
+	  image files, can be copied or flashed a lot faster with
+	  bmaptool than with traditional tools like "dd" or "cp".
+
+	  https://github.com/intel/bmap-tools
diff --git a/package/bmap-tools/bmap-tools.mk b/package/bmap-tools/bmap-tools.mk
index c8b41c225f..32399ca151 100644
--- a/package/bmap-tools/bmap-tools.mk
+++ b/package/bmap-tools/bmap-tools.mk
@@ -11,3 +11,4 @@ BMAP_TOOLS_LICENSE_FILES = COPYING
 BMAP_TOOLS_SETUP_TYPE = setuptools
 
 $(eval $(python-package))
+$(eval $(host-python-package))
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 3/5] support/testing/infra/emulator.py: update pre-built kernels
  2021-06-07 20:42 [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Thomas Petazzoni
  2021-06-07 20:42 ` [Buildroot] [PATCH v5 1/5] package/bmap-tools: new package Thomas Petazzoni
  2021-06-07 20:42 ` [Buildroot] [PATCH v5 2/5] package/bmap-tools: enable host package Thomas Petazzoni
@ 2021-06-07 20:42 ` Thomas Petazzoni
  2021-06-07 20:42 ` [Buildroot] [PATCH v5 4/5] support/testing/tests/package/test_bmap_tools: new test Thomas Petazzoni
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2021-06-07 20:42 UTC (permalink / raw)
  To: buildroot

The pre-built vexpress kernel used by the testing infrastructure is a
4.0.0 kernel, which is getting old to be used with reasonably recent
toolchains.

This commit updates the pre-built kernels for both the versatile and
vexpress machines to 5.10.7 (they have already been put online).

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 support/testing/infra/emulator.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/support/testing/infra/emulator.py b/support/testing/infra/emulator.py
index 5611ec96e8..0a77eb80fc 100644
--- a/support/testing/infra/emulator.py
+++ b/support/testing/infra/emulator.py
@@ -54,16 +54,16 @@ class Emulator(object):
 
                 if arch == "armv7":
                     kernel = infra.download(self.downloaddir,
-                                            "kernel-vexpress")
+                                            "kernel-vexpress-5.10.7")
                     dtb = infra.download(self.downloaddir,
-                                         "vexpress-v2p-ca9.dtb")
+                                         "vexpress-v2p-ca9-5.10.7.dtb")
                     qemu_cmd += ["-dtb", dtb]
                     qemu_cmd += ["-M", "vexpress-a9"]
                 elif arch == "armv5":
                     kernel = infra.download(self.downloaddir,
-                                            "kernel-versatile-4.19")
+                                            "kernel-versatile-5.10.7")
                     dtb = infra.download(self.downloaddir,
-                                         "versatile-pb-4.19.dtb")
+                                         "versatile-pb-5.10.7.dtb")
                     qemu_cmd += ["-dtb", dtb]
                     qemu_cmd += ["-M", "versatilepb"]
                     qemu_cmd += ["-device", "virtio-rng-pci"]
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 4/5] support/testing/tests/package/test_bmap_tools: new test
  2021-06-07 20:42 [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2021-06-07 20:42 ` [Buildroot] [PATCH v5 3/5] support/testing/infra/emulator.py: update pre-built kernels Thomas Petazzoni
@ 2021-06-07 20:42 ` Thomas Petazzoni
  2021-06-07 20:42 ` [Buildroot] [PATCH v5 5/5] support/testing/tests/package/test_bmap_tools: add test for host bmap-tools Thomas Petazzoni
  2021-06-09  7:35 ` [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Nicolas Carrier
  5 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2021-06-07 20:42 UTC (permalink / raw)
  To: buildroot

From: Nicolas Carrier <nicolas.carrier@orolia.com>

This patch implements a simple test in which a dummy file system image
is created, then `bmaptool create` and `bmaptool copy` are used to copy
it to another file.

Signed-off-by: Nicolas Carrier <nicolas.carrier@orolia.com>
[Thomas: several reworks, add myself to DEVELOPERS]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 DEVELOPERS                                    |  4 ++
 .../tests/package/sample_bmap_tools.sh        | 15 +++++
 .../testing/tests/package/test_bmap_tools.py  | 59 +++++++++++++++++++
 3 files changed, 78 insertions(+)
 create mode 100755 support/testing/tests/package/sample_bmap_tools.sh
 create mode 100644 support/testing/tests/package/test_bmap_tools.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 973aab8824..9c44568c65 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1978,6 +1978,8 @@ F:	configs/galileo_defconfig
 N:	Nicolas Carrier <nicolas.carrier@orolia.com>
 F:	package/bmap-tools/
 F:	package/php-xdebug/
+F:	support/testing/tests/package/sample_bmap_tools.sh
+F:	support/testing/tests/package/test_bmap_tools.py
 
 N:	Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
 F:	package/libgit2/
@@ -2678,6 +2680,8 @@ F:	package/squashfs/
 F:	package/wayland/
 F:	package/weston/
 F:	support/testing/tests/boot/test_syslinux.py
+F:	support/testing/tests/package/sample_bmap_tools.sh
+F:	support/testing/tests/package/test_bmap_tools.py
 F:	toolchain/
 
 N:	Timo Ketola <timo.ketola@exertus.fi>
diff --git a/support/testing/tests/package/sample_bmap_tools.sh b/support/testing/tests/package/sample_bmap_tools.sh
new file mode 100755
index 0000000000..7c90368c17
--- /dev/null
+++ b/support/testing/tests/package/sample_bmap_tools.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# simple test which creates a dummy file system image, then use bmaptool create
+# and bmaptool copy to copy it to another file
+
+set -xeu
+
+# create the necessary test files
+dd if=/dev/zero of=disk.img bs=2M count=1
+mkfs.ext4 disk.img
+fallocate -d disk.img
+dd if=/dev/zero of=copy.img bs=2M count=1
+
+# do a test copy of the file system image
+bmaptool create -o disk.img.bmap disk.img
+bmaptool copy disk.img copy.img
diff --git a/support/testing/tests/package/test_bmap_tools.py b/support/testing/tests/package/test_bmap_tools.py
new file mode 100644
index 0000000000..6f3a8cc072
--- /dev/null
+++ b/support/testing/tests/package/test_bmap_tools.py
@@ -0,0 +1,59 @@
+import os
+import infra
+
+from infra.basetest import BRTest
+
+
+class TestBmapTools(BRTest):
+    __test__ = False
+    sample_script = "tests/package/sample_bmap_tools.sh"
+    copy_script = 'tests/package/copy-sample-script-to-target.sh'
+    config = \
+        """
+        BR2_arm=y
+        BR2_cortex_a8=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
+        BR2_PACKAGE_BMAP_TOOLS=y
+        BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
+        BR2_ROOTFS_POST_SCRIPT_ARGS="{}"
+        BR2_TARGET_ROOTFS_EXT2=y
+        BR2_TARGET_ROOTFS_EXT2_4=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        BR2_PACKAGE_UTIL_LINUX=y
+        BR2_PACKAGE_UTIL_LINUX_FALLOCATE=y
+        BR2_PACKAGE_E2FSPROGS=y
+        BR2_PACKAGE_UTIL_LINUX_LIBUUID=y
+        """.format(infra.filepath(copy_script),
+                   infra.filepath(sample_script))
+
+    def login(self):
+        img = os.path.join(self.builddir, "images", "rootfs.ext4")
+        self.emulator.boot(arch="armv7",
+                           kernel="builtin",
+                           kernel_cmdline=["root=/dev/mmcblk0",
+                                           "rootfstype=ext4"],
+                           options=["-drive", "file={},if=sd,format=raw".format(img)])
+        self.emulator.login()
+
+    def test_run(self):
+        self.login()
+        cmd = "/root/{}".format(os.path.basename(self.sample_script))
+        _, exit_code = self.emulator.run(cmd, timeout=20)
+        self.assertEqual(exit_code, 0)
+
+
+class TestPy2BmapTools(TestBmapTools):
+    __test__ = True
+    config = TestBmapTools.config + \
+        """
+        BR2_PACKAGE_PYTHON=y
+        """
+
+
+class TestPy3BmapTools(TestBmapTools):
+    __test__ = True
+    config = TestBmapTools.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        """
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 5/5] support/testing/tests/package/test_bmap_tools: add test for host bmap-tools
  2021-06-07 20:42 [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2021-06-07 20:42 ` [Buildroot] [PATCH v5 4/5] support/testing/tests/package/test_bmap_tools: new test Thomas Petazzoni
@ 2021-06-07 20:42 ` Thomas Petazzoni
  2021-06-09  7:35 ` [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Nicolas Carrier
  5 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2021-06-07 20:42 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 .../testing/tests/package/test_bmap_tools.py  | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/support/testing/tests/package/test_bmap_tools.py b/support/testing/tests/package/test_bmap_tools.py
index 6f3a8cc072..c49975e11e 100644
--- a/support/testing/tests/package/test_bmap_tools.py
+++ b/support/testing/tests/package/test_bmap_tools.py
@@ -1,5 +1,6 @@
 import os
 import infra
+import subprocess
 
 from infra.basetest import BRTest
 
@@ -57,3 +58,31 @@ class TestPy3BmapTools(TestBmapTools):
         """
         BR2_PACKAGE_PYTHON3=y
         """
+
+
+class TestHostBmapTools(BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_HOST_BMAP_TOOLS=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        BR2_TARGET_ROOTFS_EXT2=y
+        """
+
+    def test_run(self):
+        cmd = [os.path.join(self.b.builddir, "host", "bin", "bmaptool"),
+               "create",
+               "-o", os.path.join(self.b.builddir, "images", "rootfs.ext2.bmap"),
+               os.path.join(self.b.builddir, "images", "rootfs.ext2")]
+        ret = subprocess.call(cmd,
+                              stdout=self.b.logfile,
+                              stderr=self.b.logfile)
+        self.assertEqual(ret, 0)
+
+        cmd = [os.path.join(self.b.builddir, "host", "bin", "bmaptool"),
+               "copy",
+               os.path.join(self.b.builddir, "images", "rootfs.ext2"),
+               os.path.join(self.b.builddir, "images", "rootfs.ext2.copy")]
+        ret = subprocess.call(cmd,
+                              stdout=self.b.logfile,
+                              stderr=self.b.logfile)
+        self.assertEqual(ret, 0)
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package
  2021-06-07 20:42 [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Thomas Petazzoni
                   ` (4 preceding siblings ...)
  2021-06-07 20:42 ` [Buildroot] [PATCH v5 5/5] support/testing/tests/package/test_bmap_tools: add test for host bmap-tools Thomas Petazzoni
@ 2021-06-09  7:35 ` Nicolas Carrier
  2021-06-09  7:50   ` Thomas Petazzoni
  2021-06-09 18:52   ` Thomas Petazzoni
  5 siblings, 2 replies; 14+ messages in thread
From: Nicolas Carrier @ 2021-06-09  7:35 UTC (permalink / raw)
  To: buildroot

Hello,
I've tested the patch series in both the current master and by applying
it to our fork, which is based of 2020.02.11 and, after resolving the
conflicts with our branch (mainly in the DEVELOPERS file), I could test
it in both.

* the target package works fine
* so does the host package
* the tests TestPy3BmapTools and TestPy2BmapTools are failing at run
time.

The first error in the run log is:

qemu-system-arm: Invalid SD card size: 60 MiB
SD card size has to be a power of 2, e.g. 64 MiB.

So I set a fixed image size of 64M.
With this modification, the python 2 test passes, but with that, the
python 3 one, fails with a timeout issue:

...
  File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 181, in
expect_loop
    return self.timeout(e)
  File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 144, in
timeout
    raise exc
pexpect.exceptions.TIMEOUT: Timeout exceeded.
...

By increasing the timeout to 60 seconds, I could have all the tests
passing.

I attached my diff for reference.


And I have a question, is keeping python 2 compatibility still
required? Shouldn't we get rid of this test? It'd save quite an amount
of CPU time :)


On Mon, 2021-06-07 at 22:42 +0200, Thomas Petazzoni wrote:
> CAUTION: This email originated from outside of the organization.
> Do not click links or open attachments unless you recognize the
> sender and know the content is safe.
> 
> Hello,
> 
> Back in 2019, Nicolas Carrier started a patch series on bmap-tools,
> which was kind of abandonned after 4 iterations. I'm now trying to
> pick it up and revive it.
> 
> Compared to the v4 from Nicolas:
> 
> ?- Checked the list of optional runtime dependencies that bmap-tools
> ?? can use, as suggested by Romain Naour, and added some explanations
> ?? in the Config.in help text about them. There is not much more we
> ?? can do about them in Buildroot: they are not optional build time
> ?? dependencies, but only runtime dependencies, and only needed when
> ?? certain features are needed (so there is no reason to make them
> ?? mandatory dependencies).
> 
> ?- Added the missing pyexpat runtime dependency.
> 
> ?- Drop incorrect build-time dependencies, which are only runtime
> ones
> ?? (target python-setuptools)
> 
> ?- Update to the latest version of bmap-tools
> 
> ?- Misc improvements to the test cases, migration to a newer
> toolchain
> ?? that doesn't exhibit an fallocate() bug. Moving to a newer
> ?? toolchain requires updating the pre-built kernel image used for
> the
> ?? runtime test infrastructure.
> 
> ?- Added a host variant for the bmap-tools package, as this tool can
> ?? also be very useful on the host to optimize the time needed to
> ?? write an image. This host bmap-tools package comes with a test
> case
> ?? as well.
> 
> Thanks!
> 
> Thomas Petazzoni
> 
> Nicolas Carrier (2):
> ? package/bmap-tools: new package
> ? support/testing/tests/package/test_bmap_tools: new test
> 
> Thomas Petazzoni (3):
> ? package/bmap-tools: enable host package
> ? support/testing/infra/emulator.py: update pre-built kernels
> ? support/testing/tests/package/test_bmap_tools: add test for host
> ??? bmap-tools
> 
> ?DEVELOPERS??????????????????????????????????? |? 6 ++
> ?package/Config.in???????????????????????????? |? 1 +
> ?package/Config.in.host??????????????????????? |? 1 +
> ?package/bmap-tools/Config.in????????????????? | 44 ++++++++++
> ?package/bmap-tools/Config.in.host???????????? | 12 +++
> ?package/bmap-tools/bmap-tools.hash??????????? |? 3 +
> ?package/bmap-tools/bmap-tools.mk????????????? | 14 +++
> ?support/testing/infra/emulator.py???????????? |? 8 +-
> ?.../tests/package/sample_bmap_tools.sh??????? | 15 ++++
> ?.../testing/tests/package/test_bmap_tools.py? | 88
> +++++++++++++++++++
> ?10 files changed, 188 insertions(+), 4 deletions(-)
> ?create mode 100644 package/bmap-tools/Config.in
> ?create mode 100644 package/bmap-tools/Config.in.host
> ?create mode 100644 package/bmap-tools/bmap-tools.hash
> ?create mode 100644 package/bmap-tools/bmap-tools.mk
> ?create mode 100755
> support/testing/tests/package/sample_bmap_tools.sh
> ?create mode 100644 support/testing/tests/package/test_bmap_tools.py
> 
> --
> 2.31.1
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: minor_bmap_tests_fixes.patch
Type: text/x-patch
Size: 901 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210609/aeb3bd68/attachment.bin>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package
  2021-06-09  7:35 ` [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Nicolas Carrier
@ 2021-06-09  7:50   ` Thomas Petazzoni
  2021-06-09  8:31     ` Nicolas Carrier
  2021-06-09 18:52   ` Thomas Petazzoni
  1 sibling, 1 reply; 14+ messages in thread
From: Thomas Petazzoni @ 2021-06-09  7:50 UTC (permalink / raw)
  To: buildroot

Hello Nicolas,

On Wed, 09 Jun 2021 09:35:38 +0200
Nicolas Carrier <nicolas.carrier@orolia.com> wrote:

> * the target package works fine
> * so does the host package
> * the tests TestPy3BmapTools and TestPy2BmapTools are failing at run
> time.
> 
> The first error in the run log is:
> 
> qemu-system-arm: Invalid SD card size: 60 MiB
> SD card size has to be a power of 2, e.g. 64 MiB.
> 
> So I set a fixed image size of 64M.
> With this modification, the python 2 test passes, but with that, the
> python 3 one, fails with a timeout issue:
> 
> ...
>   File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 181, in
> expect_loop
>     return self.timeout(e)
>   File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 144, in
> timeout
>     raise exc
> pexpect.exceptions.TIMEOUT: Timeout exceeded.
> ...
> 
> By increasing the timeout to 60 seconds, I could have all the tests
> passing.
> 
> I attached my diff for reference.

Thanks a lot for the testing! I'll double check, but I believe the
tests were working here. But of course, I've done quite a bit of back
and forth, so let's double check :)

> And I have a question, is keeping python 2 compatibility still
> required? Shouldn't we get rid of this test? It'd save quite an amount
> of CPU time :)

python2 is already marked deprecated in BR, and we're more and more
thinking of getting rid of it. I think this may happen in the near
future.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package
  2021-06-09  7:50   ` Thomas Petazzoni
@ 2021-06-09  8:31     ` Nicolas Carrier
  0 siblings, 0 replies; 14+ messages in thread
From: Nicolas Carrier @ 2021-06-09  8:31 UTC (permalink / raw)
  To: buildroot

> Thanks a lot for the testing! I'll double check, but I believe the
> tests were working here. But of course, I've done quite a bit of back
> and forth, so let's double check :)
> 

For the 64M thing, maybe a difference in qemu versions?
I'm using debian bullseye (11) and my qemu version is:
$ qemu-system-arm  --version
QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-10)
Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers

About the timeout, I bet it was due to the work load, because I can't
reproduce it today, when the activity on my machine is low.
That said, the execution times range between 13s to 16s which makes me
say that the orinigal 20s limit was maybe too optimistic.
Maybe 60 seconds is not strictly required, but at least something like
40s would be safer.

> > And I have a question, is keeping python 2 compatibility still
> > required? Shouldn't we get rid of this test? It'd save quite an
> > amount
> > of CPU time :)
> 
> python2 is already marked deprecated in BR, and we're more and more
> thinking of getting rid of it. I think this may happen in the near
> future.
> 
> Best regards,
> 
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package
  2021-06-09  7:35 ` [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Nicolas Carrier
  2021-06-09  7:50   ` Thomas Petazzoni
@ 2021-06-09 18:52   ` Thomas Petazzoni
  2021-06-09 19:16     ` Romain Naour
  1 sibling, 1 reply; 14+ messages in thread
From: Thomas Petazzoni @ 2021-06-09 18:52 UTC (permalink / raw)
  To: buildroot

Hello Nicolas,

On Wed, 09 Jun 2021 09:35:38 +0200
Nicolas Carrier <nicolas.carrier@orolia.com> wrote:

> The first error in the run log is:
> 
> qemu-system-arm: Invalid SD card size: 60 MiB
> SD card size has to be a power of 2, e.g. 64 MiB.
> 
> So I set a fixed image size of 64M.

This is weird, because all the ext2/3/4 test cases in our test
infrastructure also do not specify a size, and so they get the default
of 60 MiB.

Could you try:

./support/testing/run-tests tests.fs.test_ext.TestExt4

and see if it works for you ?

Which version of Qemu are you using? I'm using 4.2.1.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package
  2021-06-09 18:52   ` Thomas Petazzoni
@ 2021-06-09 19:16     ` Romain Naour
  2021-06-10  7:39       ` Nicolas Carrier
  0 siblings, 1 reply; 14+ messages in thread
From: Romain Naour @ 2021-06-09 19:16 UTC (permalink / raw)
  To: buildroot

Hi Thomas, Nicolas,

Le 09/06/2021 ? 20:52, Thomas Petazzoni a ?crit?:
> Hello Nicolas,
> 
> On Wed, 09 Jun 2021 09:35:38 +0200
> Nicolas Carrier <nicolas.carrier@orolia.com> wrote:
> 
>> The first error in the run log is:
>>
>> qemu-system-arm: Invalid SD card size: 60 MiB
>> SD card size has to be a power of 2, e.g. 64 MiB.
>>
>> So I set a fixed image size of 64M.
> 
> This is weird, because all the ext2/3/4 test cases in our test
> infrastructure also do not specify a size, and so they get the default
> of 60 MiB.
> 
> Could you try:
> 
> ./support/testing/run-tests tests.fs.test_ext.TestExt4
> 
> and see if it works for you ?
> 
> Which version of Qemu are you using? I'm using 4.2.1.

We had the same problem after a qemu version bump to 5.1:

https://git.buildroot.net/buildroot/commit/?id=4bd2a317a7d6c3b3b19396a9459816da76b2c796

Best regards,
Romain


> 
> Best regards,
> 
> Thomas
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package
  2021-06-09 19:16     ` Romain Naour
@ 2021-06-10  7:39       ` Nicolas Carrier
  2021-06-10 12:31         ` Thomas Petazzoni
  0 siblings, 1 reply; 14+ messages in thread
From: Nicolas Carrier @ 2021-06-10  7:39 UTC (permalink / raw)
  To: buildroot

Sure,

My qemu version is:
$ qemu-system-arm  --version
QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-10)

The Ext4 test passes:
$ ./support/testing/run-tests tests.fs.test_ext.TestExt4 -o tests -d dl
09:03:31 TestExt4                                 Starting
09:03:34 TestExt4                                 Building
ah09:08:12 TestExt4                                 Building done
Downloading to /home/ncarrier/workspace/buildroot/dl/tmp_43sbo0r
Renaming from /home/ncarrier/workspace/buildroot/dl/tmp_43sbo0r to
/home/ncarrier/workspace/buildroot/dl/kernel-vexpress-5.10.7
Downloading to /home/ncarrier/workspace/buildroot/dl/tmpnj5e2uiw
Renaming from /home/ncarrier/workspace/buildroot/dl/tmpnj5e2uiw to
/home/ncarrier/workspace/buildroot/dl/vexpress-v2p-ca9-5.10.7.dtb
09:08:20 TestExt4                                 Cleaning up
.
----------------------------------------------------------------------
Ran 1 test in 289.374s

OK

But its file system image has a size of 16M which _is_ a power of two:

BR2_TARGET_ROOTFS_EXT2_SIZE="16384"

On Wed, 2021-06-09 at 21:16 +0200, Romain Naour wrote:
> CAUTION: This email originated from outside of the organization.
> Do not click links or open attachments unless you recognize the
> sender and know the content is safe.
> 
> Hi Thomas, Nicolas,
> 
> Le 09/06/2021 ? 20:52, Thomas Petazzoni a ?crit :
> > Hello Nicolas,
> > 
> > On Wed, 09 Jun 2021 09:35:38 +0200
> > Nicolas Carrier <nicolas.carrier@orolia.com> wrote:
> > 
> > > The first error in the run log is:
> > > 
> > > qemu-system-arm: Invalid SD card size: 60 MiB
> > > SD card size has to be a power of 2, e.g. 64 MiB.
> > > 
> > > So I set a fixed image size of 64M.
> > 
> > This is weird, because all the ext2/3/4 test cases in our test
> > infrastructure also do not specify a size, and so they get the
> > default
> > of 60 MiB.
> > 
> > Could you try:
> > 
> > ./support/testing/run-tests tests.fs.test_ext.TestExt4
> > 
> > and see if it works for you ?
> > 
> > Which version of Qemu are you using? I'm using 4.2.1.
> 
> We had the same problem after a qemu version bump to 5.1:
> 
> https://git.buildroot.net/buildroot/commit/?id=4bd2a317a7d6c3b3b19396a9459816da76b2c796
> 
> Best regards,
> Romain
> 
> 
> > 
> > Best regards,
> > 
> > Thomas
> > 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package
  2021-06-10  7:39       ` Nicolas Carrier
@ 2021-06-10 12:31         ` Thomas Petazzoni
  2021-06-10 13:15           ` Nicolas Carrier
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Petazzoni @ 2021-06-10 12:31 UTC (permalink / raw)
  To: buildroot

Hello Nicolas,

On Thu, 10 Jun 2021 09:39:43 +0200
Nicolas Carrier <nicolas.carrier@orolia.com> wrote:

> Sure,
> 
> My qemu version is:
> $ qemu-system-arm  --version
> QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-10)
> 
> The Ext4 test passes:
> $ ./support/testing/run-tests tests.fs.test_ext.TestExt4 -o tests -d dl
> 09:03:31 TestExt4                                 Starting
> 09:03:34 TestExt4                                 Building
> ah09:08:12 TestExt4                                 Building done
> Downloading to /home/ncarrier/workspace/buildroot/dl/tmp_43sbo0r
> Renaming from /home/ncarrier/workspace/buildroot/dl/tmp_43sbo0r to
> /home/ncarrier/workspace/buildroot/dl/kernel-vexpress-5.10.7
> Downloading to /home/ncarrier/workspace/buildroot/dl/tmpnj5e2uiw
> Renaming from /home/ncarrier/workspace/buildroot/dl/tmpnj5e2uiw to
> /home/ncarrier/workspace/buildroot/dl/vexpress-v2p-ca9-5.10.7.dtb
> 09:08:20 TestExt4                                 Cleaning up
> .
> ----------------------------------------------------------------------
> Ran 1 test in 289.374s
> 
> OK
> 
> But its file system image has a size of 16M which _is_ a power of two:

Sorry, I picked the wrong test. Could you try the Ext3 tests, i.e
tests.fs.test_ext.TestExt3 ? This one doesn't specify a size, so it
should fallback to the default, which is 60MB.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package
  2021-06-10 12:31         ` Thomas Petazzoni
@ 2021-06-10 13:15           ` Nicolas Carrier
  0 siblings, 0 replies; 14+ messages in thread
From: Nicolas Carrier @ 2021-06-10 13:15 UTC (permalink / raw)
  To: buildroot

Ok,
So I ran the test and this time, it failed as expected :)

buildroot$ tail -f tests/TestExt3-run.log
> starting qemu with 'qemu-system-arm -serial stdio -display none -m
256 -drive
file=/home/ncarrier/workspace/buildroot/tests/TestExt3/images/rootfs.ex
t3,if=sd -dtb /home/ncarrier/workspace/buildroot/dl/vexpress-v2p-ca9-
5.10.7.dtb -M vexpress-a9 -kernel
/home/ncarrier/workspace/buildroot/dl/kernel-vexpress-5.10.7 -append
root=/dev/mmcblk0 rootfstype=ext3 console=ttyAMA0'
WARNING: Image format was not specified for
'/home/ncarrier/workspace/buildroot/tests/TestExt3/images/rootfs.ext3'
and probing guessed raw.
         Automatically detecting the format is dangerous for raw
images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the
restrictions.
qemu-system-arm: Invalid SD card size: 60 MiB
SD card size has to be a power of 2, e.g. 64 MiB.
You can resize disk images with 'qemu-img resize <imagefile> <new-
size>'
(note that this will lose data if you make the image smaller than it
currently is).


On Thu, 2021-06-10 at 14:31 +0200, Thomas Petazzoni wrote:
> CAUTION: This email originated from outside of the organization.
> Do not click links or open attachments unless you recognize the
> sender and know the content is safe.
> 
> Hello Nicolas,
> 
> On Thu, 10 Jun 2021 09:39:43 +0200
> Nicolas Carrier <nicolas.carrier@orolia.com> wrote:
> 
> > Sure,
> > 
> > My qemu version is:
> > $ qemu-system-arm? --version
> > QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-10)
> > 
> > The Ext4 test passes:
> > $ ./support/testing/run-tests tests.fs.test_ext.TestExt4 -o tests -
> > d dl
> > 09:03:31 TestExt4???????????????????????????????? Starting
> > 09:03:34 TestExt4???????????????????????????????? Building
> > ah09:08:12 TestExt4???????????????????????????????? Building done
> > Downloading to /home/ncarrier/workspace/buildroot/dl/tmp_43sbo0r
> > Renaming from /home/ncarrier/workspace/buildroot/dl/tmp_43sbo0r to
> > /home/ncarrier/workspace/buildroot/dl/kernel-vexpress-5.10.7
> > Downloading to /home/ncarrier/workspace/buildroot/dl/tmpnj5e2uiw
> > Renaming from /home/ncarrier/workspace/buildroot/dl/tmpnj5e2uiw to
> > /home/ncarrier/workspace/buildroot/dl/vexpress-v2p-ca9-5.10.7.dtb
> > 09:08:20 TestExt4???????????????????????????????? Cleaning up
> > .
> > -------------------------------------------------------------------
> > ---
> > Ran 1 test in 289.374s
> > 
> > OK
> > 
> > But its file system image has a size of 16M which _is_ a power of
> > two:
> 
> Sorry, I picked the wrong test. Could you try the Ext3 tests, i.e
> tests.fs.test_ext.TestExt3 ? This one doesn't specify a size, so it
> should fallback to the default, which is 60MB.
> 
> Best regards,
> 
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-06-10 13:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07 20:42 [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Thomas Petazzoni
2021-06-07 20:42 ` [Buildroot] [PATCH v5 1/5] package/bmap-tools: new package Thomas Petazzoni
2021-06-07 20:42 ` [Buildroot] [PATCH v5 2/5] package/bmap-tools: enable host package Thomas Petazzoni
2021-06-07 20:42 ` [Buildroot] [PATCH v5 3/5] support/testing/infra/emulator.py: update pre-built kernels Thomas Petazzoni
2021-06-07 20:42 ` [Buildroot] [PATCH v5 4/5] support/testing/tests/package/test_bmap_tools: new test Thomas Petazzoni
2021-06-07 20:42 ` [Buildroot] [PATCH v5 5/5] support/testing/tests/package/test_bmap_tools: add test for host bmap-tools Thomas Petazzoni
2021-06-09  7:35 ` [Buildroot] [PATCH v5 0/5] Introduce bmap-tools as target + host package Nicolas Carrier
2021-06-09  7:50   ` Thomas Petazzoni
2021-06-09  8:31     ` Nicolas Carrier
2021-06-09 18:52   ` Thomas Petazzoni
2021-06-09 19:16     ` Romain Naour
2021-06-10  7:39       ` Nicolas Carrier
2021-06-10 12:31         ` Thomas Petazzoni
2021-06-10 13:15           ` Nicolas Carrier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.