Skip to contentSkip to conversation

tests patches

GIT PULL Applied Thomas Huth 2 participants 11 messages Jan 27 – Jan 28 RISC-V

lore
Share & tools
lore
#0 lore raw

Hi Richard!

The following changes since commit f26976b9d30496d28bd4fd045f4300706e567a29:

Merge tag 'pull-vfio-20260126' of https://github.com/legoater/qemu into staging (2026-01-27 07:14:11 +1100)

are available in the Git repository at:

https://gitlab.com/thuth/qemu.git tags/pull-request-2026-01-27

for you to fetch changes up to 161ea5a63413dd5efc07205483c1070a6e859785:

tests/functional: Enforce sha256 as hashsum algorithm for all tests (2026-01-27 15:20:43 +0100)

----------------------------------------------------------------
* gitlab: preserve base rules for container template
* Fix some issues to make QEMU compilable on non-mainstream distros again
* Enforce sha256 as hashsum algorithm for all functional tests

----------------------------------------------------------------
Daniel P. Berrangé (1):
gitlab: preserve base rules for container template

Thomas Huth (8):
tests/functional/riscv64: Silence warnings from Pylint in the boston test tests/functional/x86_64: Limit the memlock test to Linux hosts tests/functional/x86_64: Use the right Python interpreter & fix format string tests/tracetool: Honor the Python interpreter that "configure" detected pc-bios/optionrom: Use 32-bit linker emulation for the optionroms tests/vm: Update netbsd VM to version 10.1
tests/vm: Make the haiku VM usable again
tests/functional: Enforce sha256 as hashsum algorithm for all tests

 configure                                   |  8 +++++++-
 .gitlab-ci.d/container-template.yml         |  5 ++---
 pc-bios/optionrom/Makefile                  |  2 +-
 scripts/qemu-plugin-symbols.py              |  0
 tests/functional/ppc64/test_fadump.py       |  4 +---
 tests/functional/qemu_test/__init__.py      |  4 ++--
 tests/functional/qemu_test/asset.py         |  4 +---
 tests/functional/qemu_test/decorators.py    | 12 ++++++++++++
 tests/functional/riscv64/test_boston.py     | 11 +++++++----
 tests/functional/x86_64/test_bad_vmstate.py |  6 ++++--
 tests/functional/x86_64/test_memlock.py     |  3 ++-
 tests/tracetool/tracetool-test.py           |  3 ++-
 tests/vm/haiku.x86_64                       |  4 ++++
 tests/vm/netbsd                             | 16 ++++++++--------
 14 files changed, 53 insertions(+), 29 deletions(-)
 mode change 100755 => 100644 scripts/qemu-plugin-symbols.py
#1 lore raw

[PULL 9/9] tests/functional: Enforce sha256 as hashsum algorithm for all tests

From: Thomas Huth <[email protected]>

The functional testing framework currently supports both, sha256 and sha512 as hashsums for the assets. However, all but one test currently only use sha256, which should also be sufficient according to the current security standards. Having two algorithms around already caused some confusion (e.g. the clean_functional_cache.py script only supports sha256 right now), so standardize now on enforcing sha256 before more tests use a mix of the two algorithms.

Message-ID: <[email protected]>

---
 tests/functional/ppc64/test_fadump.py | 4 +---
 tests/functional/qemu_test/asset.py   | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
tests/functional/ppc64/test_fadump.py +1 -3
index 2d6b8017e8f..bd9692f64c0 100755
@@ -32,9 +32,7 @@ class QEMUFadump(LinuxKernelTest):
     ASSET_VMLINUZ_KERNEL = Asset(
         ('https://archives.fedoraproject.org/pub/archive/fedora-secondary/'
          'releases/39/Everything/ppc64le/os/ppc/ppc64/vmlinuz'),
-        ('81e5541d243b50c8f9568906c6918dda22239744d637bb9a7b22d23c3d661226'
-         '8d5302beb2ca5c06f93bdbc9736c414ef5120756c8bf496ff488ad07d116d67f')
-        )
+         '6d77658130a7de1dd014ae14d7983c27f8ba1a61fa02e8d9064afdb8519e7e96')
 
     ASSET_FEDORA_INITRD = Asset(
         ('https://archives.fedoraproject.org/pub/archive/fedora-secondary/'
tests/functional/qemu_test/asset.py +1 -3
index bae40765ce4..45a2e01e2e6 100644
@@ -57,10 +57,8 @@ def _check(self, cache_file):
             return True
         if len(self.hash) == 64:
             hl = hashlib.sha256()
-        elif len(self.hash) == 128:
-            hl = hashlib.sha512()
         else:
-            raise AssetError(self, "unknown hash type")
+            raise AssetError(self, "unsupported hash type")
 
         # Calculate the hash of the file:
         with open(cache_file, 'rb') as file:
Signature · 1 line
2.52.0
#2 lore raw

[PULL 2/9] tests/functional/riscv64: Silence warnings from Pylint in the boston test

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

Pylint complains:

tests/functional/riscv64/test_boston.py:1:0: C0114:
Missing module docstring (missing-module-docstring)
tests/functional/riscv64/test_boston.py:95:8: C0415:
Import outside toplevel (subprocess.run, subprocess.PIPE) (import-outside-toplevel)
tests/functional/riscv64/test_boston.py:112:17: W1510:
'subprocess.run' used without explicitly defining the value for 'check'. (subprocess-run-check)
tests/functional/riscv64/test_boston.py:95:8: W0611:
Unused PIPE imported from subprocess (unused-import)

Rework the code a little bit to make the linter happy.

Message-ID: <[email protected]>

---
 tests/functional/riscv64/test_boston.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
tests/functional/riscv64/test_boston.py +7 -4
index 385de6a61df..2582df96f21 100755
@@ -1,11 +1,14 @@
 #!/usr/bin/env python3
 #
-# Boston board test for RISC-V P8700 processor by MIPS
-#
 # Copyright (c) 2025 MIPS
 #
 # SPDX-License-Identifier: GPL-2.0-or-later
 #
+"""
+Boston board test for RISC-V P8700 processor by MIPS
+"""
+
+from subprocess import run
 
 from qemu_test import QemuSystemTest, Asset
 from qemu_test import wait_for_console_pattern
@@ -92,7 +95,6 @@ def test_boston_invalid_cpu_count(self):
         """
         Test that 65 CPUs is rejected as invalid (negative test case)
         """
-        from subprocess import run, PIPE
 
         fw_payload_path = self.ASSET_FW_PAYLOAD.fetch()
         rootfs_path = self.ASSET_ROOTFS.fetch()
@@ -109,7 +111,8 @@ def test_boston_invalid_cpu_count(self):
         ]
 
         # Run QEMU and expect it to fail immediately.
-        result = run(cmd, capture_output=True, text=True, timeout=5)
+        result = run(cmd, capture_output=True, text=True, timeout=5,
+                     check=False)
 
         # Check that QEMU exited with error code 1
         self.assertEqual(result.returncode, 1,
Signature · 1 line
2.52.0
#3 lore raw

[PULL 8/9] tests/vm: Make the haiku VM usable again

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

The haiku VM bitrotted in the course of time. Make sure to use the latest version of the repositories here and install missing pieces like "pip" and "tomli" now.

Since we nowadays also install our own version of meson in our venv, this also requires a change to our configure script: On Haiku, the meson binary shows up as pyvenv/non-packaged/bin/meson here, and not in the expected location pyvenv/bin/meson. Adjust the "meson" variable to point to that Haiku-specific location to fix this issue. See also:
https://github.com/haiku/haiku/blob/r1beta5/docs/user/storage/storageintro.dox

And finally, with the new toolchain from the beta 5, we also have to compile with "-pie", otherwise the linker complains about bad relocations in the object files, so allow compiling with PIE in the configure script now.

Message-ID: <[email protected]>

---
 configure             | 8 +++++++-
 tests/vm/haiku.x86_64 | 4 ++++
 2 files changed, 11 insertions(+), 1 deletion(-)
configure +7 -1
index 213880df890..4b61fd3bbf8 100755
@@ -987,6 +987,12 @@ if [ -f "$meson$EXESUF" ]; then
   meson="$meson$EXESUF"
 fi
 
+# On Haiku, meson might show up in a "non-packaged" subfolder instead, see
+# https://github.com/haiku/haiku/blob/r1beta5/docs/user/storage/storageintro.dox
+if test "$host_os" = "haiku" && test ! -e "$meson" ; then
+    meson="$(cd pyvenv/non-packaged/bin; get_pwd)/meson"
+fi
+
 # Conditionally ensure Sphinx is installed.
 
 mkvenv_online_flag=""
@@ -1069,7 +1075,7 @@ static THREAD int tls_var;
 int main(void) { return tls_var; }
 EOF
 
-if test "$host_os" = windows || test "$host_os" = haiku; then
+if test "$host_os" = windows ; then
   if test "$pie" = "yes"; then
     error_exit "PIE not available due to missing OS support"
   fi
tests/vm/haiku.x86_64 +4 -0
index 71cf75a9a3e..529283c39f6 100755
@@ -78,6 +78,8 @@ class HaikuVM(basevm.BaseVM):
         "devel:libusb_1.0",
         "devel:libz",
         "ninja",
+        "pip",
+        "tomli_python310",
     ]
 
     BUILD_SCRIPT = """
@@ -109,6 +111,8 @@ class HaikuVM(basevm.BaseVM):
         self.wait_ssh(wait_root=True, cmd="exit 0")
 
         # Install packages
+        self.ssh_root("echo yes | pkgman add-repo https://eu.hpkg.haiku-os.org/haiku/r1beta5/$(getarch)/current")
+        self.ssh_root("echo yes | pkgman add-repo https://eu.hpkg.haiku-os.org/haikuports/r1beta5/$(getarch)/current")
         self.ssh_root("pkgman install -y %s" % " ".join(self.requirements))
         self.graceful_shutdown()
 
Signature · 1 line
2.52.0
#4 lore raw

[PULL 4/9] tests/functional/x86_64: Use the right Python interpreter & fix format string

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

The bad_vmstate test currently fails if the host does not have a "python3" binary in $PATH because the vmstate-static-checker.py script is executed directly, so that it gets run via its shebang line. Use the right Python interpreter from sys.executable to fix this problem.

Additionally, there was another bug with the formatting of the error message in case of failures: The "+" operator can only concatenate strings, but not strings with integers. Use a proper format string here instead.

Message-ID: <[email protected]>

---
 tests/functional/x86_64/test_bad_vmstate.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/functional/x86_64/test_bad_vmstate.py +4 -2
index 40098a8490b..71a1c0cf638 100755
@@ -5,6 +5,7 @@
 '''Test whether the vmstate-static-checker script detects problems correctly'''
 
 import subprocess
+import sys
 
 from qemu_test import QemuBaseTest
 
@@ -41,12 +42,13 @@ def test_checker(self):
                                        'vmstate-static-checker.py')
 
         self.log.info('Comparing %s with %s', src_json, dst_json)
-        cp = subprocess.run([checkerscript, '-s', src_json, '-d', dst_json],
+        cp = subprocess.run([sys.executable, checkerscript,
+                             '-s', src_json, '-d', dst_json],
                             stdout=subprocess.PIPE,
                             stderr=subprocess.STDOUT,
                             text=True, check=False)
         if cp.returncode != 13:
-            self.fail('Unexpected return code of vmstate-static-checker: ' +
+            self.fail('Unexpected return code of vmstate-static-checker: %d' %
                       cp.returncode)
         if cp.stdout != EXPECTED_OUTPUT:
             self.log.info('vmstate-static-checker output:\n%s', cp.stdout)
Signature · 1 line
2.52.0
#5 lore raw

[PULL 5/9] tests/tracetool: Honor the Python interpreter that "configure" detected

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

The tracetool tests currently fail if the host installation does not have a "python3" binary (and you compiled QEMU by selecting a different one during the "configure" step). This happens because tracetool-test.py executes scripts/tracetool.py directly, so that this script is run via its shebang line. To fix the issue, use the same Python interpreter to run scripts/tracetool.py as we are using to run the tracetool-test.py script.

Message-ID: <[email protected]>

---
 tests/tracetool/tracetool-test.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/tracetool/tracetool-test.py +2 -1
index 30006a99190..59e9ab3d6ef 100755
@@ -36,7 +36,8 @@ def test_tracetool_one(tracetool, backend, fmt, src_dir, build_dir):
     actual_file = Path(build_dir, rel_filename)
     expect_file = Path(src_dir, rel_filename)
 
-    args = [tracetool, f"--format={fmt}", f"--backends={backend}", "--group=testsuite"]
+    args = [sys.executable, tracetool,
+            f"--format={fmt}", f"--backends={backend}", "--group=testsuite"]
 
     if fmt.find("stap") != -1:
         args += ["--binary=qemu", "--probe-prefix=qemu"]
Signature · 1 line
2.52.0
#6 lore raw

[PULL 1/9] gitlab: preserve base rules for container template

In reply to Thomas Huth

From: Daniel P. Berrangé <[email protected]>

When extending the container template to allow scheduled pipelines in upstream context, we must ensure that all the existing rules defined by .base_job_template are preserved.

Fortunately since the new rule for scheduled pipelines can come at the head of all other rules, not in the middle, we can just the obscure '!reference' syntax to pull in all the pre-existing rules as a single block.

This fixes

* stable branches using the wrong tag name in container images
* pushes to forks unconditionally running container builds

Fixes 8bec7b9874235e60f14172618121c60fdbd39302
Fixes 8bec7b987423 ("gitlab: add a weekly container building job")

Message-ID: <[email protected]>

---
 .gitlab-ci.d/container-template.yml | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
.gitlab-ci.d/container-template.yml +2 -3
index b92e96b0fc5..6eaa2f804df 100644
@@ -23,6 +23,5 @@
     - docker logout
   rules:
     # because we want to enable this for scheduled runs we also have to replicate the normal rules
-    - if: '$CI_PIPELINE_SOURCE == "schedule"'
-    - if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ /^staging/'
-    - if: '$QEMU_CI && $CI_PROJECT_NAMESPACE != $QEMU_CI_UPSTREAM'
+    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM'
+    - !reference [.base_job_template, rules]
Signature · 1 line
2.52.0
#7 lore raw

[PULL 3/9] tests/functional/x86_64: Limit the memlock test to Linux hosts

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

The memlock test analyzes /proc/*/status files and expects the layout from Linux in there. However, these files also exist on NetBSD hosts with a completely different layout, causing this test to fail. Thus limit the test to Linux hosts now. We already have a decorator to skip a test if it is running on a certain host system, but in this case, we rather want to skip if we are not running on a specific host system, so introduce a new @skipUnlessOperatingSystem decorator for this job.

Message-ID: <[email protected]>

---
 tests/functional/qemu_test/__init__.py   |  4 ++--
 tests/functional/qemu_test/decorators.py | 12 ++++++++++++
 tests/functional/x86_64/test_memlock.py  |  3 ++-
 3 files changed, 16 insertions(+), 3 deletions(-)
tests/functional/qemu_test/__init__.py +2 -2
index 320193591b2..03e5c73d39d 100644
@@ -15,8 +15,8 @@
 from .linuxkernel import LinuxKernelTest
 from .decorators import skipIfMissingCommands, skipIfNotMachine, \
     skipFlakyTest, skipUntrustedTest, skipBigDataTest, skipSlowTest, \
-    skipIfMissingImports, skipIfOperatingSystem, skipLockedMemoryTest, \
-    skipIfMissingEnv
+    skipIfMissingImports, skipIfOperatingSystem, skipUnlessOperatingSystem, \
+    skipLockedMemoryTest, skipIfMissingEnv
 from .archive import archive_extract
 from .uncompress import uncompress
 from .gdb import GDB
tests/functional/qemu_test/decorators.py +12 -0
index 807418359ab..fcf236ecfdf 100644
@@ -57,6 +57,18 @@ def skipIfOperatingSystem(*args):
                   'running on an OS (%s) that is not able to run this test' %
                   ", ".join(args))
 
+def skipUnlessOperatingSystem(*args):
+    '''
+    Decorator to skip execution of a test if the current host
+    operating system does not match one of the allowed ones.
+    Example:
+
+      @skipUnlessOperatingSystem("Linux", "Darwin")
+    '''
+    return skipUnless(platform.system() in args,
+                  'not running on one of the required operating systems (%s)' %
+                  ", ".join(args))
+
 def skipIfNotMachine(*args):
     '''
     Decorator to skip execution of a test if the current
tests/functional/x86_64/test_memlock.py +2 -1
index f970a2c3095..d88843ab5f9 100755
@@ -14,12 +14,13 @@
 from typing import Dict
 
 from qemu_test import QemuSystemTest
-from qemu_test import skipLockedMemoryTest
+from qemu_test import skipLockedMemoryTest, skipUnlessOperatingSystem
 
 
 STATUS_VALUE_PATTERN = re.compile(r'^(\w+):\s+(\d+) kB', re.MULTILINE)
 
 
+@skipUnlessOperatingSystem('Linux')
 @skipLockedMemoryTest(2_097_152)  # 2GB
 class MemlockTest(QemuSystemTest):
     """
Signature · 1 line
2.52.0
#8 lore raw

[PULL 6/9] pc-bios/optionrom: Use 32-bit linker emulation for the optionroms

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

Without this linker flag, the linking fails on NetBSD v10.1 with:

ld: i386 architecture of input file `multiboot.o' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `multiboot_dma.o' is incompatible with i386:x86-64 output

Message-ID: <[email protected]>

---
 pc-bios/optionrom/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/optionrom/Makefile +1 -1
index 30d07026c79..e6674a76e73 100644
@@ -36,7 +36,7 @@ config-cc.mak: Makefile
 	    $(call cc-option,-Wno-array-bounds)) 3> config-cc.mak
 -include config-cc.mak
 
-override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds
+override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds,-m,elf_i386
 
 pvh.img: pvh.o pvh_main.o
 
Signature · 1 line
2.52.0
#9 lore raw

[PULL 7/9] tests/vm: Update netbsd VM to version 10.1

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

NetBSD 10.1 has been released since more than a year, so it's time to update our VM to that version.
Apart from the usual changes in the installation process, we also have to disable the installation of the "jpeg" package now, otherwise the package installation fails with an error message like this:

pkg_add: jpeg-9fnb1: conflicts with libjpeg-turbo-[0-9]*', and libjpeg-turbo-3.1.3' is installed.

We also have to drop the executable bits from scripts/qemu-plugin-symbols.py to force meson to use the detected Python interpreter instead of executing the file directly (which tries to use the Python interpreter from the file's shebang line).

Message-ID: <[email protected]>

---
 scripts/qemu-plugin-symbols.py |  0
 tests/vm/netbsd                | 16 ++++++++--------
 2 files changed, 8 insertions(+), 8 deletions(-)
 mode change 100755 => 100644 scripts/qemu-plugin-symbols.py
scripts/qemu-plugin-symbols.py +0 -0
old mode 100755
new mode 100644
tests/vm/netbsd +8 -8
index a3f6dd6b3c8..77d17a0dedf 100755
@@ -22,15 +22,15 @@ class NetBSDVM(basevm.BaseVM):
     name = "netbsd"
     arch = "x86_64"
 
-    link = "https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.3/images/NetBSD-9.3-amd64.iso"
-    csum = "2bfce544f762a579f61478e7106c436fc48731ff25cf6f79b392ba5752e6f5ec130364286f7471716290a5f033637cf56aacee7fedb91095face59adf36300c3"
+    link = "https://cdn.netbsd.org/pub/NetBSD/images/10.1/NetBSD-10.1-amd64.iso"
+    csum = "7a5e5071307e1795885ffc6e1b8aac465082c21c8b79f4c9b4103ef44e4f2da45477299d213ae0093f6534dc99dc2bbf78f41e9dd556c72a02516068bf43fe49"
     size = "20G"
     pkgs = [
         # tools
         "git-base",
         "pkgconf",
         "xz",
-        "python311",
+        "python313",
         "ninja-build",
 
         # gnu tools
@@ -46,7 +46,6 @@ class NetBSDVM(basevm.BaseVM):
         "gnutls",
 
         # libs: images
-        "jpeg",
         "png",
 
         # libs: ui
@@ -126,8 +125,6 @@ class NetBSDVM(basevm.BaseVM):
         self.print_step("Installation started now, this will take a while")
         self.console_wait_send("Hit enter to continue",    "\n")
 
-        self.console_wait_send("d: Change root password",  "d\n")
-        self.console_wait_send("a: Yes",                   "a\n")
         self.console_wait("New password:")
         self.console_send("%s\n" % self._config["root_pass"])
         self.console_wait("New password:")
@@ -153,6 +150,7 @@ class NetBSDVM(basevm.BaseVM):
         self.console_wait_send("Network media type",       "\n")
         self.console_wait("autoconfiguration")
         self.console_wait_send("a: Yes",                   "a\n")
+        self.console_wait_send("Finished",                 "netbsd-guest\n")
         self.console_wait_send("DNS domain",               "localnet\n")
         self.console_wait("Are they OK?")
         self.console_wait_send("a: Yes",                   "a\n")
@@ -160,6 +158,8 @@ class NetBSDVM(basevm.BaseVM):
         self.console_wait_send("a: Yes",                   "a\n")
 
         self.console_wait_send("e: Enable install",        "e\n")
+        self.console_wait("installed in /etc")
+        self.console_wait_send("a: Yes",                   "a\n")
         proxy = os.environ.get("http_proxy")
         if not proxy is None:
             self.console_wait_send("f: Proxy",             "f\n")
@@ -178,13 +178,13 @@ class NetBSDVM(basevm.BaseVM):
         self.console_wait_send("d: Reboot the computer",   "d\n")
 
         # setup qemu user
-        prompt = "localhost$"
+        prompt = "netbsd-guest$"
         self.console_ssh_init(prompt, self._config["guest_user"],
                                       self._config["guest_pass"])
         self.console_wait_send(prompt, "exit\n")
 
         # setup root user
-        prompt = "localhost#"
+        prompt = "netbsd-guest#"
         self.console_ssh_init(prompt, "root", self._config["root_pass"])
         self.console_sshd_config(prompt)
 
Signature · 1 line
2.52.0
#10 lore raw
In reply to Thomas Huth
Quoted 10 lines · Thomas Huth

Hi Richard!

The following changes since commit f26976b9d30496d28bd4fd045f4300706e567a29:

   Merge tag 'pull-vfio-20260126' ofhttps://github.com/legoater/qemu into staging (2026-01-27 07:14:11 +1100)

are available in the Git repository at:

   https://gitlab.com/thuth/qemu.git tags/pull-request-2026-01-27
Quoted 8 lines

for you to fetch changes up to 161ea5a63413dd5efc07205483c1070a6e859785:

   tests/functional: Enforce sha256 as hashsum algorithm for all tests (2026-01-27 15:20:43 +0100)

----------------------------------------------------------------
* gitlab: preserve base rules for container template
* Fix some issues to make QEMU compilable on non-mainstream distros again
* Enforce sha256 as hashsum algorithm for all functional tests

Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/11.0 as appropriate.

r~