public inbox for buildroot@busybox.net
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v6 0/6] kvm-unit-tests: update deps and fine tune qemu
@ 2026-02-25 10:55 Alex Bennée
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 1/6] toolchain/external: allow installing of libc utils Alex Bennée
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Alex Bennée @ 2026-02-25 10:55 UTC (permalink / raw)
  To: buildroot

The kvm-unit-tests recipe is a little out of date with the
dependencies it needs. With that and some tweaking of the of processor
dependencies we can now build kvm-unit-tests for arm64.

As kvm-unit-tests need the libc utils and I use external tooling I
added support for that.

On the way I've added some new config options for QEMU so you can just
select your native, kvm-only QEMU build.

For Arm we can also run with kvmtool so I've added an option to enable
that.

Finally I've added a simple test case for the kvm-unit-tests package.

The following patches are unreviewed:

  support/testing: add test for kvm-unit-tests
  toolchain/external: allow installing of libc utils

Otherwise I think everything is good to go.

For v6
  - some patches merged

For v5
  - more r-b tags
  - addressed comments (see commits)

For v4
  - re-base
  - update kvm-unit-tests to v2025-07-31

For v3
  - add r-b tags
  - update kvm-unit-tests to current master
  - update kvmtool
  - enable kvmtool as alternative to QEMU

For v2
  - addressed review comments
  - added external libc util support
  - added test case
  - ran and addressed linter warnings

Alex.

Alex Bennée (6):
  toolchain/external: allow installing of libc utils
  package/kvm-unit-tests: update dependencies
  package/kvm-unit-tests: bump to v2025-07-31
  package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE
  support/testing: add test for kvm-unit-tests
  package/kvm-unit-tests: allow kvmtool to be used

 board/qemu/aarch64-virt/linux.config          |  2 +
 package/kvm-unit-tests/Config.in              | 29 ++++++++++--
 package/kvm-unit-tests/kvm-unit-tests.hash    |  2 +-
 package/kvm-unit-tests/kvm-unit-tests.mk      | 21 ++++++++-
 support/testing/tests/package/test_kvm.py     | 47 +++++++++++++++++++
 toolchain/toolchain-external/Config.in        |  7 +++
 .../pkg-toolchain-external.mk                 | 24 ++++++++++
 7 files changed, 125 insertions(+), 7 deletions(-)
 create mode 100644 support/testing/tests/package/test_kvm.py

-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v6 1/6] toolchain/external: allow installing of libc utils
  2026-02-25 10:55 [Buildroot] [PATCH v6 0/6] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
@ 2026-02-25 10:55 ` Alex Bennée
  2026-03-10 21:53   ` Romain Naour via buildroot
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 2/6] package/kvm-unit-tests: update dependencies Alex Bennée
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Alex Bennée @ 2026-02-25 10:55 UTC (permalink / raw)
  To: buildroot; +Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni

For buildroot's own tools we have BR2_PACKAGE_GLIBC_UTILS (and similar
for ulibc). As we need the tools for somethings we should also support
this for external toolchains.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 toolchain/toolchain-external/Config.in        |  7 ++++++
 .../pkg-toolchain-external.mk                 | 24 +++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index 831387bc4e..e79dafa365 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -125,4 +125,11 @@ config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
 	  Copy the gdbserver provided by the external toolchain to the
 	  target.
 
+config BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY
+	bool "Install libc utilities"
+	depends on BR2_TOOLCHAIN_EXTERNAL
+	help
+	  Enabling this option will compile and install the getconf,
+	  ldd and locale gibc utilities for the target.
+
 endif # BR2_TOOLCHAIN_EXTERNAL
diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index 270cf814ed..b84abb6106 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -446,6 +446,29 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER
 endef
 endif
 
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY),y)
+define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBC_UTILS
+	$(Q)$(call MESSAGE,"Copying libc utils")
+	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
+	utils_found=0 ; \
+	for d in $${ARCH_SYSROOT_DIR} \
+	         $${ARCH_SYSROOT_DIR}/usr \
+		 $(TOOLCHAIN_EXTERNAL_INSTALL_DIR); do \
+		if test -f $${d}/bin/getconf ; then \
+			for f in getconf ldd locale; do \
+				install -m 0755 -D $${d}/bin/$${f} $(TARGET_DIR)/usr/bin ; \
+			done ; \
+			utils_found=1 ; \
+			break ; \
+		fi ; \
+	done ; \
+	if [ $${utils_found} -eq 0 ] ; then \
+		echo "Could not find libc utils in external toolchain" ; \
+		exit 1 ; \
+	fi
+endef
+endif
+
 define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
 	$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
 	ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
@@ -627,6 +650,7 @@ endef
 define $(2)_INSTALL_TARGET_CMDS
 	$$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK)
 	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
+	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBC_UTILS)
 	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER)
 	$$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
 	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LDD)
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v6 2/6] package/kvm-unit-tests: update dependencies
  2026-02-25 10:55 [Buildroot] [PATCH v6 0/6] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 1/6] toolchain/external: allow installing of libc utils Alex Bennée
@ 2026-02-25 10:55 ` Alex Bennée
  2026-03-10 22:02   ` Romain Naour via buildroot
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 3/6] package/kvm-unit-tests: bump to v2025-07-31 Alex Bennée
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Alex Bennée @ 2026-02-25 10:55 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Huth, Thomas Huth, Cyril Bur

To run the tests we need a system QEMU, timeout, getconf and nmap-ncat
so update the select/depends for them. As we need at least GCC 8 we
can drop the specific requirement for old x86-64 tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <th.huth@posteo.eu>

---
v2
  - remove old gcc notes as we need at least 8 anyway
  - select QEMU and other runtime deps
  - mention the runtime deps
  - add support for getconf from external toolchain
  - update comment fallback
v5
  - keep i386/x86-64 target/host comments
  - add !BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET to comment deps
---
 package/kvm-unit-tests/Config.in | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
index 817d3c4a8f..74c32f46e0 100644
--- a/package/kvm-unit-tests/Config.in
+++ b/package/kvm-unit-tests/Config.in
@@ -16,11 +16,20 @@ config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
 config BR2_PACKAGE_KVM_UNIT_TESTS
 	bool "kvm-unit-tests"
 	depends on BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
-	# on i386 and x86-64, __builtin_reachable is used, so we need
-	# gcc 4.5 at least. on i386, we use the target gcc, while on
+	# On i386, we use the target gcc, while on
 	# x86-64 we use the host gcc (see .mk file for details)
-	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 || !BR2_i386
 	depends on BR2_HOSTARCH = "x86_64" || !BR2_x86_64
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_8 # qemu
+	depends on BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET
+	depends on (BR2_PACKAGE_GLIBC_UTILS || \
+		    BR2_UCLIBC_INSTALL_UTILS || \
+		    BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY) # runtime getconf
+	select BR2_PACKAGE_QEMU
+	select BR2_PACKAGE_QEMU_SYSTEM # runtime for qemu-system-$ARCH
+	select BR2_PACKAGE_COREUTILS # runtime for timeout
+	select BR2_PACKAGE_BASH # runtime
+	select BR2_PACKAGE_NMAP
+	select BR2_PACKAGE_NMAP_NCAT # runtime for ncat
 	select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64
 	help
 	  kvm-unit-tests is a project as old as KVM. As its name
@@ -40,6 +49,10 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
 
 	  http://www.linux-kvm.org/page/KVM-unit-tests
 
-comment "kvm-unit-tests needs a toolchain w/ gcc >= 4.5"
+comment "kvm-unit-tests needs a toolchain w/ utils, gcc >= 8 and qemu"
 	depends on BR2_i386
-	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
+	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8
+	depends on !(BR2_PACKAGE_GLIBC_UTILS || \
+		BR2_UCLIBC_INSTALL_UTILS || \
+		BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY)
+	depends on !BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v6 3/6] package/kvm-unit-tests: bump to v2025-07-31
  2026-02-25 10:55 [Buildroot] [PATCH v6 0/6] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 1/6] toolchain/external: allow installing of libc utils Alex Bennée
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 2/6] package/kvm-unit-tests: update dependencies Alex Bennée
@ 2026-02-25 10:55 ` Alex Bennée
  2026-03-10 22:09   ` Romain Naour via buildroot
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 4/6] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE Alex Bennée
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Alex Bennée @ 2026-02-25 10:55 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Huth, Thomas Huth, Cyril Bur, Jesse Taube

Update to the current version of KVM unit tests. The main change
since the last check point is support for kvmtool to launch tests.

Reviewed-by: Jesse Taube <jesse@rivosinc.com>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
v3
  - reword commit
  - move to current master so we can use kvmtool as well
  - didn't apply th_huth's r-b as moved to master
v4
  - change from snapshot to v2025-07-31
  - reword commit message again
---
 package/kvm-unit-tests/kvm-unit-tests.hash | 2 +-
 package/kvm-unit-tests/kvm-unit-tests.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/kvm-unit-tests/kvm-unit-tests.hash b/package/kvm-unit-tests/kvm-unit-tests.hash
index ad0922df59..6fb7dea2c6 100644
--- a/package/kvm-unit-tests/kvm-unit-tests.hash
+++ b/package/kvm-unit-tests/kvm-unit-tests.hash
@@ -1,4 +1,4 @@
 # Locally computed
-sha256  60015b023f34261c134d714f4670926ac81483e286a16475eb4a5cedab00eefa  kvm-unit-tests-v2025-06-05.tar.bz2
+sha256  8052e1f70bfb3b0c894b8ef71e3847f533b3d957277dd04b3270f33332d4170b  kvm-unit-tests-v2025-07-31.tar.bz2
 sha256  b3c9ca9e257f2eaae070cf0ccdf8770764f05a947a39a835e633413750a5777b  COPYRIGHT
 sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  LICENSE
diff --git a/package/kvm-unit-tests/kvm-unit-tests.mk b/package/kvm-unit-tests/kvm-unit-tests.mk
index 1ed902b1a0..1d7eec2d21 100644
--- a/package/kvm-unit-tests/kvm-unit-tests.mk
+++ b/package/kvm-unit-tests/kvm-unit-tests.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-KVM_UNIT_TESTS_VERSION = 2025-06-05
+KVM_UNIT_TESTS_VERSION = 2025-07-31
 KVM_UNIT_TESTS_SOURCE = kvm-unit-tests-v$(KVM_UNIT_TESTS_VERSION).tar.bz2
 KVM_UNIT_TESTS_SITE = https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/archive/v$(KVM_UNIT_TESTS_VERSION)
 KVM_UNIT_TESTS_LICENSE = GPL-2.0, LGPL-2.0
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v6 4/6] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE
  2026-02-25 10:55 [Buildroot] [PATCH v6 0/6] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
                   ` (2 preceding siblings ...)
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 3/6] package/kvm-unit-tests: bump to v2025-07-31 Alex Bennée
@ 2026-02-25 10:55 ` Alex Bennée
  2026-03-10 22:16   ` Romain Naour via buildroot
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 5/6] support/testing: add test for kvm-unit-tests Alex Bennée
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 6/6] package/kvm-unit-tests: allow kvmtool to be used Alex Bennée
  5 siblings, 1 reply; 14+ messages in thread
From: Alex Bennée @ 2026-02-25 10:55 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Huth, Thomas Huth, Cyril Bur

The latest kvm-unit-tests defaults to 4k but there is no reason why we
shouldn't honour the system page size if it is set.

Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 package/kvm-unit-tests/kvm-unit-tests.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/package/kvm-unit-tests/kvm-unit-tests.mk b/package/kvm-unit-tests/kvm-unit-tests.mk
index 1d7eec2d21..efc3c859aa 100644
--- a/package/kvm-unit-tests/kvm-unit-tests.mk
+++ b/package/kvm-unit-tests/kvm-unit-tests.mk
@@ -40,6 +40,14 @@ KVM_UNIT_TESTS_CONF_OPTS =\
 	--processor="$(GCC_TARGET_CPU)" \
 	--endian="$(KVM_UNIT_TESTS_ENDIAN)"
 
+ifeq ($(BR2_ARM64_PAGE_SIZE_4K),y)
+KVM_UNIT_TESTS_CONF_OPTS += --page-size=4k
+else ifeq ($(BR2_ARM64_PAGE_SIZE_16K),y)
+KVM_UNIT_TESTS_CONF_OPTS += --page-size=16k
+else ifeq ($(BR2_ARM64_PAGE_SIZE_64K),y)
+KVM_UNIT_TESTS_CONF_OPTS += --page-size=64k
+endif
+
 # For all architectures but x86-64, we use the target
 # compiler. However, for x86-64, we use the host compiler, as
 # kvm-unit-tests builds 32 bit code, which Buildroot toolchains for
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v6 5/6] support/testing: add test for kvm-unit-tests
  2026-02-25 10:55 [Buildroot] [PATCH v6 0/6] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
                   ` (3 preceding siblings ...)
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 4/6] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE Alex Bennée
@ 2026-02-25 10:55 ` Alex Bennée
  2026-03-10 22:31   ` Romain Naour via buildroot
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 6/6] package/kvm-unit-tests: allow kvmtool to be used Alex Bennée
  5 siblings, 1 reply; 14+ messages in thread
From: Alex Bennée @ 2026-02-25 10:55 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

Now we have updated kvm-unit-tests we should defend it with a test. To
support that enable KVM in the qemu kernel config and boot an image
where we can run the basic tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 board/qemu/aarch64-virt/linux.config      |  2 +
 support/testing/tests/package/test_kvm.py | 47 +++++++++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100644 support/testing/tests/package/test_kvm.py

diff --git a/board/qemu/aarch64-virt/linux.config b/board/qemu/aarch64-virt/linux.config
index 971b9fcf86..9d1934c648 100644
--- a/board/qemu/aarch64-virt/linux.config
+++ b/board/qemu/aarch64-virt/linux.config
@@ -74,3 +74,5 @@ CONFIG_VIRTIO_FS=y
 CONFIG_OVERLAY_FS=y
 CONFIG_TMPFS=y
 CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_VIRTUALIZATION=y
+CONFIG_KVM=y
diff --git a/support/testing/tests/package/test_kvm.py b/support/testing/tests/package/test_kvm.py
new file mode 100644
index 0000000000..da5ebfb1b7
--- /dev/null
+++ b/support/testing/tests/package/test_kvm.py
@@ -0,0 +1,47 @@
+import os
+import infra.basetest
+
+KVM_TIMEOUT = 120
+
+
+class TestKVM(infra.basetest.BRTest):
+    config = \
+        """
+        BR2_aarch64=y
+        BR2_cortex_a72=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY=y
+        BR2_OPTIMIZE_S=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
+        BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+        BR2_PACKAGE_KVM_UNIT_TESTS=y
+        # BR2_PACKAGE_QEMU_SYSTEM_TCG is not set
+        # BR2_PACKAGE_QEMU_BLOBS is not set
+        BR2_TARGET_ROOTFS_EXT2=y
+        """
+
+    def test_run(self):
+        kern = os.path.join(self.builddir, "images", "Image")
+        img = os.path.join(self.builddir, "images", "rootfs.ext2")
+
+        qemu_opts = ["-M", "virt,gic-version=3,virtualization=on",
+                     "-cpu", "cortex-a72",
+                     "-smp", "2",
+                     "-m", "512M",
+                     "-drive", f"file={img},if=virtio,format=raw", "-snapshot"]
+
+        self.emulator.boot(arch="aarch64",
+                           kernel=kern,
+                           kernel_cmdline=["root=/dev/vda console=ttyAMA0"],
+                           options=qemu_opts)
+
+        self.emulator.login()
+
+        # Run the selftests
+        self.assertRunOk("/usr/share/kvm-unit-tests/selftest-setup")
+        self.assertRunOk("/usr/share/kvm-unit-tests/selftest-smp")
+        self.assertRunOk("/usr/share/kvm-unit-tests/selftest-vectors-kernel")
+        self.assertRunOk("/usr/share/kvm-unit-tests/selftest-vectors-user")
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v6 6/6] package/kvm-unit-tests: allow kvmtool to be used
  2026-02-25 10:55 [Buildroot] [PATCH v6 0/6] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
                   ` (4 preceding siblings ...)
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 5/6] support/testing: add test for kvm-unit-tests Alex Bennée
@ 2026-02-25 10:55 ` Alex Bennée
  2026-03-10 22:44   ` Romain Naour via buildroot
  5 siblings, 1 reply; 14+ messages in thread
From: Alex Bennée @ 2026-02-25 10:55 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Huth, Thomas Huth, Cyril Bur

For some targets launching tests with kvmtool is an option which makes
for an even smaller test image. Create a new symbol which can be
expanded with additional targets that will allow the skipping of the
selection of QEMU if not needed.

Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
v2
  - expand to include riscv, didn't bother with 32 bit arm given its deprecated
  - only expand target when arch can support it
  - update comment depends
---
 package/kvm-unit-tests/Config.in         | 12 +++++++++---
 package/kvm-unit-tests/kvm-unit-tests.mk | 11 +++++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
index 74c32f46e0..f5b4177106 100644
--- a/package/kvm-unit-tests/Config.in
+++ b/package/kvm-unit-tests/Config.in
@@ -13,6 +13,11 @@ config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
 	default y if BR2_powerpc64 || BR2_powerpc64le
 	default y if BR2_s390x
 
+# Some architectures can use kvmtool instead of QEMU to launch the tests
+config BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL
+	bool
+	default y if (BR2_aarch64 || BR2_riscv) && BR2_PACKAGE_KVMTOOL
+
 config BR2_PACKAGE_KVM_UNIT_TESTS
 	bool "kvm-unit-tests"
 	depends on BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
@@ -24,8 +29,8 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
 	depends on (BR2_PACKAGE_GLIBC_UTILS || \
 		    BR2_UCLIBC_INSTALL_UTILS || \
 		    BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY) # runtime getconf
-	select BR2_PACKAGE_QEMU
-	select BR2_PACKAGE_QEMU_SYSTEM # runtime for qemu-system-$ARCH
+	select BR2_PACKAGE_QEMU if !BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL
+	select BR2_PACKAGE_QEMU_SYSTEM if !BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL # runtime for qemu-system-$ARCH
 	select BR2_PACKAGE_COREUTILS # runtime for timeout
 	select BR2_PACKAGE_BASH # runtime
 	select BR2_PACKAGE_NMAP
@@ -55,4 +60,5 @@ comment "kvm-unit-tests needs a toolchain w/ utils, gcc >= 8 and qemu"
 	depends on !(BR2_PACKAGE_GLIBC_UTILS || \
 		BR2_UCLIBC_INSTALL_UTILS || \
 		BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY)
-	depends on !BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET
+	depends on !(BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET || \
+		BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL)
diff --git a/package/kvm-unit-tests/kvm-unit-tests.mk b/package/kvm-unit-tests/kvm-unit-tests.mk
index efc3c859aa..02191275a2 100644
--- a/package/kvm-unit-tests/kvm-unit-tests.mk
+++ b/package/kvm-unit-tests/kvm-unit-tests.mk
@@ -40,6 +40,17 @@ KVM_UNIT_TESTS_CONF_OPTS =\
 	--processor="$(GCC_TARGET_CPU)" \
 	--endian="$(KVM_UNIT_TESTS_ENDIAN)"
 
+# The default runner is QEMU but kvmtool can also be used on some
+# architectures. The flag only works for those architectures that can
+# support both.
+ifeq ($(BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL), y)
+ifeq ($(BR2_PACKAGE_QEMU_SYSTEM),y)
+KVM_UNIT_TESTS_CONF_OPTS += --target=qemu
+else ifeq ($(BR2_PACKAGE_KVMTOOL),y)
+KVM_UNIT_TESTS_CONF_OPTS += --target=kvmtool
+endif
+endif
+
 ifeq ($(BR2_ARM64_PAGE_SIZE_4K),y)
 KVM_UNIT_TESTS_CONF_OPTS += --page-size=4k
 else ifeq ($(BR2_ARM64_PAGE_SIZE_16K),y)
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v6 1/6] toolchain/external: allow installing of libc utils
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 1/6] toolchain/external: allow installing of libc utils Alex Bennée
@ 2026-03-10 21:53   ` Romain Naour via buildroot
  0 siblings, 0 replies; 14+ messages in thread
From: Romain Naour via buildroot @ 2026-03-10 21:53 UTC (permalink / raw)
  To: Alex Bennée, buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni

Hello Alex, All,

Le 25/02/2026 à 11:55, Alex Bennée a écrit :
> For buildroot's own tools we have BR2_PACKAGE_GLIBC_UTILS (and similar
> for ulibc). As we need the tools for somethings we should also support
> this for external toolchains.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  toolchain/toolchain-external/Config.in        |  7 ++++++
>  .../pkg-toolchain-external.mk                 | 24 +++++++++++++++++++
>  2 files changed, 31 insertions(+)
> 
> diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
> index 831387bc4e..e79dafa365 100644
> --- a/toolchain/toolchain-external/Config.in
> +++ b/toolchain/toolchain-external/Config.in
> @@ -125,4 +125,11 @@ config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
>  	  Copy the gdbserver provided by the external toolchain to the
>  	  target.
>  
> +config BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY
> +	bool "Install libc utilities"
> +	depends on BR2_TOOLCHAIN_EXTERNAL

depends on BR2_TOOLCHAIN_EXTERNAL_GLIBC

> +	help
> +	  Enabling this option will compile and install the getconf,

Since its an external toolchain, nothing is actually built, just imported into
Buildroot.

> +	  ldd and locale gibc utilities for the target.                         ^^^^
                         glibc

Since it's based on BR2_PACKAGE_GLIBC_UTILS, this option should only appear when
a glibc based external toolchain is selected.

If you want to make this option available for musl and uClibc-ng toolchain we
have to take care that:

  - getconf is not avaible with musl toolchains
  - locales is optional with uClibc-ng toolchains
  - ldd script is specific to glibc
  - uClibc-ng sometime "pretend" to be glibc lookalike

I'm fine if we only do that for glibc toolchain for now (in order to move
forward on KVM topic)

We already have an option BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY that is glibc
specific.

> +
>  endif # BR2_TOOLCHAIN_EXTERNAL
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index 270cf814ed..b84abb6106 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -446,6 +446,29 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER
>  endef
>  endif
>  
> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY),y)
> +define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBC_UTILS
> +	$(Q)$(call MESSAGE,"Copying libc utils")
> +	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> +	utils_found=0 ; \
> +	for d in $${ARCH_SYSROOT_DIR} \
> +	         $${ARCH_SYSROOT_DIR}/usr \
> +		 $(TOOLCHAIN_EXTERNAL_INSTALL_DIR); do \
> +		if test -f $${d}/bin/getconf ; then \
> +			for f in getconf ldd locale; do \

It probably better to do the for loop for each tools and test one by one if they
are available otherwise error out. Custom toolchains content may be surprising.

BR2_PACKAGE_GLIBC_UTILS also handle 'ldconfig' copy to sbin. (If we want to have
something similar).

> +				install -m 0755 -D $${d}/bin/$${f} $(TARGET_DIR)/usr/bin ; \
> +			done ; \
> +			utils_found=1 ; \
> +			break ; \
> +		fi ; \
> +	done ; \
> +	if [ $${utils_found} -eq 0 ] ; then \
> +		echo "Could not find libc utils in external toolchain" ; \

It would be better to error out with the missing tool instead.

Best regards,
Romain


> +		exit 1 ; \
> +	fi
> +endef
> +endif
> +
>  define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
>  	$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
>  	ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> @@ -627,6 +650,7 @@ endef
>  define $(2)_INSTALL_TARGET_CMDS
>  	$$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK)
>  	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
> +	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBC_UTILS)
>  	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER)
>  	$$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
>  	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LDD)

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v6 2/6] package/kvm-unit-tests: update dependencies
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 2/6] package/kvm-unit-tests: update dependencies Alex Bennée
@ 2026-03-10 22:02   ` Romain Naour via buildroot
  2026-03-10 22:07     ` Romain Naour via buildroot
  0 siblings, 1 reply; 14+ messages in thread
From: Romain Naour via buildroot @ 2026-03-10 22:02 UTC (permalink / raw)
  To: Alex Bennée, buildroot; +Cc: Thomas Huth, Thomas Huth, Cyril Bur

Hello Alex, All,

Le 25/02/2026 à 11:55, Alex Bennée a écrit :
> To run the tests we need a system QEMU, timeout, getconf and nmap-ncat
> so update the select/depends for them. As we need at least GCC 8 we
> can drop the specific requirement for old x86-64 tests.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Thomas Huth <th.huth@posteo.eu>
> 
> ---
> v2
>   - remove old gcc notes as we need at least 8 anyway
>   - select QEMU and other runtime deps
>   - mention the runtime deps
>   - add support for getconf from external toolchain
>   - update comment fallback
> v5
>   - keep i386/x86-64 target/host comments
>   - add !BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET to comment deps
> ---
>  package/kvm-unit-tests/Config.in | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
> index 817d3c4a8f..74c32f46e0 100644
> --- a/package/kvm-unit-tests/Config.in
> +++ b/package/kvm-unit-tests/Config.in
> @@ -16,11 +16,20 @@ config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
>  config BR2_PACKAGE_KVM_UNIT_TESTS
>  	bool "kvm-unit-tests"
>  	depends on BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
> -	# on i386 and x86-64, __builtin_reachable is used, so we need
> -	# gcc 4.5 at least. on i386, we use the target gcc, while on
> +	# On i386, we use the target gcc, while on
>  	# x86-64 we use the host gcc (see .mk file for details)
> -	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 || !BR2_i386
>  	depends on BR2_HOSTARCH = "x86_64" || !BR2_x86_64
> +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_8 # qemu
> +	depends on BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET
> +	depends on (BR2_PACKAGE_GLIBC_UTILS || \
> +		    BR2_UCLIBC_INSTALL_UTILS || \
> +		    BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY) # runtime getconf
> +	select BR2_PACKAGE_QEMU
> +	select BR2_PACKAGE_QEMU_SYSTEM # runtime for qemu-system-$ARCH
> +	select BR2_PACKAGE_COREUTILS # runtime for timeout
> +	select BR2_PACKAGE_BASH # runtime
> +	select BR2_PACKAGE_NMAP
> +	select BR2_PACKAGE_NMAP_NCAT # runtime for ncat
>  	select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64
>  	help
>  	  kvm-unit-tests is a project as old as KVM. As its name
> @@ -40,6 +49,10 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
>  
>  	  http://www.linux-kvm.org/page/KVM-unit-tests

Not related to this patch, but this link could have been updated to https.

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain


>  
> -comment "kvm-unit-tests needs a toolchain w/ gcc >= 4.5"
> +comment "kvm-unit-tests needs a toolchain w/ utils, gcc >= 8 and qemu"
>  	depends on BR2_i386
> -	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
> +	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8
> +	depends on !(BR2_PACKAGE_GLIBC_UTILS || \
> +		BR2_UCLIBC_INSTALL_UTILS || \
> +		BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY)
> +	depends on !BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v6 2/6] package/kvm-unit-tests: update dependencies
  2026-03-10 22:02   ` Romain Naour via buildroot
@ 2026-03-10 22:07     ` Romain Naour via buildroot
  0 siblings, 0 replies; 14+ messages in thread
From: Romain Naour via buildroot @ 2026-03-10 22:07 UTC (permalink / raw)
  To: Alex Bennée, buildroot; +Cc: Thomas Huth, Thomas Huth, Cyril Bur

Le 10/03/2026 à 23:02, Romain Naour a écrit :
> Hello Alex, All,
> 
> Le 25/02/2026 à 11:55, Alex Bennée a écrit :
>> To run the tests we need a system QEMU, timeout, getconf and nmap-ncat
>> so update the select/depends for them. As we need at least GCC 8 we
>> can drop the specific requirement for old x86-64 tests.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Reviewed-by: Thomas Huth <th.huth@posteo.eu>
>>
>> ---
>> v2
>>   - remove old gcc notes as we need at least 8 anyway
>>   - select QEMU and other runtime deps
>>   - mention the runtime deps
>>   - add support for getconf from external toolchain
>>   - update comment fallback
>> v5
>>   - keep i386/x86-64 target/host comments
>>   - add !BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET to comment deps
>> ---
>>  package/kvm-unit-tests/Config.in | 23 ++++++++++++++++++-----
>>  1 file changed, 18 insertions(+), 5 deletions(-)
>>
>> diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
>> index 817d3c4a8f..74c32f46e0 100644
>> --- a/package/kvm-unit-tests/Config.in
>> +++ b/package/kvm-unit-tests/Config.in
>> @@ -16,11 +16,20 @@ config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
>>  config BR2_PACKAGE_KVM_UNIT_TESTS
>>  	bool "kvm-unit-tests"
>>  	depends on BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
>> -	# on i386 and x86-64, __builtin_reachable is used, so we need
>> -	# gcc 4.5 at least. on i386, we use the target gcc, while on
>> +	# On i386, we use the target gcc, while on
>>  	# x86-64 we use the host gcc (see .mk file for details)
>> -	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 || !BR2_i386
>>  	depends on BR2_HOSTARCH = "x86_64" || !BR2_x86_64
>> +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_8 # qemu
>> +	depends on BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET
>> +	depends on (BR2_PACKAGE_GLIBC_UTILS || \
>> +		    BR2_UCLIBC_INSTALL_UTILS || \
>> +		    BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY) # runtime getconf
>> +	select BR2_PACKAGE_QEMU
>> +	select BR2_PACKAGE_QEMU_SYSTEM # runtime for qemu-system-$ARCH
>> +	select BR2_PACKAGE_COREUTILS # runtime for timeout
>> +	select BR2_PACKAGE_BASH # runtime

Select bash here requires to select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS first.

WARNING: unmet direct dependencies detected for BR2_PACKAGE_BASH
  Depends on [n]: BR2_USE_MMU [=y] && BR2_PACKAGE_BUSYBOX_SHOW_OTHERS [=n]

>> +	select BR2_PACKAGE_NMAP
>> +	select BR2_PACKAGE_NMAP_NCAT # runtime for ncat

Same for nmap and coreutils they requires BR2_PACKAGE_BUSYBOX_SHOW_OTHERS.

>>  	select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64
>>  	help
>>  	  kvm-unit-tests is a project as old as KVM. As its name
>> @@ -40,6 +49,10 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
>>  
>>  	  http://www.linux-kvm.org/page/KVM-unit-tests
> 
> Not related to this patch, but this link could have been updated to https.
> 
> Reviewed-by: Romain Naour <romain.naour@smile.fr>

With that fixed...

Best regards,
Romain


> 
> Best regards,
> Romain
> 
> 
>>  
>> -comment "kvm-unit-tests needs a toolchain w/ gcc >= 4.5"
>> +comment "kvm-unit-tests needs a toolchain w/ utils, gcc >= 8 and qemu"
>>  	depends on BR2_i386
>> -	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
>> +	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8
>> +	depends on !(BR2_PACKAGE_GLIBC_UTILS || \
>> +		BR2_UCLIBC_INSTALL_UTILS || \
>> +		BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY)
>> +	depends on !BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v6 3/6] package/kvm-unit-tests: bump to v2025-07-31
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 3/6] package/kvm-unit-tests: bump to v2025-07-31 Alex Bennée
@ 2026-03-10 22:09   ` Romain Naour via buildroot
  0 siblings, 0 replies; 14+ messages in thread
From: Romain Naour via buildroot @ 2026-03-10 22:09 UTC (permalink / raw)
  To: Alex Bennée, buildroot
  Cc: Thomas Huth, Thomas Huth, Cyril Bur, Jesse Taube

Hello Alex, All,

Le 25/02/2026 à 11:55, Alex Bennée a écrit :
> Update to the current version of KVM unit tests. The main change
> since the last check point is support for kvmtool to launch tests.
> 
> Reviewed-by: Jesse Taube <jesse@rivosinc.com>
> Reviewed-by: Thomas Huth <huth@tuxfamily.org>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Checked "legal info"

Best regards,
Romain


> 
> ---
> v3
>   - reword commit
>   - move to current master so we can use kvmtool as well
>   - didn't apply th_huth's r-b as moved to master
> v4
>   - change from snapshot to v2025-07-31
>   - reword commit message again
> ---
>  package/kvm-unit-tests/kvm-unit-tests.hash | 2 +-
>  package/kvm-unit-tests/kvm-unit-tests.mk   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/package/kvm-unit-tests/kvm-unit-tests.hash b/package/kvm-unit-tests/kvm-unit-tests.hash
> index ad0922df59..6fb7dea2c6 100644
> --- a/package/kvm-unit-tests/kvm-unit-tests.hash
> +++ b/package/kvm-unit-tests/kvm-unit-tests.hash
> @@ -1,4 +1,4 @@
>  # Locally computed
> -sha256  60015b023f34261c134d714f4670926ac81483e286a16475eb4a5cedab00eefa  kvm-unit-tests-v2025-06-05.tar.bz2
> +sha256  8052e1f70bfb3b0c894b8ef71e3847f533b3d957277dd04b3270f33332d4170b  kvm-unit-tests-v2025-07-31.tar.bz2
>  sha256  b3c9ca9e257f2eaae070cf0ccdf8770764f05a947a39a835e633413750a5777b  COPYRIGHT
>  sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  LICENSE
> diff --git a/package/kvm-unit-tests/kvm-unit-tests.mk b/package/kvm-unit-tests/kvm-unit-tests.mk
> index 1ed902b1a0..1d7eec2d21 100644
> --- a/package/kvm-unit-tests/kvm-unit-tests.mk
> +++ b/package/kvm-unit-tests/kvm-unit-tests.mk
> @@ -4,7 +4,7 @@
>  #
>  ################################################################################
>  
> -KVM_UNIT_TESTS_VERSION = 2025-06-05
> +KVM_UNIT_TESTS_VERSION = 2025-07-31
>  KVM_UNIT_TESTS_SOURCE = kvm-unit-tests-v$(KVM_UNIT_TESTS_VERSION).tar.bz2
>  KVM_UNIT_TESTS_SITE = https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/archive/v$(KVM_UNIT_TESTS_VERSION)
>  KVM_UNIT_TESTS_LICENSE = GPL-2.0, LGPL-2.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v6 4/6] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 4/6] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE Alex Bennée
@ 2026-03-10 22:16   ` Romain Naour via buildroot
  0 siblings, 0 replies; 14+ messages in thread
From: Romain Naour via buildroot @ 2026-03-10 22:16 UTC (permalink / raw)
  To: Alex Bennée, buildroot; +Cc: Thomas Huth, Thomas Huth, Cyril Bur

Hello Alex, All,

Le 25/02/2026 à 11:55, Alex Bennée a écrit :
> The latest kvm-unit-tests defaults to 4k but there is no reason why we
> shouldn't honour the system page size if it is set.

Indeed. Have your tried the kvm-unit-tests runtime test with different page size?

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain

> 
> Reviewed-by: Thomas Huth <huth@tuxfamily.org>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  package/kvm-unit-tests/kvm-unit-tests.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/kvm-unit-tests/kvm-unit-tests.mk b/package/kvm-unit-tests/kvm-unit-tests.mk
> index 1d7eec2d21..efc3c859aa 100644
> --- a/package/kvm-unit-tests/kvm-unit-tests.mk
> +++ b/package/kvm-unit-tests/kvm-unit-tests.mk
> @@ -40,6 +40,14 @@ KVM_UNIT_TESTS_CONF_OPTS =\
>  	--processor="$(GCC_TARGET_CPU)" \
>  	--endian="$(KVM_UNIT_TESTS_ENDIAN)"
>  
> +ifeq ($(BR2_ARM64_PAGE_SIZE_4K),y)
> +KVM_UNIT_TESTS_CONF_OPTS += --page-size=4k
> +else ifeq ($(BR2_ARM64_PAGE_SIZE_16K),y)
> +KVM_UNIT_TESTS_CONF_OPTS += --page-size=16k
> +else ifeq ($(BR2_ARM64_PAGE_SIZE_64K),y)
> +KVM_UNIT_TESTS_CONF_OPTS += --page-size=64k
> +endif
> +
>  # For all architectures but x86-64, we use the target
>  # compiler. However, for x86-64, we use the host compiler, as
>  # kvm-unit-tests builds 32 bit code, which Buildroot toolchains for

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v6 5/6] support/testing: add test for kvm-unit-tests
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 5/6] support/testing: add test for kvm-unit-tests Alex Bennée
@ 2026-03-10 22:31   ` Romain Naour via buildroot
  0 siblings, 0 replies; 14+ messages in thread
From: Romain Naour via buildroot @ 2026-03-10 22:31 UTC (permalink / raw)
  To: Alex Bennée, buildroot; +Cc: Romain Naour

Hello Alex, All,

Le 25/02/2026 à 11:55, Alex Bennée a écrit :
> Now we have updated kvm-unit-tests we should defend it with a test. To
> support that enable KVM in the qemu kernel config and boot an image
> where we can run the basic tests.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  board/qemu/aarch64-virt/linux.config      |  2 +
>  support/testing/tests/package/test_kvm.py | 47 +++++++++++++++++++++++
>  2 files changed, 49 insertions(+)
>  create mode 100644 support/testing/tests/package/test_kvm.py
> 
> diff --git a/board/qemu/aarch64-virt/linux.config b/board/qemu/aarch64-virt/linux.config
> index 971b9fcf86..9d1934c648 100644
> --- a/board/qemu/aarch64-virt/linux.config
> +++ b/board/qemu/aarch64-virt/linux.config
> @@ -74,3 +74,5 @@ CONFIG_VIRTIO_FS=y
>  CONFIG_OVERLAY_FS=y
>  CONFIG_TMPFS=y
>  CONFIG_TMPFS_POSIX_ACL=y
> +CONFIG_VIRTUALIZATION=y
> +CONFIG_KVM=y

This configuration file is used by qemu_aarch64_virt_defconfig that is used for
basic testing on Gitlab-ci. Maybe you could enable KVM and VIRTUALIZATION
options using a defconfig fragment in TestKVM?

> diff --git a/support/testing/tests/package/test_kvm.py b/support/testing/tests/package/test_kvm.py
> new file mode 100644
> index 0000000000..da5ebfb1b7
> --- /dev/null
> +++ b/support/testing/tests/package/test_kvm.py
> @@ -0,0 +1,47 @@
> +import os
> +import infra.basetest
> +
> +KVM_TIMEOUT = 120
> +
> +
> +class TestKVM(infra.basetest.BRTest):
> +    config = \
> +        """
> +        BR2_aarch64=y
> +        BR2_cortex_a72=y
> +        BR2_TOOLCHAIN_EXTERNAL=y

This select the ARM prebuilt toolchain, we nowadays prefer using the Bootlin one.

> +        BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY=y
> +        BR2_OPTIMIZE_S=y

Why enabling -Os here instead using the default?

> +        BR2_TARGET_ROOTFS_CPIO=y
> +        BR2_LINUX_KERNEL=y
> +        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
> +        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
> +        BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y

See, you enabled BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y to select
BR2_PACKAGE_KVM_UNIT_TESTS without issue.

> +        BR2_PACKAGE_KVM_UNIT_TESTS=y
> +        # BR2_PACKAGE_QEMU_SYSTEM_TCG is not set
> +        # BR2_PACKAGE_QEMU_BLOBS is not set
> +        BR2_TARGET_ROOTFS_EXT2=y

This test install many packages already, maybe you should increase the rootfs
size with BR2_TARGET_ROOTFS_EXT2_SIZE="256M" (maybe more).

> +        """
> +
> +    def test_run(self):
> +        kern = os.path.join(self.builddir, "images", "Image")
> +        img = os.path.join(self.builddir, "images", "rootfs.ext2")
> +
> +        qemu_opts = ["-M", "virt,gic-version=3,virtualization=on",

Is any dependency on Qemu version used for this test ?
By default, the runtime test infra use qemu installed on the host. It can be a
very old version. You can fix this by selecting host-qemu package.

BR2_PACKAGE_HOST_QEMU=y
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y


> +                     "-cpu", "cortex-a72",
> +                     "-smp", "2",
> +                     "-m", "512M",
> +                     "-drive", f"file={img},if=virtio,format=raw", "-snapshot"]
> +
> +        self.emulator.boot(arch="aarch64",
> +                           kernel=kern,
> +                           kernel_cmdline=["root=/dev/vda console=ttyAMA0"],
> +                           options=qemu_opts)
> +
> +        self.emulator.login()
> +
> +        # Run the selftests
> +        self.assertRunOk("/usr/share/kvm-unit-tests/selftest-setup")
> +        self.assertRunOk("/usr/share/kvm-unit-tests/selftest-smp")
> +        self.assertRunOk("/usr/share/kvm-unit-tests/selftest-vectors-kernel")
> +        self.assertRunOk("/usr/share/kvm-unit-tests/selftest-vectors-user")

Best regards,
Romain


_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v6 6/6] package/kvm-unit-tests: allow kvmtool to be used
  2026-02-25 10:55 ` [Buildroot] [PATCH v6 6/6] package/kvm-unit-tests: allow kvmtool to be used Alex Bennée
@ 2026-03-10 22:44   ` Romain Naour via buildroot
  0 siblings, 0 replies; 14+ messages in thread
From: Romain Naour via buildroot @ 2026-03-10 22:44 UTC (permalink / raw)
  To: Alex Bennée, buildroot; +Cc: Thomas Huth, Thomas Huth, Cyril Bur

Hello Alex, All,

Le 25/02/2026 à 11:55, Alex Bennée a écrit :
> For some targets launching tests with kvmtool is an option which makes
> for an even smaller test image. Create a new symbol which can be
> expanded with additional targets that will allow the skipping of the
> selection of QEMU if not needed.
> 
> Reviewed-by: Thomas Huth <huth@tuxfamily.org>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> 
> ---
> v2
>   - expand to include riscv, didn't bother with 32 bit arm given its deprecated
>   - only expand target when arch can support it
>   - update comment depends
> ---
>  package/kvm-unit-tests/Config.in         | 12 +++++++++---
>  package/kvm-unit-tests/kvm-unit-tests.mk | 11 +++++++++++
>  2 files changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
> index 74c32f46e0..f5b4177106 100644
> --- a/package/kvm-unit-tests/Config.in
> +++ b/package/kvm-unit-tests/Config.in
> @@ -13,6 +13,11 @@ config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
>  	default y if BR2_powerpc64 || BR2_powerpc64le
>  	default y if BR2_s390x
>  
> +# Some architectures can use kvmtool instead of QEMU to launch the tests
> +config BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL
> +	bool
> +	default y if (BR2_aarch64 || BR2_riscv) && BR2_PACKAGE_KVMTOOL

Since it's a choice, It would be better to let the user select if KVMTOOL or
QEMU should be used.

> +
>  config BR2_PACKAGE_KVM_UNIT_TESTS
>  	bool "kvm-unit-tests"
>  	depends on BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
> @@ -24,8 +29,8 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
>  	depends on (BR2_PACKAGE_GLIBC_UTILS || \
>  		    BR2_UCLIBC_INSTALL_UTILS || \
>  		    BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY) # runtime getconf
> -	select BR2_PACKAGE_QEMU
> -	select BR2_PACKAGE_QEMU_SYSTEM # runtime for qemu-system-$ARCH
> +	select BR2_PACKAGE_QEMU if !BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL
> +	select BR2_PACKAGE_QEMU_SYSTEM if !BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL # runtime for qemu-system-$ARCH
>  	select BR2_PACKAGE_COREUTILS # runtime for timeout
>  	select BR2_PACKAGE_BASH # runtime
>  	select BR2_PACKAGE_NMAP
> @@ -55,4 +60,5 @@ comment "kvm-unit-tests needs a toolchain w/ utils, gcc >= 8 and qemu"

When BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL is set, the comment is not
accurate since it contains 'qemu'.

>  	depends on !(BR2_PACKAGE_GLIBC_UTILS || \
>  		BR2_UCLIBC_INSTALL_UTILS || \
>  		BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY)
> -	depends on !BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET
> +	depends on !(BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET || \
> +		BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL)
> diff --git a/package/kvm-unit-tests/kvm-unit-tests.mk b/package/kvm-unit-tests/kvm-unit-tests.mk
> index efc3c859aa..02191275a2 100644
> --- a/package/kvm-unit-tests/kvm-unit-tests.mk
> +++ b/package/kvm-unit-tests/kvm-unit-tests.mk
> @@ -40,6 +40,17 @@ KVM_UNIT_TESTS_CONF_OPTS =\
>  	--processor="$(GCC_TARGET_CPU)" \
>  	--endian="$(KVM_UNIT_TESTS_ENDIAN)"
>  
> +# The default runner is QEMU but kvmtool can also be used on some
> +# architectures. The flag only works for those architectures that can
> +# support both.
> +ifeq ($(BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL), y)
> +ifeq ($(BR2_PACKAGE_QEMU_SYSTEM),y)
> +KVM_UNIT_TESTS_CONF_OPTS += --target=qemu
> +else ifeq ($(BR2_PACKAGE_KVMTOOL),y)
> +KVM_UNIT_TESTS_CONF_OPTS += --target=kvmtool

What if BR2_PACKAGE_QEMU_SYSTEM and BR2_PACKAGE_KVMTOOL are both enabled and the
used want to run tests with kvmtool ?

Best regards,
Romain


> +endif
> +endif
> +
>  ifeq ($(BR2_ARM64_PAGE_SIZE_4K),y)
>  KVM_UNIT_TESTS_CONF_OPTS += --page-size=4k
>  else ifeq ($(BR2_ARM64_PAGE_SIZE_16K),y)

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2026-03-10 22:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25 10:55 [Buildroot] [PATCH v6 0/6] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
2026-02-25 10:55 ` [Buildroot] [PATCH v6 1/6] toolchain/external: allow installing of libc utils Alex Bennée
2026-03-10 21:53   ` Romain Naour via buildroot
2026-02-25 10:55 ` [Buildroot] [PATCH v6 2/6] package/kvm-unit-tests: update dependencies Alex Bennée
2026-03-10 22:02   ` Romain Naour via buildroot
2026-03-10 22:07     ` Romain Naour via buildroot
2026-02-25 10:55 ` [Buildroot] [PATCH v6 3/6] package/kvm-unit-tests: bump to v2025-07-31 Alex Bennée
2026-03-10 22:09   ` Romain Naour via buildroot
2026-02-25 10:55 ` [Buildroot] [PATCH v6 4/6] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE Alex Bennée
2026-03-10 22:16   ` Romain Naour via buildroot
2026-02-25 10:55 ` [Buildroot] [PATCH v6 5/6] support/testing: add test for kvm-unit-tests Alex Bennée
2026-03-10 22:31   ` Romain Naour via buildroot
2026-02-25 10:55 ` [Buildroot] [PATCH v6 6/6] package/kvm-unit-tests: allow kvmtool to be used Alex Bennée
2026-03-10 22:44   ` Romain Naour via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox