* [PATCH for-11.0 01/15] tests/functional: Add a pylintrc file
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 8:26 ` [PATCH for-11.0 02/15] tests/functional/riscv64/test_sifive_u: Remove unused import statement Thomas Huth
` (13 subsequent siblings)
14 siblings, 0 replies; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Add a pylintrc file that can be used for checking the python code of
the functional tests. For the beginning, we use some rather lax settings.
We still can refine them later if we think that there's a need for it.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
MAINTAINERS | 1 +
tests/functional/pylintrc | 80 +++++++++++++++++++++++++++++++++++++++
2 files changed, 81 insertions(+)
create mode 100644 tests/functional/pylintrc
diff --git a/MAINTAINERS b/MAINTAINERS
index 38325e0617c..3d8725b1c9a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4430,6 +4430,7 @@ R: Daniel P. Berrange <berrange@redhat.com>
S: Maintained
F: docs/devel/testing/functional.rst
F: scripts/clean_functional_cache.py
+F: tests/functional/pylintrc
F: tests/functional/qemu_test/
Windows Hosted Continuous Integration
diff --git a/tests/functional/pylintrc b/tests/functional/pylintrc
new file mode 100644
index 00000000000..a396a8ceebd
--- /dev/null
+++ b/tests/functional/pylintrc
@@ -0,0 +1,80 @@
+[DESIGN]
+
+# Maximum number of arguments for function / method.
+max-args=9
+
+# Maximum number of attributes for a class (see R0902).
+max-attributes=7
+
+# Maximum number of boolean expressions in an if statement (see R0916).
+max-bool-expr=5
+
+# Maximum number of branch for function / method body.
+max-branches=12
+
+# Maximum number of locals for function / method body.
+max-locals=15
+
+# Maximum number of parents for a class (see R0901).
+max-parents=7
+
+# Maximum number of positional arguments for function / method.
+max-positional-arguments=7
+
+# Maximum number of public methods for a class (see R0904).
+max-public-methods=20
+
+# Maximum number of return / yield for function / method body.
+max-returns=6
+
+# Maximum number of statements in function / method body.
+max-statements=50
+
+# Minimum number of public methods for a class (see R0903).
+min-public-methods=2
+
+
+[MESSAGES CONTROL]
+
+# Only show warnings with the listed confidence levels. Leave empty to show
+# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
+# UNDEFINED.
+confidence=HIGH,
+ CONTROL_FLOW,
+ INFERENCE,
+ INFERENCE_FAILURE
+
+# Disable the message, report, category or checker with the given id(s). You
+# can either give multiple identifiers separated by comma (,) or put this
+# option multiple times (only on the command line, not in the configuration
+# file where it should appear only once). You can also use "--disable=all" to
+# disable everything first and then re-enable specific checks. For example, if
+# you want to run only the similarities checker, you can use "--disable=all
+# --enable=similarities". If you want to run only the classes checker, but have
+# no Warning level messages displayed, use "--disable=all --enable=classes
+# --disable=W".
+disable=bad-inline-option,
+ consider-using-f-string,
+ file-ignored,
+ fixme,
+ import-outside-toplevel,
+ locally-disabled,
+ logging-fstring-interpolation,
+ logging-not-lazy,
+ missing-function-docstring,
+ missing-module-docstring,
+ missing-class-docstring,
+ raw-checker-failed,
+ suppressed-message,
+ too-many-locals,
+ too-many-statements,
+ use-implicit-booleaness-not-comparison-to-string,
+ use-implicit-booleaness-not-comparison-to-zero,
+ use-symbolic-message-instead,
+ useless-suppression,
+
+
+[SIMILARITIES]
+
+# Minimum lines number of a similarity.
+min-similarity-lines=20
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH for-11.0 02/15] tests/functional/riscv64/test_sifive_u: Remove unused import statement
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
2025-11-19 8:26 ` [PATCH for-11.0 01/15] tests/functional: Add a pylintrc file Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 8:26 ` [PATCH for-11.0 03/15] tests/functional/arm/test_aspeed_ast2600_buildroot: Fix pylint warnings Thomas Huth
` (12 subsequent siblings)
14 siblings, 0 replies; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
skipIfMissingCommands is not used here, remove the import to silence
a pylint warning for this file.
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20251027112803.54564-1-thuth@redhat.com>
---
tests/functional/riscv64/test_sifive_u.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/tests/functional/riscv64/test_sifive_u.py b/tests/functional/riscv64/test_sifive_u.py
index 358ff0d1f60..847f709da12 100755
--- a/tests/functional/riscv64/test_sifive_u.py
+++ b/tests/functional/riscv64/test_sifive_u.py
@@ -13,7 +13,6 @@
import os
from qemu_test import Asset, LinuxKernelTest
-from qemu_test import skipIfMissingCommands
class SifiveU(LinuxKernelTest):
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH for-11.0 03/15] tests/functional/arm/test_aspeed_ast2600_buildroot: Fix pylint warnings
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
2025-11-19 8:26 ` [PATCH for-11.0 01/15] tests/functional: Add a pylintrc file Thomas Huth
2025-11-19 8:26 ` [PATCH for-11.0 02/15] tests/functional/riscv64/test_sifive_u: Remove unused import statement Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 8:26 ` [PATCH for-11.0 04/15] tests/functional/x86_64/test_virtio_gpu: Fix various issues reported by pylint Thomas Huth
` (11 subsequent siblings)
14 siblings, 0 replies; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Pylint recommends to use a "with" context for tempfile.TemporaryDirectory()
to make sure that the directory is deleted once it is not needed anymore,
and it recommends to use the "check" parameter for subprocess.run().
For style reasons, the imports at the beginning of the file should be
grouped by module.
Message-Id: <20251113100601.476900-1-thuth@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
.../arm/test_aspeed_ast2600_buildroot.py | 21 +++++++++++--------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/tests/functional/arm/test_aspeed_ast2600_buildroot.py b/tests/functional/arm/test_aspeed_ast2600_buildroot.py
index 51f2676c906..575a5f64143 100755
--- a/tests/functional/arm/test_aspeed_ast2600_buildroot.py
+++ b/tests/functional/arm/test_aspeed_ast2600_buildroot.py
@@ -9,8 +9,8 @@
import tempfile
import subprocess
-from qemu_test import Asset
from aspeed import AspeedTest
+from qemu_test import Asset
from qemu_test import exec_command_and_wait_for_pattern, skipIfMissingCommands
@@ -66,21 +66,18 @@ def test_arm_ast2600_evb_buildroot(self):
'images/ast2600-evb/buildroot-2023.02-tpm/flash.img'),
'a46009ae8a5403a0826d607215e731a8c68d27c14c41e55331706b8f9c7bd997')
- @skipIfMissingCommands('swtpm')
- def test_arm_ast2600_evb_buildroot_tpm(self):
- self.set_machine('ast2600-evb')
-
+ def _test_arm_ast2600_evb_buildroot_tpm(self, tpmstate_dir):
image_path = self.ASSET_BR2_202302_AST2600_TPM_FLASH.fetch()
- tpmstate_dir = tempfile.TemporaryDirectory(prefix="qemu_")
- socket = os.path.join(tpmstate_dir.name, 'swtpm-socket')
+ socket = os.path.join(tpmstate_dir, 'swtpm-socket')
# We must put the TPM state dir in /tmp/, not the build dir,
# because some distros use AppArmor to lock down swtpm and
# restrict the set of locations it can access files in.
subprocess.run(['swtpm', 'socket', '-d', '--tpm2',
- '--tpmstate', f'dir={tpmstate_dir.name}',
- '--ctrl', f'type=unixio,path={socket}'])
+ '--tpmstate', f'dir={tpmstate_dir}',
+ '--ctrl', f'type=unixio,path={socket}'],
+ check=True)
self.vm.add_args('-chardev', f'socket,id=chrtpm,path={socket}')
self.vm.add_args('-tpmdev', 'emulator,id=tpm0,chardev=chrtpm')
@@ -97,6 +94,12 @@ def test_arm_ast2600_evb_buildroot_tpm(self):
self.do_test_arm_aspeed_buildroot_poweroff()
+ @skipIfMissingCommands('swtpm')
+ def test_arm_ast2600_evb_buildroot_tpm(self):
+ self.set_machine('ast2600-evb')
+ with tempfile.TemporaryDirectory(prefix="qemu_") as tpmstate_dir:
+ self._test_arm_ast2600_evb_buildroot_tpm(tpmstate_dir)
+
if __name__ == '__main__':
AspeedTest.main()
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH for-11.0 04/15] tests/functional/x86_64/test_virtio_gpu: Fix various issues reported by pylint
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (2 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 03/15] tests/functional/arm/test_aspeed_ast2600_buildroot: Fix pylint warnings Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-20 15:01 ` Zhao Liu
2025-11-19 8:26 ` [PATCH for-11.0 05/15] tests/functional/mips/test_malta: Silence warnings " Thomas Huth
` (10 subsequent siblings)
14 siblings, 1 reply; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Use the recommended order for import statements, specify the kind of
exceptions that we try to catch, use f-strings where it makes sense,
rewrite the vug_log_file part with a proper "with" statement and
fix some FIXMEs by checking for the availability of the devices, etc.
Message-Id: <20251113114015.490303-1-thuth@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/x86_64/test_virtio_gpu.py | 56 +++++++++++-----------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/tests/functional/x86_64/test_virtio_gpu.py b/tests/functional/x86_64/test_virtio_gpu.py
index be96de24da2..58b0f72ba42 100755
--- a/tests/functional/x86_64/test_virtio_gpu.py
+++ b/tests/functional/x86_64/test_virtio_gpu.py
@@ -5,22 +5,23 @@
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
+import os
+import socket
+import subprocess
from qemu_test import QemuSystemTest, Asset
from qemu_test import wait_for_console_pattern
from qemu_test import exec_command_and_wait_for_pattern
from qemu_test import is_readable_executable_file
-
-import os
-import socket
-import subprocess
+from qemu.machine.machine import VMLaunchFailure
def pick_default_vug_bin(test):
bld_dir_path = test.build_file("contrib", "vhost-user-gpu", "vhost-user-gpu")
if is_readable_executable_file(bld_dir_path):
return bld_dir_path
+ return None
class VirtioGPUx86(QemuSystemTest):
@@ -46,8 +47,8 @@ def wait_for_console_pattern(self, success_message, vm=None):
)
def test_virtio_vga_virgl(self):
- # FIXME: should check presence of virtio, virgl etc
self.require_accelerator('kvm')
+ self.require_device('virtio-vga-gl')
kernel_path = self.ASSET_KERNEL.fetch()
initrd_path = self.ASSET_INITRD.fetch()
@@ -68,7 +69,7 @@ def test_virtio_vga_virgl(self):
)
try:
self.vm.launch()
- except:
+ except VMLaunchFailure:
# TODO: probably fails because we are missing the VirGL features
self.skipTest("VirGL not enabled?")
@@ -78,8 +79,8 @@ def test_virtio_vga_virgl(self):
)
def test_vhost_user_vga_virgl(self):
- # FIXME: should check presence of vhost-user-gpu, virgl, memfd etc
self.require_accelerator('kvm')
+ self.require_device('vhost-user-vga')
vug = pick_default_vug_bin(self)
if not vug:
@@ -95,27 +96,29 @@ def test_vhost_user_vga_virgl(self):
os.set_inheritable(qemu_sock.fileno(), True)
os.set_inheritable(vug_sock.fileno(), True)
- self._vug_log_path = self.log_file("vhost-user-gpu.log")
- self._vug_log_file = open(self._vug_log_path, "wb")
- self.log.info('Complete vhost-user-gpu.log file can be '
- 'found at %s', self._vug_log_path)
-
- vugp = subprocess.Popen(
- [vug, "--virgl", "--fd=%d" % vug_sock.fileno()],
- stdin=subprocess.DEVNULL,
- stdout=self._vug_log_file,
- stderr=subprocess.STDOUT,
- shell=False,
- close_fds=False,
- )
- self._vug_log_file.close()
-
+ vug_log_path = self.log_file("vhost-user-gpu.log")
+ self.log.info('Complete vhost-user-gpu.log file can be found at %s',
+ vug_log_path)
+ with open(vug_log_path, "wb") as vug_log_file:
+ with subprocess.Popen([vug, "--virgl", f"--fd={vug_sock.fileno()}"],
+ stdin=subprocess.DEVNULL,
+ stdout=vug_log_file,
+ stderr=subprocess.STDOUT,
+ shell=False,
+ close_fds=False) as vugp:
+ self._test_vhost_user_vga_virgl(qemu_sock,
+ kernel_path, initrd_path)
+ qemu_sock.close()
+ vug_sock.close()
+ vugp.terminate()
+
+ def _test_vhost_user_vga_virgl(self, qemu_sock, kernel_path, initrd_path):
self.vm.set_console()
self.vm.add_args("-cpu", "host")
self.vm.add_args("-m", "2G")
self.vm.add_args("-object", "memory-backend-memfd,id=mem,size=2G")
self.vm.add_args("-machine", "pc,memory-backend=mem,accel=kvm")
- self.vm.add_args("-chardev", "socket,id=vug,fd=%d" % qemu_sock.fileno())
+ self.vm.add_args("-chardev", f"socket,id=vug,fd={qemu_sock.fileno()}")
self.vm.add_args("-device", "vhost-user-vga,chardev=vug")
self.vm.add_args("-display", "egl-headless")
self.vm.add_args(
@@ -128,17 +131,14 @@ def test_vhost_user_vga_virgl(self):
)
try:
self.vm.launch()
- except:
+ except VMLaunchFailure:
# TODO: probably fails because we are missing the VirGL features
self.skipTest("VirGL not enabled?")
self.wait_for_console_pattern("as init process")
exec_command_and_wait_for_pattern(self, "/usr/sbin/modprobe virtio_gpu",
"features: +virgl +edid")
self.vm.shutdown()
- qemu_sock.close()
- vug_sock.close()
- vugp.terminate()
- vugp.wait()
+
if __name__ == '__main__':
QemuSystemTest.main()
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH for-11.0 04/15] tests/functional/x86_64/test_virtio_gpu: Fix various issues reported by pylint
2025-11-19 8:26 ` [PATCH for-11.0 04/15] tests/functional/x86_64/test_virtio_gpu: Fix various issues reported by pylint Thomas Huth
@ 2025-11-20 15:01 ` Zhao Liu
0 siblings, 0 replies; 26+ messages in thread
From: Zhao Liu @ 2025-11-20 15:01 UTC (permalink / raw)
To: Thomas Huth
Cc: qemu-devel, John Snow, Daniel P. Berrangé, Paolo Bonzini,
Alex Bennée, Radoslaw Biernacki, Peter Maydell,
Leif Lindholm, Eric Auger, Philippe Mathieu-Daudé,
Aurelien Jarno, BALATON Zoltan, Glenn Miles, Nicholas Piggin,
Harsh Prateek Bora, Palmer Dabbelt, Alistair Francis, Weiwei Li,
Daniel Henrique Barboza, Liu Zhiwei, Jiaxun Yang
On Wed, Nov 19, 2025 at 09:26:25AM +0100, Thomas Huth wrote:
> Date: Wed, 19 Nov 2025 09:26:25 +0100
> From: Thomas Huth <thuth@redhat.com>
> Subject: [PATCH for-11.0 04/15] tests/functional/x86_64/test_virtio_gpu:
> Fix various issues reported by pylint
>
> From: Thomas Huth <thuth@redhat.com>
>
> Use the recommended order for import statements, specify the kind of
> exceptions that we try to catch, use f-strings where it makes sense,
> rewrite the vug_log_file part with a proper "with" statement and
> fix some FIXMEs by checking for the availability of the devices, etc.
>
> Message-Id: <20251113114015.490303-1-thuth@redhat.com>
> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/functional/x86_64/test_virtio_gpu.py | 56 +++++++++++-----------
> 1 file changed, 28 insertions(+), 28 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH for-11.0 05/15] tests/functional/mips/test_malta: Silence warnings reported by pylint
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (3 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 04/15] tests/functional/x86_64/test_virtio_gpu: Fix various issues reported by pylint Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 8:26 ` [PATCH for-11.0 06/15] tests/functional/ppc64/test_hv: " Thomas Huth
` (9 subsequent siblings)
14 siblings, 0 replies; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Pylint complains about too many positional arguments for the
mips_check_wheezy() function. Add a "*" to enforce that the later
ones are passed with an argument name (all calling sites are doing
this already).
Also turn some old-school format strings into proper f-strings now.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/mips/test_malta.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/functional/mips/test_malta.py b/tests/functional/mips/test_malta.py
index 7a734bc069b..e8f49f130be 100755
--- a/tests/functional/mips/test_malta.py
+++ b/tests/functional/mips/test_malta.py
@@ -50,7 +50,7 @@ def mips_run_common_commands(test, prompt='#'):
' : ata_piix')
wait_for_console_pattern(test, prompt)
-def mips_check_wheezy(test, kernel_path, image_path, kernel_command_line,
+def mips_check_wheezy(test, kernel_path, image_path, kernel_command_line, *,
dl_file, hsum, nic='pcnet', cpuinfo='MIPS 24Kc'):
test.require_netdev('user')
test.require_device(nic)
@@ -59,10 +59,10 @@ def mips_check_wheezy(test, kernel_path, image_path, kernel_command_line,
port=8080
test.vm.add_args('-kernel', kernel_path,
'-append', kernel_command_line,
- '-drive', 'file=%s,snapshot=on' % image_path,
+ '-drive', f'file={image_path},snapshot=on',
'-netdev', 'user,id=n1' +
',tftp=' + os.path.basename(kernel_path) +
- ',hostfwd=tcp:127.0.0.1:0-:%d' % port,
+ f',hostfwd=tcp:127.0.0.1:0-:{port}',
'-device', f'{nic},netdev=n1',
'-no-reboot')
test.vm.set_console()
@@ -111,7 +111,7 @@ def test_mips_malta(self):
self.vm.add_args('-kernel', kernel_path,
'-append', kernel_command_line)
self.vm.launch()
- console_pattern = 'Kernel command line: %s' % kernel_command_line
+ console_pattern = f'Kernel command line: {kernel_command_line}'
self.wait_for_console_pattern(console_pattern)
ASSET_KERNEL_4_5_0 = Asset(
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH for-11.0 06/15] tests/functional/ppc64/test_hv: Silence warnings reported by pylint
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (4 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 05/15] tests/functional/mips/test_malta: Silence warnings " Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 8:26 ` [PATCH for-11.0 07/15] tests/functional/x86_64/test_reverse_debug: Silence pylint warning Thomas Huth
` (8 subsequent siblings)
14 siblings, 0 replies; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
To make pylint happy here, remove unused variables, switch to f-string,
use "check=True" when calling subprocess.run() and split a line that was
too long.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/ppc64/test_hv.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/tests/functional/ppc64/test_hv.py b/tests/functional/ppc64/test_hv.py
index d87f440fa79..beec1dbbea3 100755
--- a/tests/functional/ppc64/test_hv.py
+++ b/tests/functional/ppc64/test_hv.py
@@ -29,8 +29,6 @@
@skipBigDataTest()
class HypervisorTest(QemuSystemTest):
- timeout = 1000
- KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
panic_message = 'Kernel panic - not syncing'
good_message = 'VFS: Cannot open root device'
@@ -49,8 +47,8 @@ def extract_from_iso(self, iso, path):
"""
filename = self.scratch_file(os.path.basename(path))
- cmd = "xorriso -osirrox on -indev %s -cpx %s %s" % (iso, path, filename)
- subprocess.run(cmd.split(),
+ cmd = f"xorriso -osirrox on -indev {iso} -cpx {path} {filename}"
+ subprocess.run(cmd.split(), check=True,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
os.chmod(filename, 0o600)
@@ -66,7 +64,6 @@ def setUp(self):
def do_start_alpine(self):
self.vm.set_console()
- kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
self.vm.add_args("-kernel", self.vmlinuz)
self.vm.add_args("-initrd", self.initramfs)
self.vm.add_args("-smp", "4", "-m", "2g")
@@ -78,7 +75,8 @@ def do_start_alpine(self):
wait_for_console_pattern(self, 'localhost login:')
exec_command_and_wait_for_pattern(self, 'root', ps1)
# If the time is wrong, SSL certificates can fail.
- exec_command_and_wait_for_pattern(self, 'date -s "' + datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S' + '"'), ps1)
+ cmd='date -s "' + datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S' + '"')
+ exec_command_and_wait_for_pattern(self, cmd, ps1)
ps1='alpine:~#'
exec_command_and_wait_for_pattern(self, 'setup-alpine -qe', ps1)
exec_command_and_wait_for_pattern(self, 'setup-apkrepos -c1', ps1)
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH for-11.0 07/15] tests/functional/x86_64/test_reverse_debug: Silence pylint warning
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (5 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 06/15] tests/functional/ppc64/test_hv: " Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 10:22 ` Philippe Mathieu-Daudé
2025-11-20 15:01 ` Zhao Liu
2025-11-19 8:26 ` [PATCH for-11.0 08/15] tests/functional/x86_64/test_memlock: Silence pylint warnings Thomas Huth
` (7 subsequent siblings)
14 siblings, 2 replies; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Pylint does not like the underscores in the class name here, so
rename the class accordingly to make pylint happy here.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/x86_64/test_reverse_debug.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/functional/x86_64/test_reverse_debug.py b/tests/functional/x86_64/test_reverse_debug.py
index 2b31ae87243..ab5dac98386 100755
--- a/tests/functional/x86_64/test_reverse_debug.py
+++ b/tests/functional/x86_64/test_reverse_debug.py
@@ -18,7 +18,7 @@
from reverse_debugging import ReverseDebugging
-class ReverseDebugging_X86_64(ReverseDebugging):
+class ReverseDebuggingX86(ReverseDebugging):
@skipFlakyTest("https://gitlab.com/qemu-project/qemu/-/issues/2922")
def test_x86_64_pc(self):
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH for-11.0 07/15] tests/functional/x86_64/test_reverse_debug: Silence pylint warning
2025-11-19 8:26 ` [PATCH for-11.0 07/15] tests/functional/x86_64/test_reverse_debug: Silence pylint warning Thomas Huth
@ 2025-11-19 10:22 ` Philippe Mathieu-Daudé
2025-11-20 15:01 ` Zhao Liu
1 sibling, 0 replies; 26+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-11-19 10:22 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger, Aurelien Jarno,
BALATON Zoltan, Glenn Miles, Nicholas Piggin, Harsh Prateek Bora,
Palmer Dabbelt, Alistair Francis, Weiwei Li,
Daniel Henrique Barboza, Liu Zhiwei, Zhao Liu, Jiaxun Yang
On 19/11/25 09:26, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> Pylint does not like the underscores in the class name here, so
> rename the class accordingly to make pylint happy here.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/functional/x86_64/test_reverse_debug.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH for-11.0 07/15] tests/functional/x86_64/test_reverse_debug: Silence pylint warning
2025-11-19 8:26 ` [PATCH for-11.0 07/15] tests/functional/x86_64/test_reverse_debug: Silence pylint warning Thomas Huth
2025-11-19 10:22 ` Philippe Mathieu-Daudé
@ 2025-11-20 15:01 ` Zhao Liu
1 sibling, 0 replies; 26+ messages in thread
From: Zhao Liu @ 2025-11-20 15:01 UTC (permalink / raw)
To: Thomas Huth
Cc: qemu-devel, John Snow, Daniel P. Berrangé, Paolo Bonzini,
Alex Bennée, Radoslaw Biernacki, Peter Maydell,
Leif Lindholm, Eric Auger, Philippe Mathieu-Daudé,
Aurelien Jarno, BALATON Zoltan, Glenn Miles, Nicholas Piggin,
Harsh Prateek Bora, Palmer Dabbelt, Alistair Francis, Weiwei Li,
Daniel Henrique Barboza, Liu Zhiwei, Jiaxun Yang
On Wed, Nov 19, 2025 at 09:26:28AM +0100, Thomas Huth wrote:
> Date: Wed, 19 Nov 2025 09:26:28 +0100
> From: Thomas Huth <thuth@redhat.com>
> Subject: [PATCH for-11.0 07/15] tests/functional/x86_64/test_reverse_debug:
> Silence pylint warning
>
> From: Thomas Huth <thuth@redhat.com>
>
> Pylint does not like the underscores in the class name here, so
> rename the class accordingly to make pylint happy here.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/functional/x86_64/test_reverse_debug.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH for-11.0 08/15] tests/functional/x86_64/test_memlock: Silence pylint warnings
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (6 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 07/15] tests/functional/x86_64/test_reverse_debug: Silence pylint warning Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-20 10:56 ` Philippe Mathieu-Daudé
2025-11-20 15:02 ` Zhao Liu
2025-11-19 8:26 ` [PATCH for-11.0 09/15] tests/functional/ppc/test_amiga: Fix issues reported by pylint and flake8 Thomas Huth
` (6 subsequent siblings)
14 siblings, 2 replies; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Pylint complains about a missing "encoding" parameter for the open()
function here, and about a missing return statement in the "except"
block (which cannot happen since skipTest() never returns). Rework
the code a little bit to silence the warnings.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/x86_64/test_memlock.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/functional/x86_64/test_memlock.py b/tests/functional/x86_64/test_memlock.py
index 81bce80b0c4..f970a2c3095 100755
--- a/tests/functional/x86_64/test_memlock.py
+++ b/tests/functional/x86_64/test_memlock.py
@@ -69,11 +69,13 @@ def get_process_status_values(self, pid: int) -> Dict[str, int]:
return result
def _get_raw_process_status(self, pid: int) -> str:
+ status = None
try:
- with open(f'/proc/{pid}/status', 'r') as f:
- return f.read()
+ with open(f'/proc/{pid}/status', 'r', encoding="ascii") as f:
+ status = f.read()
except FileNotFoundError:
self.skipTest("Can't open status file of the process")
+ return status
if __name__ == '__main__':
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH for-11.0 08/15] tests/functional/x86_64/test_memlock: Silence pylint warnings
2025-11-19 8:26 ` [PATCH for-11.0 08/15] tests/functional/x86_64/test_memlock: Silence pylint warnings Thomas Huth
@ 2025-11-20 10:56 ` Philippe Mathieu-Daudé
2025-11-20 15:02 ` Zhao Liu
1 sibling, 0 replies; 26+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-11-20 10:56 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger, Aurelien Jarno,
BALATON Zoltan, Glenn Miles, Nicholas Piggin, Harsh Prateek Bora,
Palmer Dabbelt, Alistair Francis, Weiwei Li,
Daniel Henrique Barboza, Liu Zhiwei, Zhao Liu, Jiaxun Yang
On 19/11/25 09:26, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> Pylint complains about a missing "encoding" parameter for the open()
> function here, and about a missing return statement in the "except"
> block (which cannot happen since skipTest() never returns). Rework
> the code a little bit to silence the warnings.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/functional/x86_64/test_memlock.py | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH for-11.0 08/15] tests/functional/x86_64/test_memlock: Silence pylint warnings
2025-11-19 8:26 ` [PATCH for-11.0 08/15] tests/functional/x86_64/test_memlock: Silence pylint warnings Thomas Huth
2025-11-20 10:56 ` Philippe Mathieu-Daudé
@ 2025-11-20 15:02 ` Zhao Liu
1 sibling, 0 replies; 26+ messages in thread
From: Zhao Liu @ 2025-11-20 15:02 UTC (permalink / raw)
To: Thomas Huth
Cc: qemu-devel, John Snow, Daniel P. Berrangé, Paolo Bonzini,
Alex Bennée, Radoslaw Biernacki, Peter Maydell,
Leif Lindholm, Eric Auger, Philippe Mathieu-Daudé,
Aurelien Jarno, BALATON Zoltan, Glenn Miles, Nicholas Piggin,
Harsh Prateek Bora, Palmer Dabbelt, Alistair Francis, Weiwei Li,
Daniel Henrique Barboza, Liu Zhiwei, Jiaxun Yang
On Wed, Nov 19, 2025 at 09:26:29AM +0100, Thomas Huth wrote:
> Date: Wed, 19 Nov 2025 09:26:29 +0100
> From: Thomas Huth <thuth@redhat.com>
> Subject: [PATCH for-11.0 08/15] tests/functional/x86_64/test_memlock:
> Silence pylint warnings
>
> From: Thomas Huth <thuth@redhat.com>
>
> Pylint complains about a missing "encoding" parameter for the open()
> function here, and about a missing return statement in the "except"
> block (which cannot happen since skipTest() never returns). Rework
> the code a little bit to silence the warnings.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/functional/x86_64/test_memlock.py | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH for-11.0 09/15] tests/functional/ppc/test_amiga: Fix issues reported by pylint and flake8
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (7 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 08/15] tests/functional/x86_64/test_memlock: Silence pylint warnings Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 10:22 ` Philippe Mathieu-Daudé
2025-11-19 8:26 ` [PATCH for-11.0 10/15] tests/functional/ppc/test_ppe42: Fix style issues reported by pylint Thomas Huth
` (5 subsequent siblings)
14 siblings, 1 reply; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Pylint complains about unused variable "tar_name" and a missing "check"
for subprocess.run(), and flake8 suggest a second empty line after the
class. While we're at it, also remove the unused "timeout" class variable
(that was only necessary for the avocado framework which we don't use
anymore).
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/ppc/test_amiga.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tests/functional/ppc/test_amiga.py b/tests/functional/ppc/test_amiga.py
index 8600e2e9633..36378fb6972 100755
--- a/tests/functional/ppc/test_amiga.py
+++ b/tests/functional/ppc/test_amiga.py
@@ -15,8 +15,6 @@
class AmigaOneMachine(QemuSystemTest):
- timeout = 90
-
ASSET_IMAGE = Asset(
('https://www.hyperion-entertainment.com/index.php/'
'downloads?view=download&format=raw&file=25'),
@@ -25,19 +23,19 @@ class AmigaOneMachine(QemuSystemTest):
def test_ppc_amigaone(self):
self.require_accelerator("tcg")
self.set_machine('amigaone')
- tar_name = 'A1Firmware_Floppy_05-Mar-2005.zip'
self.archive_extract(self.ASSET_IMAGE, format="zip")
bios = self.scratch_file("u-boot-amigaone.bin")
with open(bios, "wb") as bios_fh:
subprocess.run(['tail', '-c', '524288',
self.scratch_file("floppy_edition",
"updater.image")],
- stdout=bios_fh)
+ stdout=bios_fh, check=True)
self.vm.set_console()
self.vm.add_args('-bios', bios)
self.vm.launch()
wait_for_console_pattern(self, 'FLASH:')
+
if __name__ == '__main__':
QemuSystemTest.main()
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH for-11.0 09/15] tests/functional/ppc/test_amiga: Fix issues reported by pylint and flake8
2025-11-19 8:26 ` [PATCH for-11.0 09/15] tests/functional/ppc/test_amiga: Fix issues reported by pylint and flake8 Thomas Huth
@ 2025-11-19 10:22 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 26+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-11-19 10:22 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger, Aurelien Jarno,
BALATON Zoltan, Glenn Miles, Nicholas Piggin, Harsh Prateek Bora,
Palmer Dabbelt, Alistair Francis, Weiwei Li,
Daniel Henrique Barboza, Liu Zhiwei, Zhao Liu, Jiaxun Yang
On 19/11/25 09:26, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> Pylint complains about unused variable "tar_name" and a missing "check"
> for subprocess.run(), and flake8 suggest a second empty line after the
> class. While we're at it, also remove the unused "timeout" class variable
> (that was only necessary for the avocado framework which we don't use
> anymore).
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/functional/ppc/test_amiga.py | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH for-11.0 10/15] tests/functional/ppc/test_ppe42: Fix style issues reported by pylint
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (8 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 09/15] tests/functional/ppc/test_amiga: Fix issues reported by pylint and flake8 Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 16:29 ` Miles Glenn
2025-11-20 10:55 ` Philippe Mathieu-Daudé
2025-11-19 8:26 ` [PATCH for-11.0 11/15] tests/functional/aarch64/test_virt_gpu: Fix style issues Thomas Huth
` (4 subsequent siblings)
14 siblings, 2 replies; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Pylint suggests to write some parts of the code in a slightly different
way ... thus rework the code to make the linter happy.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/ppc/test_ppe42.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/functional/ppc/test_ppe42.py b/tests/functional/ppc/test_ppe42.py
index 26bbe11b2d3..7b360a40a54 100644
--- a/tests/functional/ppc/test_ppe42.py
+++ b/tests/functional/ppc/test_ppe42.py
@@ -6,8 +6,9 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
-from qemu_test import QemuSystemTest, Asset
import asyncio
+from qemu_test import QemuSystemTest, Asset
+
class Ppe42Machine(QemuSystemTest):
@@ -30,13 +31,13 @@ def _test_completed(self):
raise
self.log.info(output)
- if "NIP fff80200" in output:
- self.log.info("<test completed>")
- return True
- else:
+ if "NIP fff80200" not in output:
self.log.info("<test not completed>")
return False
+ self.log.info("<test completed>")
+ return True
+
def _wait_pass_fail(self, timeout):
while not self._test_completed():
if timeout >= self.poll_period:
@@ -49,14 +50,13 @@ def _wait_pass_fail(self, timeout):
except asyncio.TimeoutError:
self.log.info("Poll period ended.")
- pass
except Exception as err:
self.log.debug(f"event_wait() failed due to {err=},"
" {type(err)=}")
raise
- if e != None:
+ if e is not None:
self.log.debug(f"Execution stopped: {e}")
self.log.debug("Exiting due to test failure")
self.fail("Failure detected!")
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH for-11.0 10/15] tests/functional/ppc/test_ppe42: Fix style issues reported by pylint
2025-11-19 8:26 ` [PATCH for-11.0 10/15] tests/functional/ppc/test_ppe42: Fix style issues reported by pylint Thomas Huth
@ 2025-11-19 16:29 ` Miles Glenn
2025-11-20 10:55 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 26+ messages in thread
From: Miles Glenn @ 2025-11-19 16:29 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
Reviewed-by: Glenn Miles <milesg@linux.ibm.com>
Thanks,
Glenn
On Wed, 2025-11-19 at 09:26 +0100, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> Pylint suggests to write some parts of the code in a slightly different
> way ... thus rework the code to make the linter happy.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/functional/ppc/test_ppe42.py | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tests/functional/ppc/test_ppe42.py b/tests/functional/ppc/test_ppe42.py
> index 26bbe11b2d3..7b360a40a54 100644
> --- a/tests/functional/ppc/test_ppe42.py
> +++ b/tests/functional/ppc/test_ppe42.py
> @@ -6,8 +6,9 @@
> #
> # SPDX-License-Identifier: GPL-2.0-or-later
>
> -from qemu_test import QemuSystemTest, Asset
> import asyncio
> +from qemu_test import QemuSystemTest, Asset
> +
>
> class Ppe42Machine(QemuSystemTest):
>
> @@ -30,13 +31,13 @@ def _test_completed(self):
> raise
>
> self.log.info(output)
> - if "NIP fff80200" in output:
> - self.log.info("<test completed>")
> - return True
> - else:
> + if "NIP fff80200" not in output:
> self.log.info("<test not completed>")
> return False
>
> + self.log.info("<test completed>")
> + return True
> +
> def _wait_pass_fail(self, timeout):
> while not self._test_completed():
> if timeout >= self.poll_period:
> @@ -49,14 +50,13 @@ def _wait_pass_fail(self, timeout):
>
> except asyncio.TimeoutError:
> self.log.info("Poll period ended.")
> - pass
>
> except Exception as err:
> self.log.debug(f"event_wait() failed due to {err=},"
> " {type(err)=}")
> raise
>
> - if e != None:
> + if e is not None:
> self.log.debug(f"Execution stopped: {e}")
> self.log.debug("Exiting due to test failure")
> self.fail("Failure detected!")
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [PATCH for-11.0 10/15] tests/functional/ppc/test_ppe42: Fix style issues reported by pylint
2025-11-19 8:26 ` [PATCH for-11.0 10/15] tests/functional/ppc/test_ppe42: Fix style issues reported by pylint Thomas Huth
2025-11-19 16:29 ` Miles Glenn
@ 2025-11-20 10:55 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 26+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-11-20 10:55 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger, Aurelien Jarno,
BALATON Zoltan, Glenn Miles, Nicholas Piggin, Harsh Prateek Bora,
Palmer Dabbelt, Alistair Francis, Weiwei Li,
Daniel Henrique Barboza, Liu Zhiwei, Zhao Liu, Jiaxun Yang
On 19/11/25 09:26, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> Pylint suggests to write some parts of the code in a slightly different
> way ... thus rework the code to make the linter happy.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/functional/ppc/test_ppe42.py | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH for-11.0 11/15] tests/functional/aarch64/test_virt_gpu: Fix style issues
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (9 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 10/15] tests/functional/ppc/test_ppe42: Fix style issues reported by pylint Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 8:26 ` [PATCH for-11.0 12/15] tests/functional/aarch64/test_reverse_debug: Fix issues reported by pylint Thomas Huth
` (3 subsequent siblings)
14 siblings, 0 replies; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Reshuffle the import statements according to the suggestions from pylint,
use lowercase letters for variable names, and drop some spaces that flake8
did not like.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/aarch64/test_virt_gpu.py | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/tests/functional/aarch64/test_virt_gpu.py b/tests/functional/aarch64/test_virt_gpu.py
index c26a1f20c65..6ed0e0fc1a9 100755
--- a/tests/functional/aarch64/test_virt_gpu.py
+++ b/tests/functional/aarch64/test_virt_gpu.py
@@ -9,16 +9,16 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
-from qemu.machine.machine import VMLaunchFailure
+from re import search
+from subprocess import check_output, CalledProcessError
-from qemu_test import Asset
+from qemu_test import Asset, skipIfMissingCommands
from qemu_test import exec_command_and_wait_for_pattern as ec_and_wait
-from qemu_test import skipIfMissingCommands
from qemu_test.linuxkernel import LinuxKernelTest
-from re import search
-from subprocess import check_output, CalledProcessError
+from qemu.machine.machine import VMLaunchFailure
+
class Aarch64VirtGPUMachine(LinuxKernelTest):
@@ -81,16 +81,16 @@ def _launch_virt_gpu(self, gpu_device):
self.wait_for_console_pattern('buildroot login:')
ec_and_wait(self, 'root', '#')
- def _run_virt_weston_test(self, cmd, fail = None):
+ def _run_virt_weston_test(self, cmd, fail=None):
# make it easier to detect successful return to shell
- PS1 = 'RES=[$?] # '
- OK_CMD = 'RES=[0] # '
+ ps1 = 'RES=[$?] # '
+ ok_cmd = 'RES=[0] # '
ec_and_wait(self, 'export XDG_RUNTIME_DIR=/tmp', '#')
- ec_and_wait(self, f"export PS1='{PS1}'", OK_CMD)
+ ec_and_wait(self, f"export PS1='{ps1}'", ok_cmd)
full_cmd = f"weston -B headless --renderer gl --shell kiosk -- {cmd}"
- ec_and_wait(self, full_cmd, OK_CMD, fail)
+ ec_and_wait(self, full_cmd, ok_cmd, fail)
@skipIfMissingCommands('zstd')
def test_aarch64_virt_with_virgl_gpu(self):
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH for-11.0 12/15] tests/functional/aarch64/test_reverse_debug: Fix issues reported by pylint
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (10 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 11/15] tests/functional/aarch64/test_virt_gpu: Fix style issues Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 10:23 ` Philippe Mathieu-Daudé
2025-11-19 8:26 ` [PATCH for-11.0 13/15] tests/functional/aarch64/test_smmu: Silence warning from pylint Thomas Huth
` (2 subsequent siblings)
14 siblings, 1 reply; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Don't use underscores in CamelCase names and drop an unused import.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/aarch64/test_reverse_debug.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/functional/aarch64/test_reverse_debug.py b/tests/functional/aarch64/test_reverse_debug.py
index ec3348c96d8..e9fa4479d73 100755
--- a/tests/functional/aarch64/test_reverse_debug.py
+++ b/tests/functional/aarch64/test_reverse_debug.py
@@ -14,11 +14,11 @@
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
-from qemu_test import Asset, skipFlakyTest
+from qemu_test import Asset
from reverse_debugging import ReverseDebugging
-class ReverseDebugging_AArch64(ReverseDebugging):
+class ReverseDebuggingAArch64(ReverseDebugging):
ASSET_KERNEL = Asset(
('https://archives.fedoraproject.org/pub/archive/fedora/linux/'
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH for-11.0 12/15] tests/functional/aarch64/test_reverse_debug: Fix issues reported by pylint
2025-11-19 8:26 ` [PATCH for-11.0 12/15] tests/functional/aarch64/test_reverse_debug: Fix issues reported by pylint Thomas Huth
@ 2025-11-19 10:23 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 26+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-11-19 10:23 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger, Aurelien Jarno,
BALATON Zoltan, Glenn Miles, Nicholas Piggin, Harsh Prateek Bora,
Palmer Dabbelt, Alistair Francis, Weiwei Li,
Daniel Henrique Barboza, Liu Zhiwei, Zhao Liu, Jiaxun Yang
On 19/11/25 09:26, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> Don't use underscores in CamelCase names and drop an unused import.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/functional/aarch64/test_reverse_debug.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH for-11.0 13/15] tests/functional/aarch64/test_smmu: Silence warning from pylint
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (11 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 12/15] tests/functional/aarch64/test_reverse_debug: Fix issues reported by pylint Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 8:26 ` [PATCH for-11.0 14/15] tests/functional/aarch64/test_rme_sbsaref: Silence issues reported by pylint Thomas Huth
2025-11-19 8:26 ` [PATCH for-11.0 15/15] tests/functional: Add a generic test that checks the files with pylint Thomas Huth
14 siblings, 0 replies; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Pylint thinks that the accel variable might be used here without
being set first, since it does not know that skipTest() never
returns. Thus initialize "accel = None" here to make it happy.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/aarch64/test_smmu.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/functional/aarch64/test_smmu.py b/tests/functional/aarch64/test_smmu.py
index e0f4a922176..87b9b14e7a5 100755
--- a/tests/functional/aarch64/test_smmu.py
+++ b/tests/functional/aarch64/test_smmu.py
@@ -50,6 +50,7 @@ def common_vm_setup(self, kernel, initrd, disk):
elif kvm_available(self.qemu_bin):
accel = "kvm"
else:
+ accel = None # for keeping pylint happy
self.skipTest("Neither HVF nor KVM accelerator is available")
self.require_accelerator(accel)
self.require_netdev('user')
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* [PATCH for-11.0 14/15] tests/functional/aarch64/test_rme_sbsaref: Silence issues reported by pylint
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (12 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 13/15] tests/functional/aarch64/test_smmu: Silence warning from pylint Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
2025-11-19 10:24 ` Philippe Mathieu-Daudé
2025-11-19 8:26 ` [PATCH for-11.0 15/15] tests/functional: Add a generic test that checks the files with pylint Thomas Huth
14 siblings, 1 reply; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
Drop unused import and use an encoding for open().
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/aarch64/test_rme_sbsaref.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tests/functional/aarch64/test_rme_sbsaref.py b/tests/functional/aarch64/test_rme_sbsaref.py
index 6f92858397a..4845c824960 100755
--- a/tests/functional/aarch64/test_rme_sbsaref.py
+++ b/tests/functional/aarch64/test_rme_sbsaref.py
@@ -14,7 +14,6 @@
import shutil
from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern
-from qemu_test import exec_command_and_wait_for_pattern
class Aarch64RMESbsaRefMachine(QemuSystemTest):
@@ -48,7 +47,7 @@ def test_aarch64_rme_sbsaref(self):
efi = join(rme_stack, 'out', 'EFI')
os.makedirs(efi, exist_ok=True)
shutil.copyfile(join(rme_stack, 'out', 'Image'), join(efi, 'Image'))
- with open(join(efi, 'startup.nsh'), 'w') as startup:
+ with open(join(efi, 'startup.nsh'), 'w', encoding='ascii') as startup:
startup.write('fs0:Image nokaslr root=/dev/vda rw init=/init --'
' /host/out/lkvm run --realm'
' -m 256m'
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread* Re: [PATCH for-11.0 14/15] tests/functional/aarch64/test_rme_sbsaref: Silence issues reported by pylint
2025-11-19 8:26 ` [PATCH for-11.0 14/15] tests/functional/aarch64/test_rme_sbsaref: Silence issues reported by pylint Thomas Huth
@ 2025-11-19 10:24 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 26+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-11-19 10:24 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger, Aurelien Jarno,
BALATON Zoltan, Glenn Miles, Nicholas Piggin, Harsh Prateek Bora,
Palmer Dabbelt, Alistair Francis, Weiwei Li,
Daniel Henrique Barboza, Liu Zhiwei, Zhao Liu, Jiaxun Yang
On 19/11/25 09:26, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> Drop unused import and use an encoding for open().
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/functional/aarch64/test_rme_sbsaref.py | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH for-11.0 15/15] tests/functional: Add a generic test that checks the files with pylint
2025-11-19 8:26 [PATCH for-11.0 00/15] tests/functional: Check Python code with pylint Thomas Huth
` (13 preceding siblings ...)
2025-11-19 8:26 ` [PATCH for-11.0 14/15] tests/functional/aarch64/test_rme_sbsaref: Silence issues reported by pylint Thomas Huth
@ 2025-11-19 8:26 ` Thomas Huth
14 siblings, 0 replies; 26+ messages in thread
From: Thomas Huth @ 2025-11-19 8:26 UTC (permalink / raw)
To: qemu-devel, John Snow, Daniel P. Berrangé
Cc: Paolo Bonzini, Alex Bennée, Radoslaw Biernacki,
Peter Maydell, Leif Lindholm, Eric Auger,
Philippe Mathieu-Daudé, Aurelien Jarno, BALATON Zoltan,
Glenn Miles, Nicholas Piggin, Harsh Prateek Bora, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Zhao Liu, Jiaxun Yang
From: Thomas Huth <thuth@redhat.com>
To avoid that new pylint-related warnings get committed, let's check
the files with pylint during each run (similar to what we are doing
for the iotests already).
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/generic/meson.build | 1 +
tests/functional/generic/test_linters.py | 41 ++++++++++++++++++++++++
2 files changed, 42 insertions(+)
create mode 100755 tests/functional/generic/test_linters.py
diff --git a/tests/functional/generic/meson.build b/tests/functional/generic/meson.build
index 013cc96fbf8..09763c5d229 100644
--- a/tests/functional/generic/meson.build
+++ b/tests/functional/generic/meson.build
@@ -3,6 +3,7 @@
tests_generic_system = [
'empty_cpu_model',
'info_usernet',
+ 'linters',
'version',
'vnc',
]
diff --git a/tests/functional/generic/test_linters.py b/tests/functional/generic/test_linters.py
new file mode 100755
index 00000000000..b5b90fcf7a3
--- /dev/null
+++ b/tests/functional/generic/test_linters.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+'''Python linter tests'''
+
+import os
+
+from pathlib import Path
+from qemu_test import QemuBaseTest, skipIfMissingImports
+
+
+class LinterTest(QemuBaseTest):
+ '''
+ Run python linters on the test *.py files
+ '''
+
+ @skipIfMissingImports("pylint")
+ def test_pylint(self):
+ '''Check source files with pylint'''
+ from pylint.lint import Run as pylint_run
+ from pylint.reporters.collecting_reporter import CollectingReporter
+ srcdir = os.path.join(Path(__file__).parent.parent, self.arch)
+ rcfile = os.path.join(Path(__file__).parent.parent, "pylintrc")
+ self.log.info('Checking files in %s with pylint', srcdir)
+ reporter = CollectingReporter()
+ pylint_run(["--rcfile", rcfile, srcdir], reporter=reporter, exit=False)
+ if reporter.messages:
+ fmt = '"{path}:{line}: {msg_id}: {msg} ({symbol})"'
+ for msg in reporter.messages:
+ if msg.category == "error":
+ self.log.error(msg.format(fmt))
+ elif msg.category == "warning":
+ self.log.warning(msg.format(fmt))
+ else:
+ self.log.info(msg.format(fmt))
+ self.fail("Pylint failed, see base.log for details.")
+
+
+if __name__ == '__main__':
+ QemuBaseTest.main()
--
2.51.1
^ permalink raw reply related [flat|nested] 26+ messages in thread