Functional tests and s390x patches for the softfreeze
Subsystems (2)
Hi Richard!
The following changes since commit 53b41bb78950912ba2d9809eef6b45e4df30c647:
Merge tag 'pull-target-arm-20251031' of https://gitlab.com/pm215/qemu into staging (2025-11-01 10:52:48 +0100)
are available in the Git repository at:
https://gitlab.com/thuth/qemu.git tags/pull-request-2025-11-03
for you to fetch changes up to 0408c61e27aca56c2d40aeb6ca0e5c5f8b8c3845:
tests/tcg/s390x: Test SET CLOCK COMPARATOR (2025-11-03 08:27:59 +0100)
----------------------------------------------------------------
* Fix spurious EOFError messages from the device-crash-test script
* Fix various issues in the functional tests that pylint complained about
* Improve logging information in the functional tests
* Fix issue in the s390x clock-comparator code
* Use address generation for register branch targets on s390x
----------------------------------------------------------------
Daniel P. Berrangé (2):
tests/functional: include logger name and function in messages tests/functional: include the lower level QMP log messages
Ilya Leoshkevich (4):
target/s390x: Fix missing interrupts for small CKC values
target/s390x: Fix missing clock-comparator interrupts after reset
target/s390x: Use address generation for register branch targets
tests/tcg/s390x: Test SET CLOCK COMPARATORJohn Snow (1):
scripts/device-crash-test: fix spurious EOFError messages
Philippe Mathieu-Daudé (1):
hw/s390x: Use memory_region_size()
Thomas Huth (12):
tests/functional: Fix problems in asset.py reported by pylint tests/functional: Fix problems in decorators.py reported by pylint tests/functional: Fix problems in linuxkernel.py reported by pylint tests/functional: Fix problems in uncompress.py reported by pylint tests/functional: Fix problems in utils.py reported by pylint tests/functional/arm/test_aspeed_ast1030: Remove unused import tests/functional/migration: Fix bad indentation tests/functional/ppc64/test_mac99: Fix style issues reported by pylint tests/functional/rx/test_gdbsim: Remove unused variables tests/functional/x86_64/test_acpi_bits: Silence warnings reported by pylint tests/functional/x86_64/test_virtio_balloon: Fix cosmetic issues from pylint tests/functional/ppc64: Fix class names to silence pylint warnings
Vladimir Sementsov-Ogievskiy (2):
tests/functional/.../testcase.py: better socketdir cleanup
MAINTAINERS: fix functional tests section
MAINTAINERS | 1 + hw/s390x/s390-pci-inst.c | 2 +- target/s390x/tcg/mem_helper.c | 11 +- target/s390x/tcg/misc_helper.c | 12 +- target/s390x/tcg/translate.c | 11 +- scripts/device-crash-test | 2 +- tests/functional/arm/test_aspeed_ast1030.py | 3 +- tests/functional/migration.py | 4 +- tests/functional/ppc/test_74xx.py | 2 +- tests/functional/ppc/test_sam460ex.py | 5 +- tests/functional/ppc64/test_mac99.py | 8 +- tests/functional/ppc64/test_powernv.py | 2 +- tests/functional/ppc64/test_pseries.py | 2 +- tests/functional/ppc64/test_reverse_debug.py | 2 +- tests/functional/qemu_test/asset.py | 24 ++-- tests/functional/qemu_test/decorators.py | 176 ++++++++++++------------- tests/functional/qemu_test/linuxkernel.py | 6 +- tests/functional/qemu_test/testcase.py | 8 +- tests/functional/qemu_test/uncompress.py | 40 +++--- tests/functional/qemu_test/utils.py | 22 ++-- tests/functional/rx/test_gdbsim.py | 6 +- tests/functional/x86_64/test_acpi_bits.py | 8 +- tests/functional/x86_64/test_virtio_balloon.py | 8 +- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/sckc.S | 63 +++++++++ 25 files changed, 256 insertions(+), 173 deletions(-) create mode 100644 tests/tcg/s390x/sckc.S
[PULL 01/22] scripts/device-crash-test: fix spurious EOFError messages
From: John Snow <[email protected]>
When the QMP library was updated to match the standalone repository in 094ded52, I neglected to update the logging filter(s) in device-crash-test, which allowed the spurious messages to leak through.
Update the log filter to re-suppress these messages.
Message-ID: <[email protected]>
--- scripts/device-crash-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/device-crash-test +1 -1
@@ -527,7 +527,7 @@ def main(): # Async QMP, when in use, is chatty about connection failures. # This script knowingly generates a ton of connection errors. # Silence this logger. - logging.getLogger('qemu.qmp.qmp_client').setLevel(logging.CRITICAL) + logging.getLogger('qemu.qmp.protocol').setLevel(logging.CRITICAL) fatal_failures = [] wl_stats = {}
Signature · 1 line
2.51.0
[PULL 04/22] tests/functional: Fix problems in linuxkernel.py reported by pylint
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
Use proper indentation here.
Message-ID: <[email protected]>
--- tests/functional/qemu_test/linuxkernel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/functional/qemu_test/linuxkernel.py +3 -3
@@ -83,12 +83,12 @@ def launch_kernel(self, kernel, initrd=None, dtb=None, console_index=0, self.vm.set_console(console_index=console_index) self.vm.add_args('-kernel', kernel) if initrd: - self.vm.add_args('-initrd', initrd) + self.vm.add_args('-initrd', initrd) if dtb: - self.vm.add_args('-dtb', dtb) + self.vm.add_args('-dtb', dtb) self.vm.launch() if wait_for: - self.wait_for_console_pattern(wait_for) + self.wait_for_console_pattern(wait_for) def check_http_download(self, filename, hashsum, guestport=8080, pythoncmd='python3 -m http.server'):
Signature · 1 line
2.51.0
[PULL 10/22] tests/functional/migration: Fix bad indentation
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
pylint complains about bad indentation in two lines. Use 12 spaces instead of 11 spaces to get it right.
Message-ID: <[email protected]>
--- tests/functional/migration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/functional/migration.py +2 -2
@@ -30,11 +30,11 @@ def assert_migration(self, src_vm, dst_vm): end = time.monotonic() + self.timeout while time.monotonic() < end and not self.migration_finished(src_vm): - time.sleep(0.1) + time.sleep(0.1) end = time.monotonic() + self.timeout while time.monotonic() < end and not self.migration_finished(dst_vm): - time.sleep(0.1) + time.sleep(0.1) self.assertEqual(src_vm.cmd('query-migrate')['status'], 'completed') self.assertEqual(dst_vm.cmd('query-migrate')['status'], 'completed')
Signature · 1 line
2.51.0
[PULL 02/22] tests/functional: Fix problems in asset.py reported by pylint
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
The "raise" without an Exception was a real problem, the other spots are rather cosmetics.
Message-ID: <[email protected]>
--- tests/functional/qemu_test/asset.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
tests/functional/qemu_test/asset.py +13 -11
@@ -112,7 +112,7 @@ def _wait_for_other_download(self, tmp_cache_file): return False self.log.debug("Time out while waiting for %s!", tmp_cache_file) - raise + raise TimeoutError(f"Time out while waiting for {tmp_cache_file}") def _save_time_stamp(self): '''
@@ -141,7 +141,7 @@ def fetch(self): self.log.info("Downloading %s to %s...", self.url, self.cache_file) tmp_cache_file = self.cache_file.with_suffix(".download") - for retries in range(3): + for _retries in range(3): try: with tmp_cache_file.open("xb") as dst: with urllib.request.urlopen(self.url) as resp:
@@ -181,7 +181,7 @@ def fetch(self): # server or networking problem if e.code == 404: raise AssetError(self, "Unable to download: " - "HTTP error %d" % e.code) + "HTTP error %d" % e.code) from e continue except URLError as e: # This is typically a network/service level error
@@ -190,7 +190,7 @@ def fetch(self): self.log.error("Unable to download %s: URL error %s", self.url, e.reason) raise AssetError(self, "Unable to download: URL error %s" % - e.reason, transient=True) + e.reason, transient=True) from e except ConnectionError as e: # A socket connection failure, such as dropped conn # or refused conn
@@ -201,7 +201,7 @@ def fetch(self): except Exception as e: tmp_cache_file.unlink() raise AssetError(self, "Unable to download: %s" % e, - transient=True) + transient=True) from e if not os.path.exists(tmp_cache_file): raise AssetError(self, "Download retries exceeded", transient=True)
@@ -214,7 +214,6 @@ def fetch(self): self.hash.encode('utf8')) except Exception as e: self.log.debug("Unable to set xattr on %s: %s", tmp_cache_file, e) - pass if not self._check(tmp_cache_file): tmp_cache_file.unlink()
@@ -224,9 +223,10 @@ def fetch(self): # Remove write perms to stop tests accidentally modifying them os.chmod(self.cache_file, stat.S_IRUSR | stat.S_IRGRP) - self.log.info("Cached %s at %s" % (self.url, self.cache_file)) + self.log.info("Cached %s at %s", self.url, self.cache_file) return str(self.cache_file) + @staticmethod def precache_test(test): log = logging.getLogger('qemu-test') log.setLevel(logging.DEBUG)
@@ -237,16 +237,17 @@ def precache_test(test): handler.setFormatter(formatter) log.addHandler(handler) for name, asset in vars(test.__class__).items(): - if name.startswith("ASSET_") and type(asset) == Asset: + if name.startswith("ASSET_") and isinstance(asset, Asset): try: asset.fetch() except AssetError as e: if not e.transient: raise - log.error("%s: skipping asset precache" % e) + log.error("%s: skipping asset precache", e) log.removeHandler(handler) + @staticmethod def precache_suite(suite): for test in suite: if isinstance(test, unittest.TestSuite):
@@ -254,9 +255,10 @@ def precache_suite(suite): elif isinstance(test, unittest.TestCase): Asset.precache_test(test) - def precache_suites(path, cacheTstamp): + @staticmethod + def precache_suites(path, cache_tstamp): loader = unittest.loader.defaultTestLoader tests = loader.loadTestsFromNames([path], None) - with open(cacheTstamp, "w") as fh: + with open(cache_tstamp, "w", encoding='utf-8'): Asset.precache_suite(tests)
Signature · 1 line
2.51.0
[PULL 14/22] tests/functional/x86_64/test_virtio_balloon: Fix cosmetic issues from pylint
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
Pylint complains about some style issues in this file: Unused variables should be marked with an underscore, "when > then and when < now" can be simplified to "now > when > then" and expectData doesn't conform to the usual snake_case naming style.
Message-ID: <[email protected]>
--- tests/functional/x86_64/test_virtio_balloon.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tests/functional/x86_64/test_virtio_balloon.py +4 -4
@@ -66,7 +66,7 @@ def assert_initial_stats(self): when = ret.get('last-update') assert when == 0 stats = ret.get('stats') - for name, val in stats.items(): + for _name, val in stats.items(): assert val == UNSET_STATS_VALUE def assert_running_stats(self, then):
@@ -87,10 +87,10 @@ def assert_running_stats(self, then): now = time.time() - assert when > then and when < now + assert now > when > then stats = ret.get('stats') # Stat we expect this particular Kernel to have set - expectData = [ + expect_data = [ "stat-available-memory", "stat-disk-caches", "stat-free-memory",
@@ -103,7 +103,7 @@ def assert_running_stats(self, then): "stat-total-memory", ] for name, val in stats.items(): - if name in expectData: + if name in expect_data: assert val != UNSET_STATS_VALUE else: assert val == UNSET_STATS_VALUE
Signature · 1 line
2.51.0
[PULL 15/22] tests/functional/ppc64: Fix class names to silence pylint warnings
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
Pylint complains about inconsistent CamelCase names here, so let's slightly change the names to make pylint happy again.
In the sam460ex test, also split a line where pylint was complaining about it being too long.
Message-ID: <[email protected]>
--- tests/functional/ppc/test_74xx.py | 2 +- tests/functional/ppc/test_sam460ex.py | 5 +++-- tests/functional/ppc64/test_powernv.py | 2 +- tests/functional/ppc64/test_pseries.py | 2 +- tests/functional/ppc64/test_reverse_debug.py | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-)
tests/functional/ppc/test_74xx.py +1 -1
@@ -10,7 +10,7 @@ from qemu_test import QemuSystemTest from qemu_test import wait_for_console_pattern -class ppc74xxCpu(QemuSystemTest): +class Ppc74xxCpu(QemuSystemTest): timeout = 5
tests/functional/ppc/test_sam460ex.py +3 -2
@@ -8,10 +8,11 @@ from qemu_test import exec_command_and_wait_for_pattern -class sam460exTest(LinuxKernelTest): +class Sam460exTest(LinuxKernelTest): ASSET_BR2_SAM460EX_LINUX = Asset( - 'https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/buildroot/qemu_ppc_sam460ex-2023.11-8-gdcd9f0f6eb-20240105/vmlinux', + ('https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main' + '/buildroot/qemu_ppc_sam460ex-2023.11-8-gdcd9f0f6eb-20240105/vmlinux'), '6f46346f3e20e8b5fc050ff363f350f8b9d76a051b9e0bd7ea470cc680c14df2') def test_ppc_sam460ex_buildroot(self):
tests/functional/ppc64/test_powernv.py +1 -1
@@ -10,7 +10,7 @@ from qemu_test import LinuxKernelTest, Asset from qemu_test import wait_for_console_pattern -class powernvMachine(LinuxKernelTest): +class PowernvMachine(LinuxKernelTest): timeout = 90 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
tests/functional/ppc64/test_pseries.py +1 -1
@@ -10,7 +10,7 @@ from qemu_test import QemuSystemTest, Asset from qemu_test import wait_for_console_pattern -class pseriesMachine(QemuSystemTest): +class PseriesMachine(QemuSystemTest): timeout = 90 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
tests/functional/ppc64/test_reverse_debug.py +1 -1
@@ -18,7 +18,7 @@ from reverse_debugging import ReverseDebugging -class ReverseDebugging_ppc64(ReverseDebugging): +class ReverseDebuggingPpc64(ReverseDebugging): @skipFlakyTest("https://gitlab.com/qemu-project/qemu/-/issues/1992") def test_ppc64_pseries(self):
Signature · 1 line
2.51.0
[PULL 16/22] tests/functional: include logger name and function in messages
In reply to Thomas HuthFrom: Daniel P. Berrangé <[email protected]>
As we collect debug logs from a wide range of code it becomes increasingly confusing to understand where each log messages comes from. Adding "%(name)s" gives us the logger name, which is usually based on the python __name__ symbol, aka the code module name. Then "%(funcName)s" completes the story by identifying the function.
Message-ID: <[email protected]>
--- tests/functional/qemu_test/testcase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/functional/qemu_test/testcase.py +1 -1
@@ -217,7 +217,7 @@ def setUp(self): self._log_fh = logging.FileHandler(self.log_filename, mode='w') self._log_fh.setLevel(logging.DEBUG) fileFormatter = logging.Formatter( - '%(asctime)s - %(levelname)s: %(message)s') + '%(asctime)s - %(levelname)s: %(name)s.%(funcName)s %(message)s') self._log_fh.setFormatter(fileFormatter) self.log.addHandler(self._log_fh)
Signature · 1 line
2.51.0
[PULL 20/22] target/s390x: Fix missing clock-comparator interrupts after reset
In reply to Thomas HuthFrom: Ilya Leoshkevich <[email protected]>
After reset, CKC value is set to 0, so if clock-comparator interrupts are enabled, one should occur very shortly thereafter.
Currently the code that loads the respective control register does not set tod_timer, so this does not happen.
Fix by adding a tcg_s390_tod_updated() call to LCTL and LCTLG.
Message-ID: <[email protected]>
--- target/s390x/tcg/mem_helper.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
target/s390x/tcg/mem_helper.c +10 -1
@@ -1959,6 +1959,10 @@ void HELPER(lctlg)(CPUS390XState *env, uint32_t r1, uint64_t a2, uint32_t r3)if (env->cregs[i] != val && i >=9 && i <=11 ) { PERchanged = true; } +if (i ==0 && !(env->cregs[i] &CR0_CKC_SC ) && (val &CR0_CKC_SC )) { +BQL_LOCK_GUARD (); +tcg_s390_tod_updated (env_cpu (env),RUN_ON_CPU_NULL ); + } env->cregs[i] = val;HELPER_LOG ("load ctl %d from 0x%" PRIx64" == 0x%" PRIx64"\n" , i, src, val);
@@ -1989,10 +1993,15 @@ void HELPER(lctl)(CPUS390XState *env, uint32_t r1, uint64_t a2, uint32_t r3)for (i = r1;; i = (i +1 ) %16 ) {uint32_t val =cpu_ldl_data_ra (env, src, ra); +uint64_t val64 =deposit64 (env->cregs[i],0 ,32 , val);if ((uint32_t )env->cregs[i] != val && i >=9 && i <=11 ) { PERchanged = true; } - env->cregs[i] =deposit64 (env->cregs[i],0 ,32 , val); +if (i ==0 && !(env->cregs[i] &CR0_CKC_SC ) && (val64 &CR0_CKC_SC )) { +BQL_LOCK_GUARD (); +tcg_s390_tod_updated (env_cpu (env),RUN_ON_CPU_NULL ); + } + env->cregs[i] = val64;HELPER_LOG ("load ctl %d from 0x%" PRIx64" == 0x%x\n" , i, src, val); src +=sizeof (uint32_t );
Signature · 1 line
2.51.0
[PULL 09/22] MAINTAINERS: fix functional tests section
In reply to Thomas HuthFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
Without "S: Maintained", ./scripts/get_maintainer.pl shows "unknown" role instead of "maintainer" for "M: " entry, it's confusing. I really hope that functional tests are maintained:)
Message-ID: <[email protected]>
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -4412,6 +4412,7 @@ Functional testing framework M: Thomas Huth <[email protected]> R: Philippe Mathieu-Daudé <[email protected]> R: Daniel P. Berrange <[email protected]> +S: Maintained F: docs/devel/testing/functional.rst F: scripts/clean_functional_cache.py F: tests/functional/qemu_test/
Signature · 1 line
2.51.0
[PULL 11/22] tests/functional/ppc64/test_mac99: Fix style issues reported by pylint
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
Pylint complained about lines being too long here, and mac99Test not following the usual CamelCase capitalization.
Message-ID: <[email protected]>
--- tests/functional/ppc64/test_mac99.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tests/functional/ppc64/test_mac99.py +5 -3
@@ -7,14 +7,16 @@ from qemu_test import LinuxKernelTest, Asset from qemu_test import exec_command_and_wait_for_pattern -class mac99Test(LinuxKernelTest): +class Mac99Test(LinuxKernelTest): ASSET_BR2_MAC99_LINUX = Asset( - 'https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/buildroot/qemu_ppc64_mac99-2023.11-8-gdcd9f0f6eb-20240105/vmlinux', + ('https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main' + '/buildroot/qemu_ppc64_mac99-2023.11-8-gdcd9f0f6eb-20240105/vmlinux'), 'd59307437e4365f2cced0bbd1b04949f7397b282ef349b7cafd894d74aadfbff') ASSET_BR2_MAC99_ROOTFS = Asset( - 'https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main//buildroot/qemu_ppc64_mac99-2023.11-8-gdcd9f0f6eb-20240105/rootfs.ext2', + ('https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main' + '/buildroot/qemu_ppc64_mac99-2023.11-8-gdcd9f0f6eb-20240105/rootfs.ext2'), 'bbd5fd8af62f580bc4e585f326fe584e22856572633a8333178ea6d4ed4955a4') def test_ppc64_mac99_buildroot(self):
Signature · 1 line
2.51.0
[PULL 17/22] tests/functional: include the lower level QMP log messages
In reply to Thomas HuthFrom: Daniel P. Berrangé <[email protected]>
We've seen a GitLab CI timeout failure in the test_pseries.py test, where it appears likely that the test has hung in a self.qmp('quit') call, but we don't have conclusive proof. Adding the QMP log category to what we capture should help us diagnose this, at the cost of the base.log file becoming significantly more verbose. The previous commit to include the logger category name and function should at least help understanding the more verbose logs.
Message-ID: <[email protected]>
--- tests/functional/qemu_test/testcase.py | 4 ++++ 1 file changed, 4 insertions(+)
tests/functional/qemu_test/testcase.py +4 -0
@@ -225,6 +225,9 @@ def setUp(self): self.machinelog = logging.getLogger('qemu.machine') self.machinelog.setLevel(logging.DEBUG) self.machinelog.addHandler(self._log_fh) + self.qmplog = logging.getLogger('qemu.qmp') + self.qmplog.setLevel(logging.DEBUG) + self.qmplog.addHandler(self._log_fh) if not self.assets_available(): self.skipTest('One or more assets is not available')
@@ -235,6 +238,7 @@ def tearDown(self): if self.socketdir is not None: self.socketdir.cleanup() self.socketdir = None + self.qmplog.removeHandler(self._log_fh) self.machinelog.removeHandler(self._log_fh) self.log.removeHandler(self._log_fh) self._log_fh.close()
Signature · 1 line
2.51.0
[PULL 06/22] tests/functional: Fix problems in utils.py reported by pylint
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
- put the doc strings in the right locations (after the "def" line)
- use the right indentation (4 spaces)
Message-ID: <[email protected]>
--- tests/functional/qemu_test/utils.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
tests/functional/qemu_test/utils.py +11 -11
@@ -17,10 +17,10 @@ def get_usernet_hostfwd_port(vm): res = vm.cmd('human-monitor-command', command_line='info usernet') return get_info_usernet_hostfwd_port(res) -""" -Round up to next power of 2 -""" def pow2ceil(x): + """ + Round up to next power of 2 + """ return 1 if x == 0 else 2**(x - 1).bit_length() def file_truncate(path, size):
@@ -28,12 +28,12 @@ def file_truncate(path, size): with open(path, 'ab+') as fd: fd.truncate(size) -""" -Expand file size to next power of 2 -""" def image_pow2ceil_expand(path): - size = os.path.getsize(path) - size_aligned = pow2ceil(size) - if size != size_aligned: - with open(path, 'ab+') as fd: - fd.truncate(size_aligned) + """ + Expand file size to next power of 2 + """ + size = os.path.getsize(path) + size_aligned = pow2ceil(size) + if size != size_aligned: + with open(path, 'ab+') as fd: + fd.truncate(size_aligned)
Signature · 1 line
2.51.0
[PULL 12/22] tests/functional/rx/test_gdbsim: Remove unused variables
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
Remove/comment some unused variables to make pylint happy.
Message-ID: <[email protected]>
--- tests/functional/rx/test_gdbsim.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
tests/functional/rx/test_gdbsim.py +1 -5
@@ -17,9 +17,6 @@ class RxGdbSimMachine(QemuSystemTest): - timeout = 30 - KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' - ASSET_UBOOT = Asset( ('https://github.com/philmd/qemu-testing-blob/raw/rx-gdbsim/rx/gdbsim/' 'u-boot.bin'),
@@ -47,7 +44,7 @@ def test_uboot(self): self.vm.launch() uboot_version = 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty' wait_for_console_pattern(self, uboot_version) - gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)' + #gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)' # FIXME limit baudrate on chardev, else we type too fast # https://gitlab.com/qemu-project/qemu/-/issues/2691 #exec_command_and_wait_for_pattern(self, 'version', gcc_version)
@@ -63,7 +60,6 @@ def test_linux_sash(self): kernel_path = self.ASSET_KERNEL.fetch() self.vm.set_console() - kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'earlycon' self.vm.add_args('-kernel', kernel_path, '-dtb', dtb_path, '-no-reboot')
Signature · 1 line
2.51.0
[PULL 21/22] target/s390x: Use address generation for register branch targets
In reply to Thomas HuthFrom: Ilya Leoshkevich <[email protected]>
Indirect branches to addresses taken from registers go through address generation, e.g., for BRANCH ON CONDITION Principles of Operation says:
In the RR format, the contents of general register R2 are used to generate the branch address
QEMU uses r2_nz handler for the respective register operands. Currently it does not zero out extra bits in 24- and 31-bit addressing modes as required by address generation. The very frequently used s390x_tr_init_disas_context() function has a workaround for this, but the code for saving an old PSW during an interrupt does not.
Add the missing masking to r2_nz. Enforce PSW validity by replacing the workaround with an assertion.
Message-ID: <[email protected]>
--- target/s390x/tcg/translate.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
target/s390x/tcg/translate.c +7 -4
@@ -5613,6 +5613,7 @@ static void in2_r2_nz(DisasContext *s, DisasOps *o)int r2 =get_field (s, r2);if (r2 !=0 ) { o->in2 =load_reg (r2); +gen_addi_and_wrap_i64 (s, o->in2, o->in2,0 ); } }#define SPEC_in2_r2_nz 0
@@ -6379,10 +6380,12 @@ static void s390x_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) {DisasContext *dc =container_of (dcbase, DisasContext, base); -/* 31-bit mode */ -if (!(dc->base.tb->flags &FLAG_MASK_64 )) { - dc->base.pc_first &=0x7fffffff ; - dc->base.pc_next = dc->base.pc_first; +if (dc->base.tb->flags &FLAG_MASK_32 ) { +if (!(dc->base.tb->flags &FLAG_MASK_64 )) { +assert (!(dc->base.pc_first & ~((1ULL <<31 ) -1 ))); + } + }else { +assert (!(dc->base.pc_first & ~((1ULL <<24 ) -1 ))); } dc->cc_op =CC_OP_DYNAMIC ;
Signature · 1 line
2.51.0
[PULL 05/22] tests/functional: Fix problems in uncompress.py reported by pylint
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
- put the doc strings in the right locations (after the "def" line)
- use isinstance() instead of checking via type()
Message-ID: <[email protected]>
--- tests/functional/qemu_test/uncompress.py | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-)
tests/functional/qemu_test/uncompress.py +20 -20
@@ -58,20 +58,20 @@ def zstd_uncompress(zstd_path, output_path): os.chmod(output_path, stat.S_IRUSR | stat.S_IWUSR) -''' -@params compressed: filename, Asset, or file-like object to uncompress -@params uncompressed: filename to uncompress into -@params format: optional compression format (gzip, lzma) +def uncompress(compressed, uncompressed, format=None): + ''' + @params compressed: filename, Asset, or file-like object to uncompress + @params uncompressed: filename to uncompress into + @params format: optional compression format (gzip, lzma) -Uncompresses @compressed into @uncompressed + Uncompresses @compressed into @uncompressed -If @format is None, heuristics will be applied to guess the format -from the filename or Asset URL. @format must be non-None if @uncompressed -is a file-like object. + If @format is None, heuristics will be applied to guess the + format from the filename or Asset URL. @format must be non-None + if @uncompressed is a file-like object. -Returns the fully qualified path to the uncompessed file -''' -def uncompress(compressed, uncompressed, format=None): + Returns the fully qualified path to the uncompessed file + ''' if format is None: format = guess_uncompress_format(compressed)
@@ -84,19 +84,19 @@ def uncompress(compressed, uncompressed, format=None): else: raise Exception(f"Unknown compression format {format}") -''' -@params compressed: filename, Asset, or file-like object to guess - -Guess the format of @compressed, raising an exception if -no format can be determined -''' def guess_uncompress_format(compressed): - if type(compressed) == Asset: + ''' + @params compressed: filename, Asset, or file-like object to guess + + Guess the format of @compressed, raising an exception if + no format can be determined + ''' + if isinstance(compressed, Asset): compressed = urlparse(compressed.url).path - elif type(compressed) != str: + elif not isinstance(compressed, str): raise Exception(f"Unable to guess compression cformat for {compressed}") - (name, ext) = os.path.splitext(compressed) + (_name, ext) = os.path.splitext(compressed) if ext == ".xz": return "xz" elif ext == ".gz":
Signature · 1 line
2.51.0
[PULL 13/22] tests/functional/x86_64/test_acpi_bits: Silence warnings reported by pylint
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
Pylint complains about too many positional arguments for the __init__ function of the QEMUBitsMachine class, use a "*" to enforce argument passing by names instead (which the calling sites are doing here already).
Second, use lazy logging when calling self.log.info() with a "%s" format string, and drop a superfluous "else:" that is not necessary after a "raise" statement.
Message-ID: <[email protected]>
--- tests/functional/x86_64/test_acpi_bits.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tests/functional/x86_64/test_acpi_bits.py +4 -4
@@ -57,6 +57,7 @@ class QEMUBitsMachine(QEMUMachine): # pylint: disable=too-few-public-methods """ def __init__(self, binary: str, + *, args: Sequence[str] = (), wrapper: Sequence[str] = (), name: Optional[str] = None,
@@ -225,7 +226,7 @@ def generate_bits_iso(self): stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True) - self.log.info("grub-mkrescue output %s" % proc.stdout) + self.log.info("grub-mkrescue output %s", proc.stdout) else: subprocess.check_call([mkrescue_script, '-o', iso_file, bits_dir],
@@ -287,9 +288,8 @@ def parse_log(self): except AssertionError as e: self._print_log(log) raise e - else: - if os.getenv('V') or os.getenv('BITS_DEBUG'): - self._print_log(log) + if os.getenv('V') or os.getenv('BITS_DEBUG'): + self._print_log(log) def tearDown(self): """
Signature · 1 line
2.51.0
[PULL 08/22] tests/functional/.../testcase.py: better socketdir cleanup
In reply to Thomas HuthFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
TemporaryDirectory prefer explicit call to .cleanup() (or use context manager). Otherwise it may produce a warning like:
/usr/lib/python3.10/tempfile.py:1008: \
ResourceWarning: Implicitly cleaning up \
<TemporaryDirectory '/tmp/qemu_func_test_sock_4esmf5ba'>Currently, the only test using socket_dir() is tests/functional/x86_64/test_vfio_user_client.py, and it does print this warning, at least with python 3.10.12. With this commit, the warning disappears.
Message-ID: <[email protected]>
--- tests/functional/qemu_test/testcase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/functional/qemu_test/testcase.py +1 -1
@@ -233,7 +233,7 @@ def tearDown(self): if "QEMU_TEST_KEEP_SCRATCH" not in os.environ: shutil.rmtree(self.workdir) if self.socketdir is not None: - shutil.rmtree(self.socketdir.name) + self.socketdir.cleanup() self.socketdir = None self.machinelog.removeHandler(self._log_fh) self.log.removeHandler(self._log_fh)
Signature · 1 line
2.51.0
[PULL 18/22] hw/s390x: Use memory_region_size()
In reply to Thomas HuthFrom: Philippe Mathieu-Daudé <[email protected]>
MemoryRegion::size is private data of MemoryRegion, use the proper memory_region_size() getter to get it.
Message-ID: <[email protected]>
--- hw/s390x/s390-pci-inst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/s390-pci-inst.c +1 -1
@@ -396,7 +396,7 @@ static MemoryRegion *s390_get_subregion(MemoryRegion *mr, uint64_t offset,uint64_t subregion_size; QTAILQ_FOREACH(subregion, &mr->subregions, subregions_link) { - subregion_size =int128_get64 (subregion->size); + subregion_size =memory_region_size (subregion);if ((offset >= subregion->addr) && (offset + len) <= (subregion->addr + subregion_size)) { mr = subregion;
Signature · 1 line
2.51.0
[PULL 07/22] tests/functional/arm/test_aspeed_ast1030: Remove unused import
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
This file does not use LinuxKernelTest directly (but AspeedTest), so we can remove this unnecessary import here.
Message-ID: <[email protected]>
--- tests/functional/arm/test_aspeed_ast1030.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tests/functional/arm/test_aspeed_ast1030.py +1 -2
@@ -6,9 +6,8 @@ # # SPDX-License-Identifier: GPL-2.0-or-later -from qemu_test import LinuxKernelTest, Asset from aspeed import AspeedTest -from qemu_test import exec_command_and_wait_for_pattern +from qemu_test import Asset, exec_command_and_wait_for_pattern class AST1030Machine(AspeedTest):
Signature · 1 line
2.51.0
[PULL 19/22] target/s390x: Fix missing interrupts for small CKC values
In reply to Thomas HuthFrom: Ilya Leoshkevich <[email protected]>
Suppose TOD clock value is 0x1111111111111111 and clock-comparator value is 0, in which case clock-comparator interruption should occur immediately.
With the current code, tod2time(env->ckc - td->base.low) ends up being a very large number, so this interruption never happens.
Fix by firing the timer immediately if env->ckc < td->base.low.
Message-ID: <[email protected]>
--- target/s390x/tcg/misc_helper.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
target/s390x/tcg/misc_helper.c +8 -4
@@ -199,11 +199,15 @@ static void update_ckc_timer(CPUS390XState *env)return ; } -/* difference between origins */ - time = env->ckc - td->base.low; +if (env->ckc < td->base.low) { + time =0 ; + }else { +/* difference between origins */ + time = env->ckc - td->base.low; -/* nanoseconds */ - time =tod2time (time); +/* nanoseconds */ + time =tod2time (time); + }timer_mod (env->tod_timer, time); }
Signature · 1 line
2.51.0
[PULL 03/22] tests/functional: Fix problems in decorators.py reported by pylint
In reply to Thomas HuthFrom: Thomas Huth <[email protected]>
The documentation strings should follow the function definition lines, not precede them.
Message-ID: <[email protected]>
--- tests/functional/qemu_test/decorators.py | 176 +++++++++++------------ 1 file changed, 87 insertions(+), 89 deletions(-)
tests/functional/qemu_test/decorators.py +87 -89
@@ -10,136 +10,134 @@ from .cmd import which -''' -Decorator to skip execution of a test if the provided -environment variables are not set. -Example: - @skipIfMissingEnv("QEMU_ENV_VAR0", "QEMU_ENV_VAR1") -''' def skipIfMissingEnv(*vars_): + ''' + Decorator to skip execution of a test if the provided + environment variables are not set. + Example: + + @skipIfMissingEnv("QEMU_ENV_VAR0", "QEMU_ENV_VAR1") + ''' missing_vars = [] for var in vars_: - if os.getenv(var) == None: + if os.getenv(var) is None: missing_vars.append(var) - has_vars = True if len(missing_vars) == 0 else False + has_vars = len(missing_vars) == 0 return skipUnless(has_vars, f"Missing env var(s): {', '.join(missing_vars)}") -''' - -Decorator to skip execution of a test if the list -of command binaries is not available in $PATH. -Example: - - @skipIfMissingCommands("mkisofs", "losetup") -''' def skipIfMissingCommands(*args): + ''' + Decorator to skip execution of a test if the list + of command binaries is not available in $PATH. + Example: + + @skipIfMissingCommands("mkisofs", "losetup") + ''' has_cmds = True for cmd in args: - if not which(cmd): - has_cmds = False - break + if not which(cmd): + has_cmds = False + break return skipUnless(has_cmds, 'required command(s) "%s" not installed' % ", ".join(args)) -''' -Decorator to skip execution of a test if the current -host operating system does match one of the prohibited -ones. -Example - - @skipIfOperatingSystem("Linux", "Darwin") -''' def skipIfOperatingSystem(*args): + ''' + Decorator to skip execution of a test if the current host + operating system does match one of the prohibited ones. + Example: + + @skipIfOperatingSystem("Linux", "Darwin") + ''' return skipIf(platform.system() in args, 'running on an OS (%s) that is not able to run this test' % ", ".join(args)) -''' -Decorator to skip execution of a test if the current -host machine does not match one of the permitted -machines. -Example - - @skipIfNotMachine("x86_64", "aarch64") -''' def skipIfNotMachine(*args): + ''' + Decorator to skip execution of a test if the current + host machine does not match one of the permitted machines. + Example: + + @skipIfNotMachine("x86_64", "aarch64") + ''' return skipUnless(platform.machine() in args, 'not running on one of the required machine(s) "%s"' % ", ".join(args)) -''' -Decorator to skip execution of flaky tests, unless -the $QEMU_TEST_FLAKY_TESTS environment variable is set. -A bug URL must be provided that documents the observed -failure behaviour, so it can be tracked & re-evaluated -in future. +def skipFlakyTest(bug_url): + ''' + Decorator to skip execution of flaky tests, unless + the $QEMU_TEST_FLAKY_TESTS environment variable is set. + A bug URL must be provided that documents the observed + failure behaviour, so it can be tracked & re-evaluated + in future. -Historical tests may be providing "None" as the bug_url -but this should not be done for new test. + Historical tests may be providing "None" as the bug_url + but this should not be done for new test. -Example: + Example: - @skipFlakyTest("https://gitlab.com/qemu-project/qemu/-/issues/NNN") -''' -def skipFlakyTest(bug_url): + @skipFlakyTest("https://gitlab.com/qemu-project/qemu/-/issues/NNN") + ''' if bug_url is None: bug_url = "FIXME: reproduce flaky test and file bug report or remove" return skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), f'Test is unstable: {bug_url}') -''' -Decorator to skip execution of tests which are likely -to execute untrusted commands on the host, or commands -which process untrusted code, unless the -$QEMU_TEST_ALLOW_UNTRUSTED_CODE env var is set. -Example: - - @skipUntrustedTest() -''' def skipUntrustedTest(): + ''' + Decorator to skip execution of tests which are likely + to execute untrusted commands on the host, or commands + which process untrusted code, unless the + $QEMU_TEST_ALLOW_UNTRUSTED_CODE env var is set. + Example: + + @skipUntrustedTest() + ''' return skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'Test runs untrusted code / processes untrusted data') -''' -Decorator to skip execution of tests which need large -data storage (over around 500MB-1GB mark) on the host, -unless the $QEMU_TEST_ALLOW_LARGE_STORAGE environment -variable is set +def skipBigDataTest(): + ''' + Decorator to skip execution of tests which need large + data storage (over around 500MB-1GB mark) on the host, + unless the $QEMU_TEST_ALLOW_LARGE_STORAGE environment + variable is set -Example: + Example: - @skipBigDataTest() -''' -def skipBigDataTest(): + @skipBigDataTest() + ''' return skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'Test requires large host storage space') -''' -Decorator to skip execution of tests which have a really long -runtime (and might e.g. time out if QEMU has been compiled with -debugging enabled) unless the $QEMU_TEST_ALLOW_SLOW -environment variable is set +def skipSlowTest(): + ''' + Decorator to skip execution of tests which have a really long + runtime (and might e.g. time out if QEMU has been compiled with + debugging enabled) unless the $QEMU_TEST_ALLOW_SLOW + environment variable is set -Example: + Example: - @skipSlowTest() -''' -def skipSlowTest(): + @skipSlowTest() + ''' return skipUnless(os.getenv('QEMU_TEST_ALLOW_SLOW'), 'Test has a very long runtime and might time out') -''' -Decorator to skip execution of a test if the list -of python imports is not available. -Example: - - @skipIfMissingImports("numpy", "cv2") -''' def skipIfMissingImports(*args): + ''' + Decorator to skip execution of a test if the list + of python imports is not available. + Example: + + @skipIfMissingImports("numpy", "cv2") + ''' has_imports = True for impname in args: try:
@@ -151,15 +149,15 @@ def skipIfMissingImports(*args): return skipUnless(has_imports, 'required import(s) "%s" not installed' % ", ".join(args)) -''' -Decorator to skip execution of a test if the system's -locked memory limit is below the required threshold. -Takes required locked memory threshold in kB. -Example: - - @skipLockedMemoryTest(2_097_152) -''' def skipLockedMemoryTest(locked_memory): + ''' + Decorator to skip execution of a test if the system's + locked memory limit is below the required threshold. + Takes required locked memory threshold in kB. + Example: + + @skipLockedMemoryTest(2_097_152) + ''' # get memlock hard limit in bytes _, ulimit_memory = resource.getrlimit(resource.RLIMIT_MEMLOCK)
Signature · 1 line
2.51.0
[PULL 22/22] tests/tcg/s390x: Test SET CLOCK COMPARATOR
In reply to Thomas HuthFrom: Ilya Leoshkevich <[email protected]>
Add a small test to prevent regressions.
Message-ID: <[email protected]>
--- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/sckc.S | 63 +++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 tests/tcg/s390x/sckc.S
tests/tcg/s390x/Makefile.softmmu-target +1 -0
@@ -28,6 +28,7 @@ ASM_TESTS = \ mc \ per \ precise-smc-softmmu \ + sckc \ ssm-early \ stosm-early \ stpq \
tests/tcg/s390x/sckc.S new file +63 -0
63 lines not on this page · raw message
Signature · 1 line
2.51.0
Richard Henderson
AppliedQuoted 12 lines · Thomas Huth
Hi Richard!
The following changes since commit
53b41bb78950912ba2d9809eef6b45e4df30c647:Merge tag 'pull-target-arm-20251031' ofhttps://gitlab.com/pm215/qemu into staging (2025-11-01 10:52:48 +0100)are available in the Git repository at:
https://gitlab.com/thuth/qemu.git tags/pull-request-2025-11-03for you to fetch changes up to
0408c61e27aca56c2d40aeb6ca0e5c5f8b8c3845:
Quoted 8 lines
tests/tcg/s390x: Test SET CLOCK COMPARATOR (2025-11-03 08:27:59 +0100)----------------------------------------------------------------
* Fix spurious EOFError messages from the device-crash-test script
* Fix various issues in the functional tests that pylint complained about
* Improve logging information in the functional tests
* Fix issue in the s390x clock-comparator code
* Use address generation for register branch targets on s390x
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.
r~