[PATCH] configs: Fix typo in the sh4-softmmu devices config file

2024-09-20 Thread Thomas Huth
This is the config file for the little endian target, so there
should not be a "eb" in here.

Signed-off-by: Thomas Huth 
---
 configs/devices/sh4-softmmu/default.mak | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/devices/sh4-softmmu/default.mak 
b/configs/devices/sh4-softmmu/default.mak
index aa821e4b60..efb401bfb1 100644
--- a/configs/devices/sh4-softmmu/default.mak
+++ b/configs/devices/sh4-softmmu/default.mak
@@ -1,4 +1,4 @@
-# Default configuration for sh4eb-softmmu
+# Default configuration for sh4-softmmu
 
 # Uncomment the following lines to disable these optional devices:
 #
-- 
2.46.0




[PATCH] tests/functional: Convert the powernv tests from boot_linux_console.py

2024-09-20 Thread Thomas Huth
Move the tests into the already existing test_ppc64_powernv.py
file.

Signed-off-by: Thomas Huth 
---
 Based-on: 20240919185749.71222-1-th...@redhat.com

 tests/avocado/boot_linux_console.py| 46 --
 tests/functional/test_ppc64_powernv.py | 42 +--
 2 files changed, 39 insertions(+), 49 deletions(-)

diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index 759fda9cc8..23d1b3587b 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -907,49 +907,3 @@ def test_arm_ast2600_debian(self):
 self.wait_for_console_pattern("SMP: Total of 2 processors activated")
 self.wait_for_console_pattern("No filesystem could mount root")
 
-def do_test_ppc64_powernv(self, proc):
-self.require_accelerator("tcg")
-images_url = 
('https://github.com/open-power/op-build/releases/download/v2.7/')
-
-kernel_url = images_url + 'zImage.epapr'
-kernel_hash = 
'0ab237df661727e5392cee97460e8674057a883c5f74381a128fa772588d45cd'
-kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash,
-   algorithm='sha256')
-self.vm.set_console()
-self.vm.add_args('-kernel', kernel_path,
- '-append', 'console=tty0 console=hvc0',
- '-device', 
'pcie-pci-bridge,id=bridge1,bus=pcie.1,addr=0x0',
- '-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234',
- '-device', 'e1000e,bus=bridge1,addr=0x3',
- '-device', 'nec-usb-xhci,bus=bridge1,addr=0x2')
-self.vm.launch()
-
-self.wait_for_console_pattern("CPU: " + proc + " generation processor")
-self.wait_for_console_pattern("zImage starting: loaded")
-self.wait_for_console_pattern("Run /init as init process")
-# Device detection output driven by udev probing is sometimes cut off
-# from console output, suspect S14silence-console init script.
-
-def test_ppc_powernv8(self):
-"""
-:avocado: tags=arch:ppc64
-:avocado: tags=machine:powernv8
-:avocado: tags=accel:tcg
-"""
-self.do_test_ppc64_powernv('P8')
-
-def test_ppc_powernv9(self):
-"""
-:avocado: tags=arch:ppc64
-:avocado: tags=machine:powernv9
-:avocado: tags=accel:tcg
-"""
-self.do_test_ppc64_powernv('P9')
-
-def test_ppc_powernv10(self):
-"""
-:avocado: tags=arch:ppc64
-:avocado: tags=machine:powernv10
-:avocado: tags=accel:tcg
-"""
-self.do_test_ppc64_powernv('P10')
diff --git a/tests/functional/test_ppc64_powernv.py 
b/tests/functional/test_ppc64_powernv.py
index 67497d6404..685e2178ed 100755
--- a/tests/functional/test_ppc64_powernv.py
+++ b/tests/functional/test_ppc64_powernv.py
@@ -7,10 +7,10 @@
 # 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 QemuSystemTest, Asset
+from qemu_test import LinuxKernelTest, Asset
 from qemu_test import wait_for_console_pattern
 
-class powernvMachine(QemuSystemTest):
+class powernvMachine(LinuxKernelTest):
 
 timeout = 90
 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
@@ -78,5 +78,41 @@ def test_linux_big_boot(self):
 wait_for_console_pattern(self, console_pattern, self.panic_message)
 wait_for_console_pattern(self, self.good_message, self.panic_message)
 
+
+ASSET_EPAPR_KERNEL = Asset(
+('https://github.com/open-power/op-build/releases/download/v2.7/'
+ 'zImage.epapr'),
+'0ab237df661727e5392cee97460e8674057a883c5f74381a128fa772588d45cd')
+
+def do_test_ppc64_powernv(self, proc):
+self.require_accelerator("tcg")
+kernel_path = self.ASSET_EPAPR_KERNEL.fetch()
+self.vm.set_console()
+self.vm.add_args('-kernel', kernel_path,
+ '-append', 'console=tty0 console=hvc0',
+ '-device', 
'pcie-pci-bridge,id=bridge1,bus=pcie.1,addr=0x0',
+ '-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234',
+ '-device', 'e1000e,bus=bridge1,addr=0x3',
+ '-device', 'nec-usb-xhci,bus=bridge1,addr=0x2')
+self.vm.launch()
+
+self.wait_for_console_pattern("

Re: [PATCH] tests/qemu-iotests/testenv: Use the "r2d" machine for sh4/sh4eb

2024-09-20 Thread Thomas Huth

On 20/09/2024 10.06, Yoshinori Sato wrote:

On Wed, 18 Sep 2024 04:43:50 +0900,
Thomas Huth wrote:


Commit 0ea0538fae516f9b4 removed the default machine of the sh4
binaries, so a lot of iotests are failing now without such a default
machine. Teach the iotest harness to use the "r2d" machine instead
to fix this problem.

Signed-off-by: Thomas Huth 
---
  tests/qemu-iotests/testenv.py | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
index 0b32eec119..6326e46b7b 100644
--- a/tests/qemu-iotests/testenv.py
+++ b/tests/qemu-iotests/testenv.py
@@ -244,6 +244,8 @@ def __init__(self, source_dir: str, build_dir: str,
  ('riscv32', 'virt'),
  ('riscv64', 'virt'),
  ('rx', 'gdbsim-r5f562n8'),
+('sh4', 'r2d'),
+('sh4eb', 'r2d'),
  ('tricore', 'tricore_testboard')
  )
  for suffix, machine in machine_map:
--
2.46.0



r2d is works only sh4 little endian mode.


Oh, that's interesting - since there is no other machine left for sh4/sh4eb.


There was probably no other hardware that ran in big endian.


There used to be the "shix" machine, but it got removed, I assume that one 
worked in big endian mode, too?


Anyway, if the r2d machine only works in little endian mode, and there is 
apparently no other machine available anymore, I think we can disable the 
sh4eb target completely since it is of no use now? Or is there a reason to 
still keep it around?


 Thomas




[PATCH 7/7] tests/functional: Convert the r2d sh4 Avocado test

2024-09-19 Thread Thomas Huth
This is the last test that is using the do_test_advcal_2018()
function, so we can now remove that function from boot_linux_console.py,
too.

Signed-off-by: Thomas Huth 
---
 MAINTAINERS |  1 +
 tests/avocado/boot_linux_console.py | 25 ---
 tests/functional/meson.build|  4 
 tests/functional/test_sh4_r2d.py| 31 +
 4 files changed, 36 insertions(+), 25 deletions(-)
 create mode 100755 tests/functional/test_sh4_r2d.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 63eb306d6e..62f5255f40 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1679,6 +1679,7 @@ F: hw/pci-host/sh_pci.c
 F: hw/timer/sh_timer.c
 F: include/hw/sh4/sh_intc.h
 F: include/hw/timer/tmu012.h
+F: tests/functional/test_sh4_r2d.py
 
 SPARC Machines
 --
diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index f5dc9e9cfa..759fda9cc8 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -882,17 +882,6 @@ def test_arm_orangepi_uboot_netbsd9(self):
 # Wait for user-space
 wait_for_console_pattern(self, 'Starting root file system check')
 
-def do_test_advcal_2018(self, day, tar_hash, kernel_name, console=0):
-tar_url = ('https://qemu-advcal.gitlab.io'
-   '/qac-best-of-multiarch/download/day' + day + '.tar.xz')
-file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
-archive.extract(file_path, self.workdir)
-self.vm.set_console(console_index=console)
-self.vm.add_args('-kernel',
- self.workdir + '/day' + day + '/' + kernel_name)
-self.vm.launch()
-self.wait_for_console_pattern('QEMU advent calendar')
-
 def test_arm_ast2600_debian(self):
 """
 :avocado: tags=arch:arm
@@ -964,17 +953,3 @@ def test_ppc_powernv10(self):
 :avocado: tags=accel:tcg
 """
 self.do_test_ppc64_powernv('P10')
-
-# This test has a 6-10% failure rate on various hosts that look
-# like issues with a buggy kernel. As a result we don't want it
-# gating releases on Gitlab.
-@skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on 
GitLab')
-def test_sh4_r2d(self):
-"""
-:avocado: tags=arch:sh4
-:avocado: tags=machine:r2d
-:avocado: tags=flaky
-"""
-tar_hash = 'fe06a4fd8ccbf2e27928d64472939d47829d4c7e'
-self.vm.add_args('-append', 'console=ttySC1')
-self.do_test_advcal_2018('09', tar_hash, 'zImage', console=1)
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 449c6a95ea..56a541530f 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -127,6 +127,10 @@ tests_s390x_system_thorough = [
   's390x_topology',
 ]
 
+tests_sh4_system_thorough = [
+  'sh4_r2d',
+]
+
 tests_sparc_system_thorough = [
   'sparc_sun4m',
 ]
diff --git a/tests/functional/test_sh4_r2d.py b/tests/functional/test_sh4_r2d.py
new file mode 100755
index 00..5fe8cf9f8d
--- /dev/null
+++ b/tests/functional/test_sh4_r2d.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+#
+# Boot a Linux kernel on a r2d sh4 machine and check the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+
+from qemu_test import LinuxKernelTest, Asset
+from qemu_test.utils import archive_extract
+from unittest import skipUnless
+
+class R2dTest(LinuxKernelTest):
+
+ASSET_DAY09 = Asset(
+'https://www.qemu-advent-calendar.org/2018/download/day09.tar.xz',
+'a61b44d2630a739d1380cc4ff4b80981d47ccfd5992f1484ccf48322c35f09ac')
+
+# This test has a 6-10% failure rate on various hosts that look
+# like issues with a buggy kernel.
+@skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable')
+def test_r2d(self):
+self.set_machine('r2d')
+file_path = self.ASSET_DAY09.fetch()
+archive_extract(file_path, self.workdir)
+self.vm.add_args('-append', 'console=ttySC1')
+self.launch_kernel(self.workdir + '/day09/zImage', console_index=1,
+   wait_for='QEMU advent calendar')
+
+if __name__ == '__main__':
+LinuxKernelTest.main()
-- 
2.46.0




[PATCH 6/7] tests/functional: Convert the mac ppc Avocado tests

2024-09-19 Thread Thomas Huth
The g3beige and mac99 tests use the same asset, so put them together
in a new test_ppc_mac.py file.

Signed-off-by: Thomas Huth 
---
 MAINTAINERS |  2 ++
 tests/avocado/boot_linux_console.py | 30 ---
 tests/functional/meson.build|  1 +
 tests/functional/test_ppc_mac.py| 38 +
 4 files changed, 41 insertions(+), 30 deletions(-)
 create mode 100755 tests/functional/test_ppc_mac.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 3dd80a0138..63eb306d6e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1474,6 +1474,7 @@ F: include/hw/ppc/mac_dbdma.h
 F: include/hw/pci-host/uninorth.h
 F: include/hw/input/adb*
 F: pc-bios/qemu_vga.ndrv
+F: tests/functional/test_ppc_mac.py
 
 Old World (g3beige)
 M: Mark Cave-Ayland 
@@ -1489,6 +1490,7 @@ F: include/hw/intc/heathrow_pic.h
 F: include/hw/input/adb*
 F: include/hw/pci-host/grackle.h
 F: pc-bios/qemu_vga.ndrv
+F: tests/functional/test_ppc_mac.py
 
 PReP
 M: Hervé Poussineau 
diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index 344c7835a2..f5dc9e9cfa 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -965,36 +965,6 @@ def test_ppc_powernv10(self):
 """
 self.do_test_ppc64_powernv('P10')
 
-def test_ppc_g3beige(self):
-"""
-:avocado: tags=arch:ppc
-:avocado: tags=machine:g3beige
-:avocado: tags=accel:tcg
-"""
-# TODO: g3beige works with kvm_pr but we don't have a
-# reliable way ATM (e.g. looking at /proc/modules) to detect
-# whether we're running kvm_hv or kvm_pr. For now let's
-# disable this test if we don't have TCG support.
-self.require_accelerator("tcg")
-tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
-self.vm.add_args('-M', 'graphics=off')
-self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
-
-def test_ppc_mac99(self):
-"""
-:avocado: tags=arch:ppc
-:avocado: tags=machine:mac99
-:avocado: tags=accel:tcg
-"""
-# TODO: mac99 works with kvm_pr but we don't have a
-# reliable way ATM (e.g. looking at /proc/modules) to detect
-# whether we're running kvm_hv or kvm_pr. For now let's
-# disable this test if we don't have TCG support.
-self.require_accelerator("tcg")
-tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc'
-self.vm.add_args('-M', 'graphics=off')
-self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
-
 # This test has a 6-10% failure rate on various hosts that look
 # like issues with a buggy kernel. As a result we don't want it
 # gating releases on Gitlab.
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index bc2313..449c6a95ea 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -106,6 +106,7 @@ tests_ppc_system_thorough = [
   'ppc_40p',
   'ppc_amiga',
   'ppc_bamboo',
+  'ppc_mac',
   'ppc_mpc8544ds',
   'ppc_virtex_ml507',
 ]
diff --git a/tests/functional/test_ppc_mac.py b/tests/functional/test_ppc_mac.py
new file mode 100755
index 00..a6b1ca2d4c
--- /dev/null
+++ b/tests/functional/test_ppc_mac.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python3
+#
+# Boot Linux kernel on a mac99 and g3beige ppc machine and check the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import LinuxKernelTest, Asset
+from qemu_test.utils import archive_extract
+
+class MacTest(LinuxKernelTest):
+
+ASSET_DAY15 = Asset(
+'https://www.qemu-advent-calendar.org/2018/download/day15.tar.xz',
+'03e0757c131d2959decf293a3572d3b96c5a53587165bf05ce41b2818a2bccd5')
+
+def do_day15_test(self):
+# mac99 also works with kvm_pr but we don't have a reliable way at
+# the moment (e.g. by looking at /proc/modules) to detect whether
+# we're running kvm_hv or kvm_pr. For now let's disable this test
+# if we don't have TCG support.
+self.require_accelerator("tcg")
+
+file_path = self.ASSET_DAY15.fetch()
+archive_extract(file_path, self.workdir)
+self.vm.add_args('-M', 'graphics=off')
+self.launch_kernel(self.workdir + '/day15/invaders.elf',
+   wait_for='QEMU advent calendar')
+
+def test_ppc_g3beige(self):
+self.set_machine('g3beige')
+self.do_day15_test()
+
+def test_ppc_mac99(self):
+self.set_machine('mac99')
+self.do_day15_test()
+
+if __name__ == '__main__':
+LinuxKernelTest.main()
-- 
2.46.0




[PATCH 3/7] tests/functional: Convert the xtensa lx60 Avocado test

2024-09-19 Thread Thomas Huth
Use the new launch_kernel function to convert this test in a simple way.

Signed-off-by: Thomas Huth 
---
 MAINTAINERS  |  1 +
 tests/avocado/boot_linux_console.py  |  9 -
 tests/functional/meson.build |  4 
 tests/functional/test_xtensa_lx60.py | 26 ++
 4 files changed, 31 insertions(+), 9 deletions(-)
 create mode 100755 tests/functional/test_xtensa_lx60.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 7f7f4c2be6..a75d6ba7d2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1915,6 +1915,7 @@ S: Maintained
 F: hw/xtensa/xtfpga.c
 F: hw/net/opencores_eth.c
 F: include/hw/xtensa/mx_pic.h
+F: tests/functional/test_xtensa_lx60.py
 
 Devices
 ---
diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index 7a776c2818..cf58499c84 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -1027,12 +1027,3 @@ def test_sparc_ss20(self):
 """
 tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f'
 self.do_test_advcal_2018('11', tar_hash, 'zImage.elf')
-
-def test_xtensa_lx60(self):
-"""
-:avocado: tags=arch:xtensa
-:avocado: tags=machine:lx60
-:avocado: tags=cpu:dc233c
-"""
-tar_hash = '49e88d9933742f0164b60839886c9739cb7a0d34'
-self.do_test_advcal_2018('02', tar_hash, 'santas-sleigh-ride.elf')
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 3fc1bb192d..8fd852f4ab 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -145,6 +145,10 @@ tests_x86_64_system_thorough = [
   'virtio_gpu',
 ]
 
+tests_xtensa_system_thorough = [
+  'xtensa_lx60',
+]
+
 precache_all = []
 foreach speed : ['quick', 'thorough']
   foreach dir : target_dirs
diff --git a/tests/functional/test_xtensa_lx60.py 
b/tests/functional/test_xtensa_lx60.py
new file mode 100755
index 00..8ce5206a4f
--- /dev/null
+++ b/tests/functional/test_xtensa_lx60.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# Functional test that boots a Linux kernel on an xtensa lx650 machine
+# and checks the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import LinuxKernelTest, Asset
+from qemu_test.utils import archive_extract
+
+class XTensaLX60Test(LinuxKernelTest):
+
+ASSET_DAY02 = Asset(
+'https://www.qemu-advent-calendar.org/2018/download/day02.tar.xz',
+'68ff07f9b3fd3df36d015eb46299ba44748e94bfbb2d5295fddc1a8d4a9fd324')
+
+def test_xtensa_lx60(self):
+self.set_machine('lx60')
+self.cpu = 'dc233c'
+file_path = self.ASSET_DAY02.fetch()
+archive_extract(file_path, self.workdir)
+self.launch_kernel(self.workdir + '/day02/santas-sleigh-ride.elf',
+   wait_for='QEMU advent calendar')
+
+if __name__ == '__main__':
+LinuxKernelTest.main()
-- 
2.46.0




[PATCH 2/7] tests/functional: Convert the vexpressa9 Avocado test

2024-09-19 Thread Thomas Huth
Use the new launch_kernel function to convert this test in a simple way.

Signed-off-by: Thomas Huth 
---
 MAINTAINERS   |  1 +
 tests/avocado/boot_linux_console.py   |  9 -
 tests/functional/meson.build  |  1 +
 tests/functional/test_arm_vexpress.py | 26 ++
 4 files changed, 28 insertions(+), 9 deletions(-)
 create mode 100755 tests/functional/test_arm_vexpress.py

diff --git a/MAINTAINERS b/MAINTAINERS
index ffacd60f40..7f7f4c2be6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1005,6 +1005,7 @@ S: Maintained
 F: hw/arm/vexpress.c
 F: hw/display/sii9022.c
 F: docs/system/arm/vexpress.rst
+F: tests/functional/test_arm_vexpress.py
 
 Versatile PB
 M: Peter Maydell 
diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index 6c50284986..7a776c2818 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -893,15 +893,6 @@ def do_test_advcal_2018(self, day, tar_hash, kernel_name, 
console=0):
 self.vm.launch()
 self.wait_for_console_pattern('QEMU advent calendar')
 
-def test_arm_vexpressa9(self):
-"""
-:avocado: tags=arch:arm
-:avocado: tags=machine:vexpress-a9
-"""
-tar_hash = '32b7677ce8b6f1471fb0059865f451169934245b'
-self.vm.add_args('-dtb', self.workdir + '/day16/vexpress-v2p-ca9.dtb')
-self.do_test_advcal_2018('16', tar_hash, 'winter.zImage')
-
 def test_arm_ast2600_debian(self):
 """
 :avocado: tags=arch:arm
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 8d5520349d..3fc1bb192d 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -50,6 +50,7 @@ tests_arm_system_thorough = [
   'arm_canona1100',
   'arm_integratorcp',
   'arm_raspi2',
+  'arm_vexpress',
 ]
 
 tests_arm_linuxuser_thorough = [
diff --git a/tests/functional/test_arm_vexpress.py 
b/tests/functional/test_arm_vexpress.py
new file mode 100755
index 00..cc6015112b
--- /dev/null
+++ b/tests/functional/test_arm_vexpress.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#
+# Functional test that boots a Linux kernel on an versatile express machine
+# and checks the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import LinuxKernelTest, Asset
+from qemu_test.utils import archive_extract
+
+class VExpressTest(LinuxKernelTest):
+
+ASSET_DAY16 = Asset(
+'https://www.qemu-advent-calendar.org/2018/download/day16.tar.xz',
+'63311adb2d4c4e7a73214a86d29988add87266a909719c56acfadd026b4110a7')
+
+def test_arm_vexpressa9(self):
+self.set_machine('vexpress-a9')
+file_path = self.ASSET_DAY16.fetch()
+archive_extract(file_path, self.workdir)
+self.launch_kernel(self.workdir + '/day16/winter.zImage',
+   dtb=self.workdir + '/day16/vexpress-v2p-ca9.dtb',
+   wait_for='QEMU advent calendar')
+
+if __name__ == '__main__':
+LinuxKernelTest.main()
-- 
2.46.0




[PATCH 0/7] tests/functional: Convert the advent calendar tests

2024-09-19 Thread Thomas Huth
Convert the advent calendar avocado tests to the new functional
framework. Since most tests are doing pretty much the same
(add a "-kernel" parameter and maybe "-initrd" and "-dtb", then
launch QEMU and wait for a string on the serial console), we
first introduce a helper function to shorten this repetive task.

Thomas Huth (7):
  tests/functional/qemu_test: Add a function for launching kernels more
easily
  tests/functional: Convert the vexpressa9 Avocado test
  tests/functional: Convert the xtensa lx60 Avocado test
  tests/functional: Convert the SPARCStation Avocado test
  tests/functional: Convert the e500 ppc64 Avocado test
  tests/functional: Convert the mac ppc Avocado tests
  tests/functional: Convert the r2d sh4 Avocado test

 MAINTAINERS   |  7 ++
 tests/avocado/boot_linux_console.py   | 92 ---
 tests/functional/meson.build  | 15 
 tests/functional/qemu_test/linuxkernel.py | 12 +++
 tests/functional/test_arm_vexpress.py | 26 +++
 tests/functional/test_ppc64_e500.py   | 25 ++
 tests/functional/test_ppc_mac.py  | 38 ++
 tests/functional/test_sh4_r2d.py  | 31 
 tests/functional/test_sparc_sun4m.py  | 25 ++
 tests/functional/test_xtensa_lx60.py  | 26 +++
 10 files changed, 205 insertions(+), 92 deletions(-)
 create mode 100755 tests/functional/test_arm_vexpress.py
 create mode 100755 tests/functional/test_ppc64_e500.py
 create mode 100755 tests/functional/test_ppc_mac.py
 create mode 100755 tests/functional/test_sh4_r2d.py
 create mode 100755 tests/functional/test_sparc_sun4m.py
 create mode 100755 tests/functional/test_xtensa_lx60.py

-- 
2.46.0




[PATCH 5/7] tests/functional: Convert the e500 ppc64 Avocado test

2024-09-19 Thread Thomas Huth
Use the new launch_kernel function to convert this test in a simple way.

Signed-off-by: Thomas Huth 
---
 MAINTAINERS |  1 +
 tests/avocado/boot_linux_console.py | 11 ---
 tests/functional/meson.build|  1 +
 tests/functional/test_ppc64_e500.py | 25 +
 4 files changed, 27 insertions(+), 11 deletions(-)
 create mode 100755 tests/functional/test_ppc64_e500.py

diff --git a/MAINTAINERS b/MAINTAINERS
index b85a3fc529..3dd80a0138 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1445,6 +1445,7 @@ F: pc-bios/u-boot.e500
 F: hw/intc/openpic_kvm.c
 F: include/hw/ppc/openpic_kvm.h
 F: docs/system/ppc/ppce500.rst
+F: tests/functional/test_ppc64_e500.py
 
 mpc8544ds
 L: qemu-...@nongnu.org
diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index 900af67412..344c7835a2 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -918,17 +918,6 @@ def test_arm_ast2600_debian(self):
 self.wait_for_console_pattern("SMP: Total of 2 processors activated")
 self.wait_for_console_pattern("No filesystem could mount root")
 
-def test_ppc64_e500(self):
-"""
-:avocado: tags=arch:ppc64
-:avocado: tags=machine:ppce500
-:avocado: tags=cpu:e5500
-:avocado: tags=accel:tcg
-"""
-self.require_accelerator("tcg")
-tar_hash = '6951d86d644b302898da2fd701739c9406527fe1'
-self.do_test_advcal_2018('19', tar_hash, 'uImage')
-
 def do_test_ppc64_powernv(self, proc):
 self.require_accelerator("tcg")
 images_url = 
('https://github.com/open-power/op-build/releases/download/v2.7/')
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 8aacd15cf3..bc2313 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -111,6 +111,7 @@ tests_ppc_system_thorough = [
 ]
 
 tests_ppc64_system_thorough = [
+  'ppc64_e500',
   'ppc64_hv',
   'ppc64_powernv',
   'ppc64_pseries',
diff --git a/tests/functional/test_ppc64_e500.py 
b/tests/functional/test_ppc64_e500.py
new file mode 100755
index 00..3558ae0c8c
--- /dev/null
+++ b/tests/functional/test_ppc64_e500.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+#
+# Boot a Linux kernel on a e500 ppc64 machine and check the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import LinuxKernelTest, Asset
+from qemu_test.utils import archive_extract
+
+class E500Test(LinuxKernelTest):
+
+ASSET_DAY19 = Asset(
+'https://www.qemu-advent-calendar.org/2018/download/day19.tar.xz',
+'20b1bb5a8488c664defbb5d283addc91a05335a936c63b3f5ff7eee74b725755')
+
+def test_ppc64_e500(self):
+self.set_machine('ppce500')
+self.cpu = 'e5500'
+file_path = self.ASSET_DAY19.fetch()
+archive_extract(file_path, self.workdir)
+self.launch_kernel(self.workdir + '/day19/uImage',
+   wait_for='QEMU advent calendar')
+
+if __name__ == '__main__':
+LinuxKernelTest.main()
-- 
2.46.0




[PATCH 4/7] tests/functional: Convert the SPARCStation Avocado test

2024-09-19 Thread Thomas Huth
Use the new launch_kernel function to convert this test in a simple way.

Signed-off-by: Thomas Huth 
---
 MAINTAINERS  |  1 +
 tests/avocado/boot_linux_console.py  |  8 
 tests/functional/meson.build |  4 
 tests/functional/test_sparc_sun4m.py | 25 +
 4 files changed, 30 insertions(+), 8 deletions(-)
 create mode 100755 tests/functional/test_sparc_sun4m.py

diff --git a/MAINTAINERS b/MAINTAINERS
index a75d6ba7d2..b85a3fc529 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1693,6 +1693,7 @@ F: include/hw/nvram/sun_nvram.h
 F: include/hw/sparc/sparc32_dma.h
 F: include/hw/sparc/sun4m_iommu.h
 F: pc-bios/openbios-sparc32
+F: tests/functional/test_sparc_sun4m.py
 
 Sun4u
 M: Mark Cave-Ayland 
diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index cf58499c84..900af67412 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -1019,11 +1019,3 @@ def test_sh4_r2d(self):
 tar_hash = 'fe06a4fd8ccbf2e27928d64472939d47829d4c7e'
 self.vm.add_args('-append', 'console=ttySC1')
 self.do_test_advcal_2018('09', tar_hash, 'zImage', console=1)
-
-def test_sparc_ss20(self):
-"""
-:avocado: tags=arch:sparc
-:avocado: tags=machine:SS-20
-"""
-tar_hash = 'b18550d5d61c7615d989a06edace051017726a9f'
-self.do_test_advcal_2018('11', tar_hash, 'zImage.elf')
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 8fd852f4ab..8aacd15cf3 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -125,6 +125,10 @@ tests_s390x_system_thorough = [
   's390x_topology',
 ]
 
+tests_sparc_system_thorough = [
+  'sparc_sun4m',
+]
+
 tests_sparc64_system_thorough = [
   'sparc64_sun4u',
 ]
diff --git a/tests/functional/test_sparc_sun4m.py 
b/tests/functional/test_sparc_sun4m.py
new file mode 100755
index 00..b334375820
--- /dev/null
+++ b/tests/functional/test_sparc_sun4m.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+#
+# Functional test that boots a Linux kernel on a sparc sun4m machine
+# and checks the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import LinuxKernelTest, Asset
+from qemu_test.utils import archive_extract
+
+class Sun4mTest(LinuxKernelTest):
+
+ASSET_DAY11 = Asset(
+'https://www.qemu-advent-calendar.org/2018/download/day11.tar.xz',
+'c776533ba756bf4dd3f1fc4c024fb50ef0d853e05c5f5ddf0900a32d1eaa49e0')
+
+def test_sparc_ss20(self):
+self.set_machine('SS-20')
+file_path = self.ASSET_DAY11.fetch()
+archive_extract(file_path, self.workdir)
+self.launch_kernel(self.workdir + '/day11/zImage.elf',
+   wait_for='QEMU advent calendar')
+
+if __name__ == '__main__':
+LinuxKernelTest.main()
-- 
2.46.0




[PATCH 1/7] tests/functional/qemu_test: Add a function for launching kernels more easily

2024-09-19 Thread Thomas Huth
The task for launching a kernel is quite repetitive: Set the serial
console, set the -kernel and maybe -initrd and -dtb parameters,
launch the VM and then wait for the expected console output. So
it's easier in some tests to provide these steps via a separate
function.

Signed-off-by: Thomas Huth 
---
 tests/functional/qemu_test/linuxkernel.py | 12 
 1 file changed, 12 insertions(+)

diff --git a/tests/functional/qemu_test/linuxkernel.py 
b/tests/functional/qemu_test/linuxkernel.py
index fdd5307629..2b5b9a5fda 100644
--- a/tests/functional/qemu_test/linuxkernel.py
+++ b/tests/functional/qemu_test/linuxkernel.py
@@ -17,6 +17,18 @@ def wait_for_console_pattern(self, success_message, vm=None):
  failure_message='Kernel panic - not syncing',
  vm=vm)
 
+def launch_kernel(self, kernel, initrd=None, dtb=None, console_index=0,
+  wait_for=None):
+self.vm.set_console(console_index=console_index)
+self.vm.add_args('-kernel', kernel)
+if initrd:
+self.vm.add_args('-initrd', initrd)
+if dtb:
+self.vm.add_args('-dtb', dtb)
+self.vm.launch()
+if wait_for:
+self.wait_for_console_pattern(wait_for)
+
 def extract_from_deb(self, deb_path, path):
 """
 Extracts a file from a deb package into the test workdir
-- 
2.46.0




Re: [PATCH 2/2] .gitlab-ci.d: Make separate collapsible log sections for build and test

2024-09-19 Thread Thomas Huth

On 18/09/2024 14.54, Peter Maydell wrote:

GitLab lets a CI job create its own collapsible log sections by
emitting special escape codes, as documented here:

https://docs.gitlab.com/ee/ci/yaml/script.html#expand-and-collapse-job-log-sections

Use these to make "configure", "build" and "test" separate
collapsible stages.

As recommended by the GitLab docs, we use some shell which is
sourced in the CI job to define functions to emit the magic
lines that start and end sections, to hide the ugliness of
the printf lines from the log.

Signed-off-by: Peter Maydell 
---


Reviewed-by: Thomas Huth 




Re: [PATCH 1/2] .gitlab-ci.d: Split build and test in cross build job templates

2024-09-19 Thread Thomas Huth

On 18/09/2024 14.54, Peter Maydell wrote:

In the native_build_job_template we have separate steps in the script
for the build and the test steps.  This is helpful because then
gitlab will give separate timestamps in the log view for each, and
you can see how long it took to compile vs how long to test.  In the
templates in crossbuild-template.yml, however, we do both the build
and test in a single 'make' invocation, and so we don't get the
separate timing information.

Split the build and test, in the same way we do in the native build
template.

This will also give us a place to separate out how parallel we want
to do the build by default from how parallel we want to do the tests
by default, which might be helpful in future.

Signed-off-by: Peter Maydell 


Reviewed-by: Thomas Huth 




Re: [PATCH] tests/qtest: Add XIVE tests for the powernv10 machine

2024-09-18 Thread Thomas Huth

On 18/09/2024 19.08, Mike Kowal wrote:


On 9/18/2024 10:05 AM, Thomas Huth wrote:

...
That also does not look like proper content for a header file. Please put 
it into a .c file instead.


When these test were originally written, the authors had all of the tests 
and their functions in one .c file.  Some thought it was too large and 
confusing and I separated the different test functions into separate .h 
files (and including .c files is not typically done).   I suppose I could 
have the different functions as individual qtests, opposed  to one XIVE 
test...   And I couldn't find an example multiple qtest .c files compiled 
and linked together into one qtest.


There are a bunch of qtests that are linked with the object files from 
multiple .c files. Have a look at tests/qtest/meson.build, look for the 
"qtests = {" around line 320. I think you could do something similar for 
your tests here, too.


 Thomas




Re: [PATCH] tests/qtest: Add XIVE tests for the powernv10 machine

2024-09-18 Thread Thomas Huth

On 16/09/2024 20.23, Michael Kowal wrote:

From: Frederic Barrat 

These XIVE tests include:
- General interrupt IRQ tests that:
   - enable and trigger an interrupt
   - acknowledge the interrupt
   - end of interrupt processing
- Test the Pull Thread Context to Odd Thread Reporting Line
- Test the different cache flush inject and queue sync inject operations

Co-authored-by: Frederic Barrat 
Co-authored-by: Glenn Miles 
Co-authored-by: Michael Kowal 

Signed-off-by: Frederic Barrat 
Signed-off-by: Glenn Miles 
Signed-off-by: Michael Kowal 
---
  MAINTAINERS|   3 +-
  tests/qtest/pnv-xive2-common.h | 246 
  tests/qtest/pnv-xive2-flush-sync.h | 194 
  tests/qtest/pnv-xive2-test.c   | 351 +
  tests/qtest/meson.build|   1 +
  5 files changed, 794 insertions(+), 1 deletion(-)
  create mode 100644 tests/qtest/pnv-xive2-common.h
  create mode 100644 tests/qtest/pnv-xive2-flush-sync.h
  create mode 100644 tests/qtest/pnv-xive2-test.c

diff --git a/MAINTAINERS b/MAINTAINERS
index ffacd60f40..f410dc1714 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2660,6 +2660,7 @@ L: qemu-...@nongnu.org
  S: Odd Fixes
  F: hw/*/*xive*
  F: include/hw/*/*xive*
+F: tests/qtest/*xive*
  F: docs/*/*xive*
  
  Renesas peripherals

@@ -3326,7 +3327,7 @@ R: Paolo Bonzini 
  R: Bandan Das 
  R: Stefan Hajnoczi 
  R: Thomas Huth 
-R: Darren Kenny 
+R: Darren Kenny 


Please drop this hunk.


  R: Qiuhao Li 
  S: Maintained
  F: tests/qtest/fuzz/
diff --git a/tests/qtest/pnv-xive2-common.h b/tests/qtest/pnv-xive2-common.h
new file mode 100644
index 00..66647686ee
--- /dev/null
+++ b/tests/qtest/pnv-xive2-common.h
@@ -0,0 +1,246 @@


Please add at least a SPDX-License line with the license information.


+#ifndef TEST_PNV_XIVE2_COMMON_H
+#define TEST_PNV_XIVE2_COMMON_H
+
+/*
+ * sizing:
+ * 128 interrupts
+ *   => ESB BAR range: 16M
+ * 256 ENDs
+ *   => END BAR range: 16M
+ * 256 VPs
+ *   => NVPG,NVC BAR range: 32M
+ */
+#define MAX_IRQS128
+#define MAX_ENDS256
+#define MAX_VPS 256

...

+static void get_struct(QTestState *qts, uint64_t src, void *dest, size_t size)
+{
+uint8_t *destination = (uint8_t *)dest;
+size_t i;
+
+for (i = 0; i < size; i++) {
+*(destination + i) = qtest_readb(qts, src + i);
+}
+}
+
+static void copy_struct(QTestState *qts, void *src, uint64_t dest, size_t size)
+{
+uint8_t *source = (uint8_t *)src;
+size_t i;
+
+for (i = 0; i < size; i++) {
+qtest_writeb(qts, dest + i, *(source + i));
+}
+}
+
+static uint64_t get_queue_addr(uint32_t end_index)
+{
+return XIVE_QUEUE_MEM + end_index * XIVE_QUEUE_SIZE;
+}
+
+static uint8_t get_esb(QTestState *qts, uint32_t index, uint8_t page,
+   uint32_t offset)
+{
+uint64_t addr;
+
+addr = XIVE_ESB_ADDR + (index << (XIVE_PAGE_SHIFT + 1));
+if (page == 1) {
+addr += 1 << XIVE_PAGE_SHIFT;
+}
+return qtest_readb(qts, addr + offset);
+}
+
+static void set_esb(QTestState *qts, uint32_t index, uint8_t page,
+uint32_t offset, uint32_t val)
+{
+uint64_t addr;
+
+addr = XIVE_ESB_ADDR + (index << (XIVE_PAGE_SHIFT + 1));
+if (page == 1) {
+addr += 1 << XIVE_PAGE_SHIFT;
+}
+return qtest_writel(qts, addr + offset, cpu_to_be32(val));
+}
+
+static void get_nvp(QTestState *qts, uint32_t index, Xive2Nvp* nvp)
+{
+uint64_t addr = XIVE_NVP_MEM + index * sizeof(Xive2Nvp);
+get_struct(qts, addr, nvp, sizeof(Xive2Nvp));
+}
+
+static uint64_t get_cl_pair_addr(Xive2Nvp *nvp)
+{
+uint64_t upper = xive_get_field32(0x0fff, nvp->w6);
+uint64_t lower = xive_get_field32(0xff00, nvp->w7);
+return (upper << 32) | (lower << 8);
+}
+
+static void set_cl_pair(QTestState *qts, Xive2Nvp *nvp, uint8_t *cl_pair)
+{
+uint64_t addr = get_cl_pair_addr(nvp);
+copy_struct(qts, cl_pair, addr, XIVE_REPORT_SIZE);
+}
+
+static void get_cl_pair(QTestState *qts, Xive2Nvp *nvp, uint8_t *cl_pair)
+{
+uint64_t addr = get_cl_pair_addr(nvp);
+get_struct(qts, addr, cl_pair, XIVE_REPORT_SIZE);
+}
+
+static void set_nvp(QTestState *qts, uint32_t index, uint8_t first)
+{
+uint64_t nvp_addr;
+Xive2Nvp nvp;
+uint64_t report_addr;
+
+nvp_addr = XIVE_NVP_MEM + index * sizeof(Xive2Nvp);
+report_addr = (XIVE_REPORT_MEM + index * XIVE_REPORT_SIZE) >> 8;
+
+memset(&nvp, 0, sizeof(nvp));
+nvp.w0 = xive_set_field32(NVP2_W0_VALID, 0, 1);
+nvp.w0 = xive_set_field32(NVP2_W0_PGOFIRST, nvp.w0, first);
+nvp.w6 = xive_set_field32(NVP2_W6_REPORTING_LINE, nvp.w6,
+  (report_addr >> 24) & 0xfff);
+nvp.w7 = xive_set_field32(NVP2_W7_REPORTING_LINE, nvp.w7,
+  report_addr & 0xff);
+copy_struct(qts, &nvp, nvp_addr, 

[PATCH] tests/qemu-iotests/testenv: Use the "r2d" machine for sh4/sh4eb

2024-09-17 Thread Thomas Huth
Commit 0ea0538fae516f9b4 removed the default machine of the sh4
binaries, so a lot of iotests are failing now without such a default
machine. Teach the iotest harness to use the "r2d" machine instead
to fix this problem.

Signed-off-by: Thomas Huth 
---
 tests/qemu-iotests/testenv.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
index 0b32eec119..6326e46b7b 100644
--- a/tests/qemu-iotests/testenv.py
+++ b/tests/qemu-iotests/testenv.py
@@ -244,6 +244,8 @@ def __init__(self, source_dir: str, build_dir: str,
 ('riscv32', 'virt'),
 ('riscv64', 'virt'),
 ('rx', 'gdbsim-r5f562n8'),
+('sh4', 'r2d'),
+('sh4eb', 'r2d'),
 ('tricore', 'tricore_testboard')
 )
 for suffix, machine in machine_map:
-- 
2.46.0




[PATCH] tests/qemu-iotests/testenv: Use the "virt" machine for or1k

2024-09-17 Thread Thomas Huth
When compiling QEMU just with "--target-list=or1k-softmmu", there
are 8 iotests failing that try to use PCI devices - but the default
or1k machine does not have a PCI bus. The "virt" machine is better
suited for running the iotests than the or1k default machine since
it provides PCI and thus e.g. support for virtio-blk and virtio-scsi,
too. With this change, there are no failing iotests anymore when
using the qemu-system-or1k binary for running the tests.

Signed-off-by: Thomas Huth 
---
 tests/qemu-iotests/testenv.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
index c8848f2ec2..0b32eec119 100644
--- a/tests/qemu-iotests/testenv.py
+++ b/tests/qemu-iotests/testenv.py
@@ -240,6 +240,7 @@ def __init__(self, source_dir: str, build_dir: str,
 ('aarch64', 'virt'),
 ('avr', 'mega2560'),
 ('m68k', 'virt'),
+('or1k', 'virt'),
 ('riscv32', 'virt'),
 ('riscv64', 'virt'),
 ('rx', 'gdbsim-r5f562n8'),
-- 
2.46.0




[PATCH] tests/functional: Put the or1k_sim test into the slow category

2024-09-17 Thread Thomas Huth
Looks like a copy-n-paste mistake while adding the or1k_sim test
here: The test downloads an asset from the internet, so it should
be in the thorough category, not in the quick one.

Signed-off-by: Thomas Huth 
---
 tests/functional/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 289efa2831..d1bf71cbd3 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -95,7 +95,7 @@ tests_mips64el_system_thorough = [
   'mips64el_malta',
 ]
 
-tests_or1k_system_quick = [
+tests_or1k_system_thorough = [
   'or1k_sim',
 ]
 
-- 
2.46.0




[PULL 10/17] include/hw/s390x: replace assert(false) with g_assert_not_reached()

2024-09-17 Thread Thomas Huth
From: Pierrick Bouvier 

This patch is part of a series that moves towards a consistent use of
g_assert_not_reached() rather than an ad hoc mix of different
assertion mechanisms.

Reviewed-by: Richard Henderson 
Reviewed-by: Thomas Huth 
Signed-off-by: Pierrick Bouvier 
Reviewed-by: Eric Farman 
Message-ID: <20240912073921.453203-15-pierrick.bouv...@linaro.org>
Signed-off-by: Thomas Huth 
---
 include/hw/s390x/cpu-topology.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/s390x/cpu-topology.h b/include/hw/s390x/cpu-topology.h
index a11b1baa77..9283c948e3 100644
--- a/include/hw/s390x/cpu-topology.h
+++ b/include/hw/s390x/cpu-topology.h
@@ -57,7 +57,7 @@ static inline void s390_topology_setup_cpu(MachineState *ms,
 static inline void s390_topology_reset(void)
 {
 /* Unreachable, CPU topology not implemented for TCG */
-assert(false);
+g_assert_not_reached();
 }
 #endif
 
-- 
2.46.0




[PULL 15/17] docs/fuzz: fix outdated mention to enable-sanitizers

2024-09-17 Thread Thomas Huth
From: Matheus Tavares Bernardino 

This options has been removed at cb771ac1f5 (meson: Split
--enable-sanitizers to --enable-{asan, ubsan}, 2024-08-13), so let's
update its last standing mention in the docs.

Signed-off-by: Matheus Tavares Bernardino 
Reviewed-by: Brian Cain 
Message-ID: 
<0ecf4e1ab26771009d74a2ce61e7c17ddc586ef7.1726226316.git.quic_mathb...@quicinc.com>
Signed-off-by: Thomas Huth 
---
 docs/devel/testing/fuzzing.rst | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/docs/devel/testing/fuzzing.rst b/docs/devel/testing/fuzzing.rst
index dfe1973cf8..c3ac084311 100644
--- a/docs/devel/testing/fuzzing.rst
+++ b/docs/devel/testing/fuzzing.rst
@@ -21,8 +21,9 @@ Building the fuzzers
 
 To build the fuzzers, install a recent version of clang:
 Configure with (substitute the clang binaries with the version you installed).
-Here, enable-sanitizers, is optional but it allows us to reliably detect bugs
-such as out-of-bounds accesses, use-after-frees, double-frees etc.::
+Here, enable-asan and enable-ubsan are optional but they allow us to reliably
+detect bugs such as out-of-bounds accesses, uses-after-free, double-frees
+etc.::
 
 CC=clang-8 CXX=clang++-8 /path/to/configure \
 --enable-fuzzing --enable-asan --enable-ubsan
-- 
2.46.0




[PULL 16/17] tests/functional: Move the mips64el fuloong2e test into the thorough category

2024-09-17 Thread Thomas Huth
Commit d2fce37597c2 added a test that downloads an asset from the
internet, so this test should not be run by default anymore and be
put into the thorough category instead.

Message-ID: <20240913175140.3329083-1-th...@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Thomas Huth 
---
 tests/functional/meson.build | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 975e609073..8d5520349d 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -86,11 +86,8 @@ tests_mipsel_system_thorough = [
   'mipsel_malta',
 ]
 
-tests_mips64el_system_quick = [
-  'mips64el_fuloong2e',
-]
-
 tests_mips64el_system_thorough = [
+  'mips64el_fuloong2e',
   'mips64el_loongson3v',
   'mips64el_malta',
 ]
-- 
2.46.0




[PULL 14/17] system: Enable the device aliases for or1k, too

2024-09-17 Thread Thomas Huth
Now that we've got a "virt" machine for or1k that supports PCI
too (commit 40fef82c4e "hw/openrisc: Add PCI bus support to virt")
we can also enable the virtio device aliases like we do on other
similar platforms. This will e.g. help to run the iotests with
qemu-system-or1k later.

Reviewed-by: Philippe Mathieu-Daudé 
Message-ID: <20240705090808.1305765-1-th...@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240705124528.97471-3-phi...@linaro.org>
Signed-off-by: Thomas Huth 
---
 system/qdev-monitor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
index acdc8b73a3..44994ea0e1 100644
--- a/system/qdev-monitor.c
+++ b/system/qdev-monitor.c
@@ -61,6 +61,7 @@ typedef struct QDevAlias
   QEMU_ARCH_I386 | \
   QEMU_ARCH_LOONGARCH | \
   QEMU_ARCH_MIPS | \
+  QEMU_ARCH_OPENRISC | \
   QEMU_ARCH_PPC | \
   QEMU_ARCH_RISCV | \
   QEMU_ARCH_SH4 | \
-- 
2.46.0




[PULL 12/17] tests/qtest: remove break after g_assert_not_reached()

2024-09-17 Thread Thomas Huth
From: Pierrick Bouvier 

This patch is part of a series that moves towards a consistent use of
g_assert_not_reached() rather than an ad hoc mix of different
assertion mechanisms.

Reviewed-by: Richard Henderson 
Signed-off-by: Pierrick Bouvier 
Message-ID: <20240912073921.453203-36-pierrick.bouv...@linaro.org>
Signed-off-by: Thomas Huth 
---
 tests/qtest/migration-helpers.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
index a43d180c80..0025933883 100644
--- a/tests/qtest/migration-helpers.c
+++ b/tests/qtest/migration-helpers.c
@@ -76,7 +76,6 @@ static QDict *SocketAddress_to_qdict(SocketAddress *addr)
 break;
 default:
 g_assert_not_reached();
-break;
 }
 
 return dict;
-- 
2.46.0




[PULL 09/17] tests/unit: replace assert(0) with g_assert_not_reached()

2024-09-17 Thread Thomas Huth
From: Pierrick Bouvier 

This patch is part of a series that moves towards a consistent use of
g_assert_not_reached() rather than an ad hoc mix of different
assertion mechanisms.

Reviewed-by: Richard Henderson 
Signed-off-by: Pierrick Bouvier 
Message-ID: <20240912073921.453203-14-pierrick.bouv...@linaro.org>
Signed-off-by: Thomas Huth 
---
 tests/unit/test-xs-node.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/unit/test-xs-node.c b/tests/unit/test-xs-node.c
index ac94e7ed6c..2f447a73fb 100644
--- a/tests/unit/test-xs-node.c
+++ b/tests/unit/test-xs-node.c
@@ -212,7 +212,7 @@ static void compare_tx(gpointer key, gpointer val, gpointer 
opaque)
 printf("Comparison failure in TX %u after serdes:\n", tx_id);
 dump_ref("Original", t1->root, 0);
 dump_ref("Deserialised", t2->root, 0);
-g_assert(0);
+g_assert_not_reached();
 }
 g_assert(t1->nr_nodes == t2->nr_nodes);
 }
@@ -257,7 +257,7 @@ static void check_serdes(XenstoreImplState *s)
 printf("Comparison failure in main tree after serdes:\n");
 dump_ref("Original", s->root, 0);
 dump_ref("Deserialised", s2->root, 0);
-g_assert(0);
+g_assert_not_reached();
 }
 
 nr_transactions1 = g_hash_table_size(s->transactions);
-- 
2.46.0




[PULL 04/17] tests/qtest/meson.build: Add more CONFIG switches checks for the x86 tests

2024-09-17 Thread Thomas Huth
When configuring QEMU with "--without-default-devices", currently a lot
of the x86 qtests are failing since they silently assume that a certain
device or the i440fx pc machine is available. Add more checks for CONFIG
switches here to not run those tests in case the corresponding device is
not available.

Message-ID: <20240905191434.694440-6-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 tests/qtest/meson.build | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index fc852f3d8b..ce0dba18cb 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -50,7 +50,15 @@ qtests_filter = \
 qtests_i386 = \
   (slirp.found() ? ['pxe-test'] : []) + \
   qtests_filter + \
-  (have_tools ? ['ahci-test'] : []) +  
 \
+  (config_all_devices.has_key('CONFIG_ACPI_VMGENID') ? ['vmgenid-test'] : []) 
+ \
+  (config_all_devices.has_key('CONFIG_AHCI_ICH9') and have_tools ? 
['ahci-test'] : []) +\
+  (config_all_devices.has_key('CONFIG_AHCI_ICH9') ? ['tco-test'] : []) +   
 \
+  (config_all_devices.has_key('CONFIG_FDC_ISA') ? ['fdc-test'] : []) + 
 \
+  (config_all_devices.has_key('CONFIG_I440FX') ? ['fw_cfg-test'] : []) +   
 \
+  (config_all_devices.has_key('CONFIG_I440FX') ? ['i440fx-test'] : []) +   
 \
+  (config_all_devices.has_key('CONFIG_I440FX') ? ['ide-test'] : []) +  
 \
+  (config_all_devices.has_key('CONFIG_I440FX') ? ['numa-test'] : []) + 
 \
+  (config_all_devices.has_key('CONFIG_I440FX') ? ['test-x86-cpuid-compat'] : 
[]) +  \
   (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : 
[]) +   \
   (config_all_devices.has_key('CONFIG_SGA') ? ['boot-serial-test'] : []) + 
 \
   (config_all_devices.has_key('CONFIG_ISA_IPMI_KCS') ? ['ipmi-kcs-test'] : []) 
+\
@@ -64,6 +72,7 @@ qtests_i386 = \
   (config_all_devices.has_key('CONFIG_I82801B11') ? ['i82801b11-test'] : []) + 
\
   (config_all_devices.has_key('CONFIG_IOH3420') ? ['ioh3420-test'] : []) + 
 \
   (config_all_devices.has_key('CONFIG_LPC_ICH9') ? ['lpc-ich9-test'] : []) +   
   \
+  (config_all_devices.has_key('CONFIG_MC146818RTC') ? ['rtc-test'] : []) + 
 \
   (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) 
+\
   (config_all_devices.has_key('CONFIG_USB_UHCI') and   
 \
config_all_devices.has_key('CONFIG_USB_EHCI') ? ['usb-hcd-ehci-test'] : []) 
+\
@@ -77,6 +86,7 @@ qtests_i386 = \
   (config_all_devices.has_key('CONFIG_MEGASAS_SCSI_PCI') ? 
['fuzz-megasas-test'] : []) +\
   (config_all_devices.has_key('CONFIG_LSI_SCSI_PCI') ? 
['fuzz-lsi53c895a-test'] : []) + \
   (config_all_devices.has_key('CONFIG_VIRTIO_SCSI') ? 
['fuzz-virtio-scsi-test'] : []) + \
+  (config_all_devices.has_key('CONFIG_Q35') ? ['q35-test'] : []) + 
 \
   (config_all_devices.has_key('CONFIG_SB16') ? ['fuzz-sb16-test'] : []) +  
 \
   (config_all_devices.has_key('CONFIG_SDHCI_PCI') ? ['fuzz-sdcard-test'] : []) 
+\
   (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) +
 \
@@ -92,25 +102,16 @@ qtests_i386 = \
config_all_devices.has_key('CONFIG_PARALLEL') ? ['bios-tables-test'] : []) 
+ \
   qtests_pci + 
 \
   qtests_cxl + 
 \
-  ['fdc-test',
-   'ide-test',
+  [
'hd-geo-test',
'boot-order-test',
-   'rtc-test',
-   'i440fx-test',
-   'fw_cfg-test',
'device-plug-test',
'drive_del-test',
-   'tco-test',
'cpu-plug-test',
-   'q35-test',
-   'vmgenid-test',
'migration-test',
-   'test-x86-cpuid-compat',
-   'numa-test'
   ]
 
-if dbus_display
+if dbus_display and config_all_devices.has_key('CONFIG_VGA')
   qtests_i386 += ['dbus-display-test']
 endif
 
-- 
2.46.0




[PULL 08/17] tests/qtest: replace assert(0) with g_assert_not_reached()

2024-09-17 Thread Thomas Huth
From: Pierrick Bouvier 

This patch is part of a series that moves towards a consistent use of
g_assert_not_reached() rather than an ad hoc mix of different
assertion mechanisms.

Reviewed-by: Richard Henderson 
Reviewed-by: Thomas Huth 
Signed-off-by: Pierrick Bouvier 
Message-ID: <20240912073921.453203-13-pierrick.bouv...@linaro.org>
Signed-off-by: Thomas Huth 
---
 tests/qtest/ipmi-bt-test.c  | 2 +-
 tests/qtest/ipmi-kcs-test.c | 4 ++--
 tests/qtest/rtl8139-test.c  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c
index 383239bcd4..13f7c841f5 100644
--- a/tests/qtest/ipmi-bt-test.c
+++ b/tests/qtest/ipmi-bt-test.c
@@ -251,7 +251,7 @@ static void emu_msg_handler(void)
 msg[msg_len++] = 0xa0;
 write_emu_msg(msg, msg_len);
 } else {
-g_assert(0);
+g_assert_not_reached();
 }
 }
 
diff --git a/tests/qtest/ipmi-kcs-test.c b/tests/qtest/ipmi-kcs-test.c
index afc24dd3e4..3186c6ad64 100644
--- a/tests/qtest/ipmi-kcs-test.c
+++ b/tests/qtest/ipmi-kcs-test.c
@@ -145,7 +145,7 @@ static void kcs_cmd(uint8_t *cmd, unsigned int cmd_len,
 break;
 
 default:
-g_assert(0);
+g_assert_not_reached();
 }
 *rsp_len = j;
 }
@@ -184,7 +184,7 @@ static void kcs_abort(uint8_t *cmd, unsigned int cmd_len,
 break;
 
 default:
-g_assert(0);
+g_assert_not_reached();
 }
 
 /* Start the abort here */
diff --git a/tests/qtest/rtl8139-test.c b/tests/qtest/rtl8139-test.c
index eedf90f65a..55f671f2f5 100644
--- a/tests/qtest/rtl8139-test.c
+++ b/tests/qtest/rtl8139-test.c
@@ -65,7 +65,7 @@ PORT(IntrMask, w, 0x3c)
 PORT(IntrStatus, w, 0x3E)
 PORT(TimerInt, l, 0x54)
 
-#define fatal(...) do { g_test_message(__VA_ARGS__); g_assert(0); } while (0)
+#define fatal(...) do { g_test_message(__VA_ARGS__); g_assert_not_reached(); } 
while (0)
 
 static void test_timer(void)
 {
-- 
2.46.0




[PULL 07/17] gitlab: fix logic for changing docker tag on stable branches

2024-09-17 Thread Thomas Huth
From: Daniel P. Berrangé 

This fixes:

  commit e28112d00703abd136e2411d23931f4f891c9244
  Author: Daniel P. Berrangé 
  Date:   Thu Jun 8 17:40:16 2023 +0100

gitlab: stable staging branches publish containers in a separate tag

Due to a copy+paste mistake, that commit included "QEMU_JOB_SKIPPED"
in the final rule that was meant to be a 'catch all' for staging
branches.

As a result stable branches are still splattering dockers from the
primary development branch.

Signed-off-by: Daniel P. Berrangé 
Reviewed-by: Michael Tokarev 
Tested-by: Michael Tokarev 
Message-ID: <20240906140958.84755-1-berra...@redhat.com>
Signed-off-by: Thomas Huth 
---
 .gitlab-ci.d/base.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.d/base.yml b/.gitlab-ci.d/base.yml
index bf3d8efab6..25b88aaa06 100644
--- a/.gitlab-ci.d/base.yml
+++ b/.gitlab-ci.d/base.yml
@@ -128,7 +128,7 @@ variables:
   when: manual
 
 # Jobs can run if any jobs they depend on were successful
-- if: '$QEMU_JOB_SKIPPED && $CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && 
$CI_COMMIT_BRANCH =~ /staging-[[:digit:]]+\.[[:digit:]]/'
+- if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_COMMIT_BRANCH =~ 
/staging-[[:digit:]]+\.[[:digit:]]/'
   when: on_success
   variables:
 QEMU_CI_CONTAINER_TAG: $CI_COMMIT_REF_SLUG
-- 
2.46.0




[PULL 11/17] tests/qtest: replace assert(false) with g_assert_not_reached()

2024-09-17 Thread Thomas Huth
From: Pierrick Bouvier 

This patch is part of a series that moves towards a consistent use of
g_assert_not_reached() rather than an ad hoc mix of different
assertion mechanisms.

Reviewed-by: Richard Henderson 
Signed-off-by: Pierrick Bouvier 
Message-ID: <20240912073921.453203-24-pierrick.bouv...@linaro.org>
Signed-off-by: Thomas Huth 
---
 tests/qtest/numa-test.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c
index ede418963c..6d92baee86 100644
--- a/tests/qtest/numa-test.c
+++ b/tests/qtest/numa-test.c
@@ -162,7 +162,7 @@ static void pc_numa_cpu(const void *data)
 } else if (socket == 1 && core == 1 && thread == 1) {
 g_assert_cmpint(node, ==, 1);
 } else {
-g_assert(false);
+g_assert_not_reached();
 }
 qobject_unref(e);
 }
@@ -207,7 +207,7 @@ static void spapr_numa_cpu(const void *data)
 } else if (core == 3) {
 g_assert_cmpint(node, ==, 1);
 } else {
-g_assert(false);
+g_assert_not_reached();
 }
 qobject_unref(e);
 }
@@ -257,7 +257,7 @@ static void aarch64_numa_cpu(const void *data)
 } else if (socket == 1 && cluster == 0 && core == 0 && thread == 0) {
 g_assert_cmpint(node, ==, 0);
 } else {
-g_assert(false);
+g_assert_not_reached();
 }
 qobject_unref(e);
 }
@@ -305,7 +305,7 @@ static void loongarch64_numa_cpu(const void *data)
 } else if (socket == 1 && core == 0 && thread == 0) {
 g_assert_cmpint(node, ==, 0);
 } else {
-g_assert(false);
+g_assert_not_reached();
 }
 qobject_unref(e);
 }
@@ -367,7 +367,7 @@ static void pc_dynamic_cpu_cfg(const void *data)
 } else if (socket == 1) {
 g_assert_cmpint(node, ==, 0);
 } else {
-g_assert(false);
+g_assert_not_reached();
 }
 qobject_unref(e);
 }
-- 
2.46.0




[PULL 05/17] tests/qtest: Disable numa-test if the default machine is not available

2024-09-17 Thread Thomas Huth
The numa-test needs a default machine in the target binary to work
successfully, so don't try to run this test if the corresponding
machine has not been enabled, e.g. when QEMU has been configured with
"--without-default-devices".

Message-ID: <20240905191434.694440-7-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 tests/qtest/meson.build | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index ce0dba18cb..310865e49c 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -142,7 +142,8 @@ qtests_hppa = ['boot-serial-test'] + \
   (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : [])
 
 qtests_loongarch64 = qtests_filter + \
-  ['boot-serial-test', 'numa-test']
+  (config_all_devices.has_key('CONFIG_LOONGARCH_VIRT') ? ['numa-test'] : []) + 
\
+  ['boot-serial-test']
 
 qtests_m68k = ['boot-serial-test'] + \
   qtests_filter
@@ -175,11 +176,12 @@ qtests_ppc64 = \
   (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-xscom-test'] : []) +   
  \
   (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-spi-seeprom-test'] : 
[]) +   \
   (config_all_devices.has_key('CONFIG_POWERNV') ? ['pnv-host-i2c-test'] : []) 
+  \
+  (config_all_devices.has_key('CONFIG_PSERIES') ? ['numa-test'] : []) +
  \
   (config_all_devices.has_key('CONFIG_PSERIES') ? ['rtas-test'] : []) +
  \
   (slirp.found() ? ['pxe-test'] : []) +  \
   (config_all_devices.has_key('CONFIG_USB_UHCI') ? ['usb-hcd-uhci-test'] : []) 
+ \
   (config_all_devices.has_key('CONFIG_USB_XHCI_NEC') ? ['usb-hcd-xhci-test'] : 
[]) + \
-  qtests_pci + ['migration-test', 'numa-test', 'cpu-plug-test', 
'drive_del-test']
+  qtests_pci + ['migration-test', 'cpu-plug-test', 'drive_del-test']
 
 qtests_sh4 = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? 
['endianness-test'] : [])
 qtests_sh4eb = (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? 
['endianness-test'] : [])
-- 
2.46.0




[PULL 17/17] .gitlab-ci.d/crossbuilds.yml: Force 'make check' to -j2 for cross-i686-tci

2024-09-17 Thread Thomas Huth
From: Peter Maydell 

In commit 1374ed49e1453c300 we forced the cross-i686-tci job to -j1 to
see if this helped with test timeouts. It seems to help with that but
on the other hand we now sometimes run into the overall 60 minute
job timeout. Try -j2 instead.

Signed-off-by: Peter Maydell 
Reviewed-by: Thomas Huth 
Message-ID: <20240916134913.2540486-1-peter.mayd...@linaro.org>
Signed-off-by: Thomas Huth 
---
 .gitlab-ci.d/crossbuilds.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index 1e21d082aa..95dfc39224 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -62,11 +62,11 @@ cross-i686-tci:
 IMAGE: debian-i686-cross
 ACCEL: tcg-interpreter
 EXTRA_CONFIGURE_OPTS: 
--target-list=i386-softmmu,i386-linux-user,aarch64-softmmu,aarch64-linux-user,ppc-softmmu,ppc-linux-user
 --disable-plugins --disable-kvm
-# Force tests to run in series, to see whether this
+# Force tests to run with reduced parallelism, to see whether this
 # reduces the flakiness of this CI job. The CI
 # environment by default shows us 8 CPUs and so we
 # would otherwise be using a parallelism of 9.
-MAKE_CHECK_ARGS: check check-tcg -j1
+MAKE_CHECK_ARGS: check check-tcg -j2
 
 cross-mipsel-system:
   extends: .cross_system_build_job
-- 
2.46.0




[PULL 13/17] system: Sort QEMU_ARCH_VIRTIO_PCI definition

2024-09-17 Thread Thomas Huth
From: Philippe Mathieu-Daudé 

Sort the QEMU_ARCH_VIRTIO_PCI to simplify adding/removing entries.

Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240705124528.97471-2-phi...@linaro.org>
Reviewed-by: Pierrick Bouvier 
Signed-off-by: Thomas Huth 
---
 system/qdev-monitor.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
index 6af6ef7d66..acdc8b73a3 100644
--- a/system/qdev-monitor.c
+++ b/system/qdev-monitor.c
@@ -55,12 +55,17 @@ typedef struct QDevAlias
 } QDevAlias;
 
 /* default virtio transport per architecture */
-#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
-  QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \
-  QEMU_ARCH_MIPS | QEMU_ARCH_PPC |  \
-  QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \
-  QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA | \
-  QEMU_ARCH_LOONGARCH)
+#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | \
+  QEMU_ARCH_ARM | \
+  QEMU_ARCH_HPPA | \
+  QEMU_ARCH_I386 | \
+  QEMU_ARCH_LOONGARCH | \
+  QEMU_ARCH_MIPS | \
+  QEMU_ARCH_PPC | \
+  QEMU_ARCH_RISCV | \
+  QEMU_ARCH_SH4 | \
+  QEMU_ARCH_SPARC | \
+  QEMU_ARCH_XTENSA)
 #define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X)
 #define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K)
 
-- 
2.46.0




[PULL 03/17] tests/qtest/hd-geo-test: Check for availability of "pc" machine before using it

2024-09-17 Thread Thomas Huth
In case QEMU has been configured with "--without-default-devices", the
"pc" machine type might be missing in the binary. We should check for
its availability before using it.

Message-ID: <20240905191434.694440-5-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 tests/qtest/hd-geo-test.c | 71 +--
 1 file changed, 38 insertions(+), 33 deletions(-)

diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c
index d08bffad91..85eb8d7668 100644
--- a/tests/qtest/hd-geo-test.c
+++ b/tests/qtest/hd-geo-test.c
@@ -1074,17 +1074,26 @@ int main(int argc, char **argv)
 }
 }
 
-qtest_add_func("hd-geo/ide/none", test_ide_none);
-qtest_add_func("hd-geo/ide/drive/mbr/blank", test_ide_drive_mbr_blank);
-qtest_add_func("hd-geo/ide/drive/mbr/lba", test_ide_drive_mbr_lba);
-qtest_add_func("hd-geo/ide/drive/mbr/chs", test_ide_drive_mbr_chs);
-qtest_add_func("hd-geo/ide/drive/cd_0", test_ide_drive_cd_0);
-qtest_add_func("hd-geo/ide/device/mbr/blank", test_ide_device_mbr_blank);
-qtest_add_func("hd-geo/ide/device/mbr/lba", test_ide_device_mbr_lba);
-qtest_add_func("hd-geo/ide/device/mbr/chs", test_ide_device_mbr_chs);
-qtest_add_func("hd-geo/ide/device/user/chs", test_ide_device_user_chs);
-qtest_add_func("hd-geo/ide/device/user/chst", test_ide_device_user_chst);
-if (have_qemu_img()) {
+if (qtest_has_machine("pc")) {
+qtest_add_func("hd-geo/ide/none", test_ide_none);
+qtest_add_func("hd-geo/ide/drive/mbr/blank", test_ide_drive_mbr_blank);
+qtest_add_func("hd-geo/ide/drive/mbr/lba", test_ide_drive_mbr_lba);
+qtest_add_func("hd-geo/ide/drive/mbr/chs", test_ide_drive_mbr_chs);
+qtest_add_func("hd-geo/ide/drive/cd_0", test_ide_drive_cd_0);
+qtest_add_func("hd-geo/ide/device/mbr/blank", 
test_ide_device_mbr_blank);
+qtest_add_func("hd-geo/ide/device/mbr/lba", test_ide_device_mbr_lba);
+qtest_add_func("hd-geo/ide/device/mbr/chs", test_ide_device_mbr_chs);
+qtest_add_func("hd-geo/ide/device/user/chs", test_ide_device_user_chs);
+qtest_add_func("hd-geo/ide/device/user/chst", 
test_ide_device_user_chst);
+}
+
+if (!have_qemu_img()) {
+g_test_message("QTEST_QEMU_IMG not set or qemu-img missing; "
+   "skipping hd-geo/override/* tests");
+goto test_add_done;
+}
+
+if (qtest_has_machine("pc")) {
 qtest_add_func("hd-geo/override/ide", test_override_ide);
 if (qtest_has_device("lsi53c895a")) {
 qtest_add_func("hd-geo/override/scsi", test_override_scsi);
@@ -1104,30 +1113,26 @@ int main(int argc, char **argv)
 qtest_add_func("hd-geo/override/virtio_blk",
test_override_virtio_blk);
 }
+}
 
-if (qtest_has_machine("q35")) {
-qtest_add_func("hd-geo/override/sata", test_override_sata);
-qtest_add_func("hd-geo/override/zero_chs_q35",
-   test_override_zero_chs_q35);
-if (qtest_has_device("lsi53c895a")) {
-qtest_add_func("hd-geo/override/scsi_q35",
-   test_override_scsi_q35);
-}
-if (qtest_has_device("virtio-scsi-pci")) {
-qtest_add_func("hd-geo/override/scsi_hot_unplug_q35",
-   test_override_scsi_hot_unplug_q35);
-}
-if (qtest_has_device("virtio-blk-pci")) {
-qtest_add_func("hd-geo/override/virtio_hot_unplug_q35",
-   test_override_virtio_hot_unplug_q35);
-qtest_add_func("hd-geo/override/virtio_blk_q35",
-   test_override_virtio_blk_q35);
-}
-
+if (qtest_has_machine("q35")) {
+qtest_add_func("hd-geo/override/sata", test_override_sata);
+qtest_add_func("hd-geo/override/zero_chs_q35",
+   test_override_zero_chs_q35);
+if (qtest_has_device("lsi53c895a")) {
+qtest_add_func("hd-geo/override/scsi_q35",
+   test_override_scsi_q35);
+}
+if (qtest_has_device("virtio-scsi-pci")) {
+qtest_add_func("hd-geo/override/scsi_hot_unplug_q35",
+   test_override_scsi_hot_unplug_q35);
+}
+if (qtest_has_device("virtio-blk-pci")) {
+qtest_add_func("hd-geo/override/virtio_hot_unplug_q35",
+   test_override_virtio_hot_unplug_q35);
+qtest_add_func("hd-geo/override/virtio_blk_q35",
+   test_override_virtio_blk_q35);
 }
-} else {
-g_test_message("QTEST_QEMU_IMG not set or qemu-img missing; "
-   "skipping hd-geo/override/* tests");
 }
 
 test_add_done:
-- 
2.46.0




[PULL 06/17] .gitlab-ci.d/buildtest: Build most targets in the build-without-defaults job

2024-09-17 Thread Thomas Huth
Now that all the qtests are able to deal with builds that use the
"--without-default-devices" configuration switch, we can add all
targets to the build-without-defaults job. But to avoid burning too
much CI cycles in this job, exclude some targets where we already
have similar test coverage by a related target.

Message-ID: <20240905191434.694440-9-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 .gitlab-ci.d/buildtest.yml | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index b75e4edbf6..2ab8c4806e 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -659,9 +659,6 @@ build-tci:
 - make check-tcg
 
 # Check our reduced build configurations
-# requires libfdt: aarch64, arm, loongarch64, microblaze, microblazeel,
-#   or1k, ppc64, riscv32, riscv64, rx
-# fails qtest without boards: i386, x86_64
 build-without-defaults:
   extends: .native_build_job_template
   needs:
@@ -675,11 +672,7 @@ build-without-defaults:
   --disable-pie
   --disable-qom-cast-debug
   --disable-strip
-TARGETS: alpha-softmmu avr-softmmu hppa-softmmu m68k-softmmu
-  mips-softmmu mips64-softmmu mipsel-softmmu mips64el-softmmu
-  ppc-softmmu s390x-softmmu sh4-softmmu sh4eb-softmmu sparc-softmmu
-  sparc64-softmmu tricore-softmmu xtensa-softmmu xtensaeb-softmmu
-  hexagon-linux-user i386-linux-user s390x-linux-user
+  
--target-list-exclude=aarch64-softmmu,microblaze-softmmu,mips64-softmmu,mipsel-softmmu,ppc64-softmmu,sh4el-softmmu,xtensa-softmmu,x86_64-softmmu
 MAKE_CHECK_ARGS: check
 
 build-libvhost-user:
-- 
2.46.0




[PULL 02/17] tests/qtest/boot-order-test: Make the machine name mandatory in this test

2024-09-17 Thread Thomas Huth
Let's make sure that we always pass a machine name to the test_boot_orders()
function, so we can check whether the machine is available in the binary
and skip the test in case it is not included in the build.

Message-ID: <20240905191434.694440-4-th...@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Thomas Huth 
---
 tests/qtest/boot-order-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qtest/boot-order-test.c b/tests/qtest/boot-order-test.c
index 8f2b6ef05a..c67b8cfe16 100644
--- a/tests/qtest/boot-order-test.c
+++ b/tests/qtest/boot-order-test.c
@@ -31,7 +31,7 @@ static void test_a_boot_order(const char *machine,
 uint64_t actual;
 QTestState *qts;
 
-if (machine && !qtest_has_machine(machine)) {
+if (!qtest_has_machine(machine)) {
 g_test_skip("Machine is not available");
 return;
 }
@@ -107,7 +107,7 @@ static const boot_order_test test_cases_pc[] = {
 
 static void test_pc_boot_order(void)
 {
-test_boot_orders(NULL, read_boot_order_pc, test_cases_pc);
+test_boot_orders("pc", read_boot_order_pc, test_cases_pc);
 }
 
 static uint64_t read_boot_order_pmac(QTestState *qts)
-- 
2.46.0




[PULL 01/17] tests/qtest/cdrom-test: Improve the machine detection in the cdrom test

2024-09-17 Thread Thomas Huth
When configuring QEMU with the --without-default-devices switch, these
tests are currently failing since they assume that the "pc" and "q35"
machines are always available. Add some proper checks to make the test
work without these machines, too.

Message-ID: <20240905191434.694440-3-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 tests/qtest/cdrom-test.c | 77 ++--
 1 file changed, 42 insertions(+), 35 deletions(-)

diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c
index 5d89e62515..9d72b24e4b 100644
--- a/tests/qtest/cdrom-test.c
+++ b/tests/qtest/cdrom-test.c
@@ -135,13 +135,35 @@ static void add_x86_tests(void)
 return;
 }
 
-qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot);
-if (qtest_has_device("virtio-scsi-ccw")) {
-qtest_add_data_func("cdrom/boot/virtio-scsi",
-"-device virtio-scsi -device scsi-cd,drive=cdr "
-"-blockdev file,node-name=cdr,filename=",
-test_cdboot);
+if (qtest_has_machine("pc")) {
+qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot);
+if (qtest_has_device("virtio-scsi-ccw")) {
+qtest_add_data_func("cdrom/boot/virtio-scsi",
+"-device virtio-scsi -device scsi-cd,drive=cdr 
"
+"-blockdev file,node-name=cdr,filename=",
+test_cdboot);
+}
+
+if (qtest_has_device("am53c974")) {
+qtest_add_data_func("cdrom/boot/am53c974",
+"-device am53c974 -device scsi-cd,drive=cd1 "
+"-drive if=none,id=cd1,format=raw,file=",
+test_cdboot);
+}
+if (qtest_has_device("dc390")) {
+qtest_add_data_func("cdrom/boot/dc390",
+"-device dc390 -device scsi-cd,drive=cd1 "
+"-blockdev file,node-name=cd1,filename=",
+test_cdboot);
+}
+if (qtest_has_device("lsi53c895a")) {
+qtest_add_data_func("cdrom/boot/lsi53c895a",
+"-device lsi53c895a -device scsi-cd,drive=cd1 "
+"-blockdev file,node-name=cd1,filename=",
+test_cdboot);
+}
 }
+
 /*
  * Unstable CI test under load
  * See https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg05509.html
@@ -150,35 +172,20 @@ static void add_x86_tests(void)
 qtest_add_data_func("cdrom/boot/isapc", "-M isapc "
 "-drive if=ide,media=cdrom,file=", test_cdboot);
 }
-if (qtest_has_device("am53c974")) {
-qtest_add_data_func("cdrom/boot/am53c974",
-"-device am53c974 -device scsi-cd,drive=cd1 "
-"-drive if=none,id=cd1,format=raw,file=",
-test_cdboot);
-}
-if (qtest_has_device("dc390")) {
-qtest_add_data_func("cdrom/boot/dc390",
-"-device dc390 -device scsi-cd,drive=cd1 "
-"-blockdev file,node-name=cd1,filename=",
-test_cdboot);
-}
-if (qtest_has_device("lsi53c895a")) {
-qtest_add_data_func("cdrom/boot/lsi53c895a",
-"-device lsi53c895a -device scsi-cd,drive=cd1 "
-"-blockdev file,node-name=cd1,filename=",
-test_cdboot);
-}
-if (qtest_has_device("megasas")) {
-qtest_add_data_func("cdrom/boot/megasas", "-M q35 "
-"-device megasas -device scsi-cd,drive=cd1 "
-"-blockdev file,node-name=cd1,filename=",
-test_cdboot);
-}
-if (qtest_has_device("megasas-gen2")) {
-qtest_add_data_func("cdrom/boot/megasas-gen2", "-M q35 "
-"-device megasas-gen2 -device scsi-cd,drive=cd1 "
-"-blockdev file,node-name=cd1,filename=",
-test_cdboot);
+
+if (qtest_has_machine("q35")) {
+if (qtest_has_device("megasas")) {
+qtest_add_data_func("cdrom/boot/megasas", "-M q35 "
+"-device megasas -device scsi-cd,drive=cd1 "
+"-blockdev file,node-name=cd1,filename=",
+test_cdboot);
+}
+if (qtest_has_device("megasas-gen2")) {
+qtest_add_data_func("cdrom/boot/megasas-gen2", "-M q35 "
+"-device megasas-gen2 -device 
scsi-cd,drive=cd1 "
+"-blockdev file,node-name=cd1,filename=",
+test_cdboot);
+}
 }
 }
 
-- 
2.46.0




[PULL 00/17] s390x and test patches

2024-09-17 Thread Thomas Huth
 Hi!

The following changes since commit ea9cdbcf3a0b8d5497cddf87990f1b39d8f3bb0a:

  Merge tag 'hw-misc-20240913' of https://github.com/philmd/qemu into staging 
(2024-09-15 18:27:40 +0100)

are available in the Git repository at:

  https://gitlab.com/thuth/qemu.git tags/pull-request-2024-09-17

for you to fetch changes up to 66659fe76d3577b2cc3aa36d3935e3a2e9558e82:

  .gitlab-ci.d/crossbuilds.yml: Force 'make check' to -j2 for cross-i686-tci 
(2024-09-17 10:53:13 +0200)


* Make all qtest targets work with "--without-default-devices"
* Replace assert(0) and assert(false) in qtests and s390x code
* Enable the device aliases for or1k
* Some other small test improvements


Daniel P. Berrangé (1):
  gitlab: fix logic for changing docker tag on stable branches

Matheus Tavares Bernardino (1):
  docs/fuzz: fix outdated mention to enable-sanitizers

Peter Maydell (1):
  .gitlab-ci.d/crossbuilds.yml: Force 'make check' to -j2 for cross-i686-tci

Philippe Mathieu-Daudé (1):
  system: Sort QEMU_ARCH_VIRTIO_PCI definition

Pierrick Bouvier (5):
  tests/qtest: replace assert(0) with g_assert_not_reached()
  tests/unit: replace assert(0) with g_assert_not_reached()
  include/hw/s390x: replace assert(false) with g_assert_not_reached()
  tests/qtest: replace assert(false) with g_assert_not_reached()
  tests/qtest: remove break after g_assert_not_reached()

Thomas Huth (8):
  tests/qtest/cdrom-test: Improve the machine detection in the cdrom test
  tests/qtest/boot-order-test: Make the machine name mandatory in this test
  tests/qtest/hd-geo-test: Check for availability of "pc" machine before 
using it
  tests/qtest/meson.build: Add more CONFIG switches checks for the x86 tests
  tests/qtest: Disable numa-test if the default machine is not available
  .gitlab-ci.d/buildtest: Build most targets in the build-without-defaults 
job
  system: Enable the device aliases for or1k, too
  tests/functional: Move the mips64el fuloong2e test into the thorough 
category

 docs/devel/testing/fuzzing.rst  |  5 +--
 include/hw/s390x/cpu-topology.h |  2 +-
 system/qdev-monitor.c   | 18 ++
 tests/qtest/boot-order-test.c   |  4 +--
 tests/qtest/cdrom-test.c| 77 ++---
 tests/qtest/hd-geo-test.c   | 71 +++--
 tests/qtest/ipmi-bt-test.c  |  2 +-
 tests/qtest/ipmi-kcs-test.c |  4 +--
 tests/qtest/migration-helpers.c |  1 -
 tests/qtest/numa-test.c | 10 +++---
 tests/qtest/rtl8139-test.c  |  2 +-
 tests/unit/test-xs-node.c   |  4 +--
 .gitlab-ci.d/base.yml   |  2 +-
 .gitlab-ci.d/buildtest.yml  |  9 +
 .gitlab-ci.d/crossbuilds.yml|  4 +--
 tests/functional/meson.build|  5 +--
 tests/qtest/meson.build | 31 +
 17 files changed, 131 insertions(+), 120 deletions(-)




Re: [PATCH v2 12/18] tests/tcg: ensure s390x-softmmu output redirected

2024-09-17 Thread Thomas Huth

On 16/09/2024 10.53, Alex Bennée wrote:

The multiarch system tests output serial data which should be
redirected to the "output" chardev rather than echoed to the console.

Comment the use of EXTFLAGS variable while we are at it.

Signed-off-by: Alex Bennée 


Reviewed-by: Thomas Huth 




Re: [PATCH] .gitlab-ci.d/crossbuilds.yml: Force 'make check' to -j2 for cross-i686-tci

2024-09-16 Thread Thomas Huth

On 16/09/2024 15.49, Peter Maydell wrote:

In commit 1374ed49e1453c300 we forced the cross-i686-tci job to -j1 to
see if this helped with test timeouts. It seems to help with that but
on the other hand we now sometimes run into the overall 60 minute
job timeout. Try -j2 instead.

Signed-off-by: Peter Maydell 
---
  .gitlab-ci.d/crossbuilds.yml | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index 1e21d082aa4..95dfc392244 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -62,11 +62,11 @@ cross-i686-tci:
  IMAGE: debian-i686-cross
  ACCEL: tcg-interpreter
  EXTRA_CONFIGURE_OPTS: 
--target-list=i386-softmmu,i386-linux-user,aarch64-softmmu,aarch64-linux-user,ppc-softmmu,ppc-linux-user
 --disable-plugins --disable-kvm
-# Force tests to run in series, to see whether this
+# Force tests to run with reduced parallelism, to see whether this
  # reduces the flakiness of this CI job. The CI
  # environment by default shows us 8 CPUs and so we
  # would otherwise be using a parallelism of 9.
-MAKE_CHECK_ARGS: check check-tcg -j1
+MAKE_CHECK_ARGS: check check-tcg -j2
  
  cross-mipsel-system:

extends: .cross_system_build_job


Reviewed-by: Thomas Huth 




Re: [PULL 00/47] riscv-to-apply queue

2024-09-15 Thread Thomas Huth

On 15/09/2024 21.58, Daniel Henrique Barboza wrote:

Hi Peter, Alistair,

On 9/14/24 6:15 AM, Alistair Francis wrote:
On Fri, Sep 13, 2024 at 8:37 PM Peter Maydell  
wrote:


On Thu, 12 Sept 2024 at 06:30, Alistair Francis  
wrote:


The following changes since commit 
a4eb31c678400472de0b4915b9154a7c20d8332f:


   Merge tag 'pull-testing-gdbstub-oct-100924-1' of https://gitlab.com/ 
stsquad/qemu into staging (2024-09-11 13:17:29 +0100)


are available in the Git repository at:

   https://github.com/alistair23/qemu.git tags/pull-riscv-to- 
apply-20240912-1


for you to fetch changes up to 90d5d3c1115399d8e27621efd69dfa74a35a4932:

   hw/intc: riscv-imsic: Fix interrupt state updates. (2024-09-12 
15:05:10 +1000)



RISC-V PR for 9.2

* Add a property to set vl to ceil(AVL/2)
* Enable numamem testing for RISC-V
* Consider MISA bit choice in implied rule
* Fix the za64rs priv spec requirements
* Enable Bit Manip for OpenTitan Ibex CPU
* Fix the group bit setting of AIA with KVM
* Stop timer with infinite timecmp
* Add 'fcsr' register to QEMU log as a part of F extension
* Fix riscv64 build on musl libc
* Add preliminary textra trigger CSR functions
* RISC-V IOMMU support
* RISC-V bsd-user support
* Respect firmware ELF entry point
* Add Svvptc extension support
* Fix masking of rv32 physical address
* Fix linking problem with semihosting disabled
* Fix IMSIC interrupt state updates


Hi; this fails to build on FreeBSD:

https://gitlab.com/qemu-project/qemu/-/jobs/7817823771


Is this one of those jobs that are only available when running the main 
pipeline? I don't
have this x86-freebsd runner when triggering the gitlab pipeline. I ended up 
installing a

FreeBSD VM and using it to reproduce the problem.

Would be nice to have access to a FreeBSD runner as a regular user, even if 
just for x86_64,

to help detect these build problems before sending a PR.


You can enable this job for your pipelines, too, see 
.gitlab-ci.d/cirrus/README.rst for information how to configure it.


If you have a Linux host with KVM, you could alternatively also use "make 
vm-build-freebsd" on your local machine instead.


 Thomas




Re: [PATCH 12/17] tests/tcg: ensure s390x-softmmu output redirected

2024-09-15 Thread Thomas Huth

On 13/09/2024 19.26, Alex Bennée wrote:

The multiarch system tests output serial data which should be
redirected to the "output" chardev rather than echoed to the console.

Remove the unused EXTFLAGS variable while we are at it.

Signed-off-by: Alex Bennée 
---
  tests/tcg/s390x/Makefile.softmmu-target | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/tcg/s390x/Makefile.softmmu-target 
b/tests/tcg/s390x/Makefile.softmmu-target
index f60f94b090..ad681bbe40 100644
--- a/tests/tcg/s390x/Makefile.softmmu-target
+++ b/tests/tcg/s390x/Makefile.softmmu-target
@@ -1,6 +1,6 @@
  S390X_SRC=$(SRC_PATH)/tests/tcg/s390x
  VPATH+=$(S390X_SRC)
-QEMU_OPTS+=-action panic=exit-failure -nographic $(EXTFLAGS) -kernel
+QEMU_OPTS+=-action panic=exit-failure -nographic -serial chardev:output -kernel
  LINK_SCRIPT=$(S390X_SRC)/softmmu.ld
  CFLAGS+=-ggdb -O0
  LDFLAGS=-nostdlib -static


EXTFLAGS has been added on purpose here, see commit 26a09ead7351f117ae780.

 Thomas




[PATCH] tests/functional: Move the mips64el fuloong2e test into the thorough category

2024-09-13 Thread Thomas Huth
Commit d2fce37597c2 added a test that downloads an asset from the
internet, so this test should not be run by default anymore and be
put into the thorough category instead.

Signed-off-by: Thomas Huth 
---
 tests/functional/meson.build | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 975e609073..8d5520349d 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -86,11 +86,8 @@ tests_mipsel_system_thorough = [
   'mipsel_malta',
 ]
 
-tests_mips64el_system_quick = [
-  'mips64el_fuloong2e',
-]
-
 tests_mips64el_system_thorough = [
+  'mips64el_fuloong2e',
   'mips64el_loongson3v',
   'mips64el_malta',
 ]
-- 
2.46.0




[PATCH] hw/pci-bridge: Add a Kconfig switch for the normal PCI bridge

2024-09-13 Thread Thomas Huth
The pci-bridge device is not usable on s390x, so introduce a Kconfig
switch that allows to disable it.

Signed-off-by: Thomas Huth 
---
 hw/pci-bridge/Kconfig | 5 +
 hw/pci-bridge/meson.build | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/pci-bridge/Kconfig b/hw/pci-bridge/Kconfig
index 67077366cc..449ec98643 100644
--- a/hw/pci-bridge/Kconfig
+++ b/hw/pci-bridge/Kconfig
@@ -1,3 +1,8 @@
+config PCI_BRIDGE
+bool
+default y if PCI_DEVICES
+depends on PCI
+
 config PCIE_PORT
 bool
 default y if PCI_DEVICES
diff --git a/hw/pci-bridge/meson.build b/hw/pci-bridge/meson.build
index f2a60434dd..2e0eb0d233 100644
--- a/hw/pci-bridge/meson.build
+++ b/hw/pci-bridge/meson.build
@@ -1,5 +1,5 @@
 pci_ss = ss.source_set()
-pci_ss.add(files('pci_bridge_dev.c'))
+pci_ss.add(when: 'CONFIG_PCI_BRIDGE', if_true: files('pci_bridge_dev.c'))
 pci_ss.add(when: 'CONFIG_I82801B11', if_true: files('i82801b11.c'))
 pci_ss.add(when: 'CONFIG_IOH3420', if_true: files('ioh3420.c'))
 pci_ss.add(when: 'CONFIG_PCIE_PORT', if_true: files('pcie_root_port.c', 
'gen_pcie_root_port.c'))
-- 
2.46.0




Re: [PATCH v2] .gitlab-ci.d/crossbuilds.yml: Force 'make check' single-threaded for cross-i686-tci

2024-09-13 Thread Thomas Huth

On 13/09/2024 15.31, Peter Maydell wrote:

On Fri, 13 Sept 2024 at 13:24, Peter Maydell  wrote:


On Thu, 12 Sept 2024 at 16:10, Peter Maydell  wrote:


The cross-i686-tci CI job is persistently flaky with various tests
hitting timeouts.  One theory for why this is happening is that we're
running too many tests in parallel and so sometimes a test gets
starved of CPU and isn't able to complete within the timeout.

(The environment this CI job runs in seems to cause us to default
to a parallelism of 9 in the main CI.)

Signed-off-by: Peter Maydell 
---
If this works we might be able to wind this up to -j2 or -j3,
and/or consider whether other CI jobs need something similar.


I gave this a try, but unfortunately the result seems to be
that the whole job times out:
https://gitlab.com/qemu-project/qemu/-/jobs/7818441897


...but then this simple retry passed with a runtime of 47 mins:

https://gitlab.com/qemu-project/qemu/-/jobs/7819225200

I'm tempted to commit this as-is, and see whether it helps.


FWIW, I just had a try with your patch, too, and it took 53 minutes:

 https://gitlab.com/thuth/qemu/-/jobs/7818945368

Older jobs without your patch seem to take ~ 25 to ~ 30 minutes instead, so 
the runtime got definitely much worse by the -j1.


Considering that we're close to the 60 minutes timeout, you might need to 
bump the timeout of the job to 70 or 75 minutes now, to be on the safe side? 
Or maybe really try -j2 first?


 Thomas




[PATCH] hw/virtio/Kconfig: Include vhost-user-scmi only on arm targets

2024-09-13 Thread Thomas Huth
The System Control and Management Interface is specific to arm
machines, so don't include this device in non-arm targets.

Signed-off-by: Thomas Huth 
---
 hw/virtio/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
index aa63ff7fd4..bea5be4d4a 100644
--- a/hw/virtio/Kconfig
+++ b/hw/virtio/Kconfig
@@ -109,4 +109,4 @@ config VHOST_USER_SND
 config VHOST_USER_SCMI
 bool
 default y
-depends on VIRTIO && VHOST_USER
+depends on VIRTIO && VHOST_USER && ARM
-- 
2.46.0




Re: [RFC PATCH 0/2] qtest: Log verbosity changes

2024-09-13 Thread Thomas Huth

On 13/09/2024 13.46, Peter Maydell wrote:

On Fri, 13 Sept 2024 at 12:29, Markus Armbruster  wrote:


Peter Maydell  writes:

Specifically, if you don't disable the error-exit when qtest
is in use, then the generic qom-test tests which say "can we
at least instantiate every machine?" will fail, because they
assume that "qemu-system-foo -machine bar -accel qtest" will
at least start.

It doesn't really seem feasible to me to have qom-test
know about every machine's specific requirements for
how to pass a guest image.


Yes.


The other approach would be to standardize on "every machine
type should happily start up with no warnings even if there
is no guest code specified by the user and it would simply
execute zeroes". We already do this for quite a lot of
boards, including some major ones, so we're certainly not
consistent about trying to diagnose user errors in this area.


IMHO executing zeros is also a bad idea ... most of those boards crash after 
a while when the program counter reaches an unmapped memory region.


Maybe we could simply put a "branch to self" instruction on the first 
program counter address in case the kernel/firmware cannot be loaded?



Fatal error unless qtest is bad, because we take a different path.

Silently executing zero can be hard for users to diagnose.

Possible compromise: warn unless qtest?


That runs into the "tests that pass and do what they're
supposed to do shouldn't provoke warnings" unofficial
guideline... Some of these qtest_enabled() checks are
exactly to suppress a warning.


FWIW, I like the idea of having a error_report_user() function that is 
silent when running with qtest_enabled().


 Thomas




Re: [PATCH] hw/loongarch/virt: Add description for virt machine type

2024-09-13 Thread Thomas Huth

On 13/09/2024 11.52, Bibo Mao wrote:

The description about virt machine type is removed by mistake, add
new description here. Here is output result with command
"./qemu-system-loongarch64 -M help"

Supported machines are:
none empty machine
virt QEMU LoongArch Virtual Machine (default)
x-remote Experimental remote machine

Without the patch, it shows as follows:
Supported machines are:
none empty machine
virt (null) (default)
x-remote Experimental remote machine

Fixes: ef2f11454c(hw/loongarch/virt: Replace Loongson IPI with LoongArch IPI)
Signed-off-by: Bibo Mao 
---
  hw/loongarch/virt.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 29040422aa..8e80110b24 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -1390,6 +1390,7 @@ static void virt_class_init(ObjectClass *oc, void *data)
  mc->init = virt_init;
  mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("la464");
  mc->default_ram_id = "loongarch.ram";
+mc->desc = "QEMU LoongArch Virtual Machine";
  mc->max_cpus = LOONGARCH_MAX_CPUS;
  mc->is_default = 1;
  mc->default_kernel_irqchip_split = false;

base-commit: 4b7ea33074450bc6148c8e1545d78f179e64adb4


Reviewed-by: Thomas Huth 

CC:-ing qemu-stable for getting it fixed in the next stable release of 9.1, too.




Re: [PATCH v4 1/5] hw/loongarch: Rename LOONGARCH_MACHINE with LOONGARCH_VIRT_MACHINE

2024-09-13 Thread Thomas Huth

On 08/05/2024 05.11, Bibo Mao wrote:

On LoongArch system, there is only virt machine type now, name
LOONGARCH_MACHINE is confused, rename it with LOONGARCH_VIRT_MACHINE.
Machine name about Other real hw boards can be added in future.

Signed-off-by: Bibo Mao 
---

...

diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index c0999878df..6619cb52a9 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c

...

@@ -1208,7 +1208,6 @@ static void loongarch_class_init(ObjectClass *oc, void 
*data)
  MachineClass *mc = MACHINE_CLASS(oc);
  HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
  
-mc->desc = "Loongson-3A5000 LS7A1000 machine";

  mc->init = loongarch_init;
  mc->default_ram_size = 1 * GiB;
  mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("la464");


 Hi!

I noticed that the machine now does not have any description anymore, which 
is kind of ugly when you list the available machines:


$ ./qemu-system-loongarch64 -M help
Supported machines are:
none empty machine
virt (null) (default)

Could you please come up with a new mc->desc for the virt machine?

 Thanks,
  Thomas




Re: [PATCH v2] .gitlab-ci.d/crossbuilds.yml: Force 'make check' single-threaded for cross-i686-tci

2024-09-12 Thread Thomas Huth

On 12/09/2024 17.10, Peter Maydell wrote:

The cross-i686-tci CI job is persistently flaky with various tests
hitting timeouts.  One theory for why this is happening is that we're
running too many tests in parallel and so sometimes a test gets
starved of CPU and isn't able to complete within the timeout.

(The environment this CI job runs in seems to cause us to default
to a parallelism of 9 in the main CI.)

Signed-off-by: Peter Maydell 
---
If this works we might be able to wind this up to -j2 or -j3,
and/or consider whether other CI jobs need something similar.


As a start, we could also try replacing the

 JOBS=$(expr $(nproc) + 1)

with

 JOBS=$(nproc)

in the buildtest-template.yml file...?


---
  .gitlab-ci.d/crossbuilds.yml | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index 459273f9da5..1e21d082aa4 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -62,7 +62,11 @@ cross-i686-tci:
  IMAGE: debian-i686-cross
  ACCEL: tcg-interpreter
  EXTRA_CONFIGURE_OPTS: 
--target-list=i386-softmmu,i386-linux-user,aarch64-softmmu,aarch64-linux-user,ppc-softmmu,ppc-linux-user
 --disable-plugins --disable-kvm
-MAKE_CHECK_ARGS: check check-tcg
+# Force tests to run in series, to see whether this
+# reduces the flakiness of this CI job. The CI
+# environment by default shows us 8 CPUs and so we
+# would otherwise be using a parallelism of 9.
+MAKE_CHECK_ARGS: check check-tcg -j1


Reviewed-by: Thomas Huth 




Re: [PATCH v1 07/14] s390x/s390-hypercall: introduce DIAG500 STORAGE_LIMIT

2024-09-12 Thread Thomas Huth

On 10/09/2024 19.58, David Hildenbrand wrote:

A guest OS that supports memory hotplug / memory devices must during
boot be aware of the maximum possible physical memory address that it might
have to handle at a later stage during its runtime

For example, the maximum possible memory address might be required to
prepare the kernel virtual address space accordingly (e.g., select page
table hierarchy depth).

On s390x there is currently no such mechanism that is compatible with
paravirtualized memory devices, because the whole SCLP interface was
designed around the idea of "storage increments" and "standby memory".
Paravirtualized memory devices we want to support, such as virtio-mem, have
no intersection with any of that, but could co-exist with them in the
future if ever needed.

In particular, a guest OS must never detect and use device memory
without the help of a proper device driver. Device memory must not be
exposed in any firmware-provided memory map (SCLP or diag260 on s390x).
For this reason, these memory devices will be places in memory *above*
the "maximum storage increment" exposed via SCLP.

Let's provide a new diag500 subcode to query the memory limit determined in
s390_memory_init().

Signed-off-by: David Hildenbrand 
---
  hw/s390x/s390-hypercall.c | 3 +++
  hw/s390x/s390-hypercall.h | 1 +
  2 files changed, 4 insertions(+)

diff --git a/hw/s390x/s390-hypercall.c b/hw/s390x/s390-hypercall.c
index f09e8a1d81..ac48fc0961 100644
--- a/hw/s390x/s390-hypercall.c
+++ b/hw/s390x/s390-hypercall.c
@@ -68,6 +68,9 @@ int handle_diag_500(CPUS390XState *env)
  case DIAG500_VIRTIO_CCW_NOTIFY:
  env->regs[2] = handle_virtio_ccw_notify(env->regs[2], env->regs[3]);
  return 0;
+case DIAG500_STORAGE_LIMIT:
+env->regs[2] = s390_get_memory_limit() - 1;
+return 0;
  default:
  return -EINVAL;
  }
diff --git a/hw/s390x/s390-hypercall.h b/hw/s390x/s390-hypercall.h
index b7ac29f444..f0ca62bcbb 100644
--- a/hw/s390x/s390-hypercall.h
+++ b/hw/s390x/s390-hypercall.h
@@ -18,6 +18,7 @@
  #define DIAG500_VIRTIO_RESET1 /* legacy */
  #define DIAG500_VIRTIO_SET_STATUS   2 /* legacy */
  #define DIAG500_VIRTIO_CCW_NOTIFY   3 /* KVM_S390_VIRTIO_CCW_NOTIFY */
+#define DIAG500_STORAGE_LIMIT   4
  
  int handle_diag_500(CPUS390XState *env);


Reviewed-by: Thomas Huth 

Sounds very reasonable to me - but it would be good to get an 
Ack/Reviewed-by from IBM folks here (in case they prefer a different 
interface)... hope they'll join the discussion!


 Thomas




Re: [PATCH v1 06/14] s390x: introduce s390_get_memory_limit()

2024-09-12 Thread Thomas Huth

On 10/09/2024 19.58, David Hildenbrand wrote:

Let's add s390_get_memory_limit(), to query what has been successfully
set via s390_set_memory_limit(). Allow setting the limit only once.

Signed-off-by: David Hildenbrand 
---
  target/s390x/cpu-sysemu.c | 19 +--
  target/s390x/cpu.h|  1 +
  2 files changed, 18 insertions(+), 2 deletions(-)


Reviewed-by: Thomas Huth 




Re: [PATCH v1 05/14] s390x/s390-virtio-ccw: move setting the maximum guest size from sclp to machine code

2024-09-12 Thread Thomas Huth

On 10/09/2024 19.58, David Hildenbrand wrote:

Nowadays, it feels more natural to have that code located in
s390_memory_init(), where we also have direct access to the machine
object.

While at it, use the actual RAM size, not the maximum RAM size which
cannot currently be reached without support for any memory devices.

Signed-off-by: David Hildenbrand 
---
  hw/s390x/s390-virtio-ccw.c | 22 ++
  hw/s390x/sclp.c| 11 ---
  2 files changed, 18 insertions(+), 15 deletions(-)


Reviewed-by: Thomas Huth 




Gitlab CI caching is not working

2024-09-11 Thread Thomas Huth



 Hi!

While looking at some recent CI jobs, I noticed that the caching of the 
Gitlab-CI jobs is not working at all anymore. In the build jobs, the ccache 
saving is not working and causing a complete cache miss of each compile:


 https://gitlab.com/qemu-project/qemu/-/jobs/7802183187#L5328

And, maybe more important, in the avocado/functional jobs we don't cache the 
assets anymore, causing a re-download of multiple gigabytes each time:


 https://gitlab.com/qemu-project/qemu/-/jobs/7802183251#L29

(the du -chs in line 35 is not executed, thus the cache is nonexistent)

The problem is not new, it's been there for some weeks already, e.g. here's 
a run from the last freeze period (when the job was only running avocado tests):


 https://gitlab.com/qemu-project/qemu/-/jobs/7753544153#L86

There is a suspicious message at the beginning of the logs:

 "No URL provided, cache will not be downloaded from shared cache server. 
Instead a local version of cache will be extracted."


... but since we use throw-away containers for building, I guess there is no 
local version of the cache?


Anyway, the problem only exists for the k8s runners, in my private clone of 
the repository that uses shared runners from gitlab, the caching is working 
right.


Could somebody please have a look into this? Fixing the caching might speed 
up our build time quite a bit, I think.


 Thomas




Re: [PATCH v1 04/14] s390x: rename s390-virtio-hcall* to s390-hypercall*

2024-09-11 Thread Thomas Huth

On 10/09/2024 19.57, David Hildenbrand wrote:

Let's make it clearer that we are talking about general
QEMU/KVM-specific hypercalls.

Signed-off-by: David Hildenbrand 
---
  hw/s390x/meson.build   | 2 +-
  hw/s390x/{s390-virtio-hcall.c => s390-hypercall.c} | 2 +-
  hw/s390x/{s390-virtio-hcall.h => s390-hypercall.h} | 6 +++---
  target/s390x/kvm/kvm.c | 2 +-
  target/s390x/tcg/misc_helper.c | 2 +-
  5 files changed, 7 insertions(+), 7 deletions(-)
  rename hw/s390x/{s390-virtio-hcall.c => s390-hypercall.c} (97%)
  rename hw/s390x/{s390-virtio-hcall.h => s390-hypercall.h} (86%)


Reviewed-by: Thomas Huth 




Re: [PATCH v1 03/14] s390x/s390-virtio-hcall: prepare for more diag500 hypercalls

2024-09-11 Thread Thomas Huth

On 10/09/2024 19.57, David Hildenbrand wrote:

Let's generalize, abstracting the virtio bits. diag500 is now a generic
hypercall to handle QEMU/KVM specific things. Explicitly specify all
already defined subcodes, including legacy ones (so we know what we can
use for new hypercalls).

We'll rename the files separately, so git properly detects the rename.

Signed-off-by: David Hildenbrand 
---
  hw/s390x/s390-virtio-hcall.c   |  8 
  hw/s390x/s390-virtio-hcall.h   | 11 ++-
  target/s390x/kvm/kvm.c | 10 ++
  target/s390x/tcg/misc_helper.c |  4 ++--
  4 files changed, 14 insertions(+), 19 deletions(-)


Reviewed-by: Thomas Huth 




Re: [PATCH 01/39] docs/spin: replace assert(0) with g_assert_not_reached()

2024-09-11 Thread Thomas Huth

On 11/09/2024 14.51, Richard W.M. Jones wrote:

On Wed, Sep 11, 2024 at 02:46:18PM +0200, Maciej S. Szmigiero wrote:

On 11.09.2024 14:37, Eric Blake wrote:

On Wed, Sep 11, 2024 at 07:33:59AM GMT, Eric Blake wrote:

On Tue, Sep 10, 2024 at 03:15:28PM GMT, Pierrick Bouvier wrote:

Signed-off-by: Pierrick Bouvier 
---


A general suggestion for the entire series: please use a commit
message that explains why this is a good idea.  Even something as
boiler-plate as "refer to commit XXX for rationale" that can be
copy-pasted into all the other commits is better than nothing,
although a self-contained message is best.  Maybe:

This patch is part of a series that moves towards a consistent use of
g_assert_not_reached() rather than an ad hoc mix of different
assertion mechanisms.


Or summarize your cover letter:

Use of assert(false) can trip spurious control flow warnings from some
versions of gcc:
https://lore.kernel.org/qemu-devel/54bb02a6-1b12-460a-97f6-3f478ef76...@linaro.org/
Solve that by unifying the code base on g_assert_not_reached()
instead.



If using g_assert_not_reached() instead of assert(false) silences
the warning about missing return value in such impossible to reach
locations should we also be deleting the now-unnecessary "return"
statements after g_assert_not_reached()?


Although it's unlikely to be used on any compiler that can also
compile qemu, there is a third implementation of g_assert_not_reached
that does nothing, see:

https://gitlab.gnome.org/GNOME/glib/-/blob/927683ebd94eb66c0d7868b77863f57ce9c5bc76/glib/gtestutils.h#L269


That's only in the #ifdef G_DISABLE_ASSERT case ... and we forbid that in 
QEMU, see osdep.h:


#ifdef G_DISABLE_ASSERT
#error building with G_DISABLE_ASSERT is not supported
#endif

So in QEMU, g_assert_not_reached() should always abort.

 Thomas




Re: [PATCH v1 02/14] s390x/s390-virtio-hcall: remove hypercall registration mechanism

2024-09-11 Thread Thomas Huth

On 10/09/2024 19.57, David Hildenbrand wrote:

Nowadays, we only have a single machine type in QEMU, everything is based
on virtio-ccw and the traditional virtio machine does no longer exist. No
need to dynamically register diag500 handlers. Move the two existing
handlers into s390-virtio-hcall.c.

Signed-off-by: David Hildenbrand 
---
  hw/s390x/s390-virtio-ccw.c   | 58 
  hw/s390x/s390-virtio-hcall.c | 65 +++-
  hw/s390x/s390-virtio-hcall.h |  2 --
  3 files changed, 49 insertions(+), 76 deletions(-)


Reviewed-by: Thomas Huth 




Re: [PATCH v1 01/14] s390x/s390-virtio-ccw: don't crash on weird RAM sizes

2024-09-11 Thread Thomas Huth

On 11/09/2024 14.38, David Hildenbrand wrote:

On 11.09.24 13:28, Janosch Frank wrote:

On 9/10/24 7:57 PM, David Hildenbrand wrote:

KVM is not happy when starting a VM with weird RAM sizes:

    # qemu-system-s390x --enable-kvm --nographic -m 1234K
    qemu-system-s390x: kvm_set_user_memory_region: 
KVM_SET_USER_MEMORY_REGION

  failed, slot=0, start=0x0, size=0x244000: Invalid argument
    kvm_set_phys_mem: error registering slot: Invalid argument
    Aborted (core dumped)

Let's handle that in a better way by rejecting such weird RAM sizes
right from the start:



Huh, I always assumed that ram is handled in multiples of 1MB in QEMU.


Me as well, I did not dig if that changed at some point ... or why such odd 
sizes would even be required :)


I guess it's there for some old PC hardware ... Remember, 640K ought to be 
enough for anybody.


 Thomas




Re: [PATCH v1 01/14] s390x/s390-virtio-ccw: don't crash on weird RAM sizes

2024-09-11 Thread Thomas Huth

On 10/09/2024 19.57, David Hildenbrand wrote:

KVM is not happy when starting a VM with weird RAM sizes:

   # qemu-system-s390x --enable-kvm --nographic -m 1234K
   qemu-system-s390x: kvm_set_user_memory_region: KVM_SET_USER_MEMORY_REGION
 failed, slot=0, start=0x0, size=0x244000: Invalid argument
   kvm_set_phys_mem: error registering slot: Invalid argument
   Aborted (core dumped)

Let's handle that in a better way by rejecting such weird RAM sizes
right from the start:

   # qemu-system-s390x --enable-kvm --nographic -m 1234K
   qemu-system-s390x: ram size must be multiples of 1 MiB

Signed-off-by: David Hildenbrand 
---
  hw/s390x/s390-virtio-ccw.c | 11 +++
  1 file changed, 11 insertions(+)


Reviewed-by: Thomas Huth 




[PULL v2 23/24] tests/functional/qemu_test: Use Python hashlib instead of external programs

2024-09-11 Thread Thomas Huth
Some systems (like OpenBSD) do not have the sha256sum or sha512sum programs
installed by default, or use different names for those. Use the Python
hashlib instead so we don't have to rely on the external programs.

Reported-by: Peter Maydell 
Message-ID: <20240910201742.239559-1-th...@redhat.com>
Reviewed-by: Brian Cain 
Signed-off-by: Thomas Huth 
---
 tests/functional/qemu_test/asset.py | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/functional/qemu_test/asset.py 
b/tests/functional/qemu_test/asset.py
index d3be2aff82..3ec429217e 100644
--- a/tests/functional/qemu_test/asset.py
+++ b/tests/functional/qemu_test/asset.py
@@ -43,15 +43,21 @@ def _check(self, cache_file):
 if self.hash is None:
 return True
 if len(self.hash) == 64:
-sum_prog = 'sha256sum'
+hl = hashlib.sha256()
 elif len(self.hash) == 128:
-sum_prog = 'sha512sum'
+hl = hashlib.sha512()
 else:
 raise Exception("unknown hash type")
 
-checksum = subprocess.check_output(
-[sum_prog, str(cache_file)]).split()[0]
-return self.hash == checksum.decode("utf-8")
+# Calculate the hash of the file:
+with open(cache_file, 'rb') as file:
+while True:
+chunk = file.read(1 << 20)
+if not chunk:
+break
+hl.update(chunk)
+
+return  hl.hexdigest()
 
 def valid(self):
 return self.cache_file.exists() and self._check(self.cache_file)
-- 
2.46.0




[PULL v2 24/24] Update FreeBSD CI jobs FreeBSD 14.1

2024-09-11 Thread Thomas Huth
The current FreeBSD CI jobs are failing installation since the
"opencv" package is now missing there. Updating to 14.1 fixes
the issue.

Message-Id: <20240911090149.286257-1-th...@redhat.com>
Reviewed-by: Li-Wen Hsu 
Signed-off-by: Thomas Huth 
---
 .gitlab-ci.d/cirrus.yml  | 6 +++---
 .gitlab-ci.d/cirrus/{freebsd-13.vars => freebsd-14.vars} | 2 +-
 tests/lcitool/refresh| 4 ++--
 tests/vm/freebsd | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)
 rename .gitlab-ci.d/cirrus/{freebsd-13.vars => freebsd-14.vars} (95%)

diff --git a/.gitlab-ci.d/cirrus.yml b/.gitlab-ci.d/cirrus.yml
index 75df1273bc..92c97eefc1 100644
--- a/.gitlab-ci.d/cirrus.yml
+++ b/.gitlab-ci.d/cirrus.yml
@@ -46,13 +46,13 @@
   variables:
 QEMU_JOB_CIRRUS: 1
 
-x64-freebsd-13-build:
+x64-freebsd-14-build:
   extends: .cirrus_build_job
   variables:
-NAME: freebsd-13
+NAME: freebsd-14
 CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
 CIRRUS_VM_IMAGE_SELECTOR: image_family
-CIRRUS_VM_IMAGE_NAME: freebsd-13-3
+CIRRUS_VM_IMAGE_NAME: freebsd-14-1
 CIRRUS_VM_CPUS: 8
 CIRRUS_VM_RAM: 8G
 UPDATE_COMMAND: pkg update; pkg upgrade -y
diff --git a/.gitlab-ci.d/cirrus/freebsd-13.vars 
b/.gitlab-ci.d/cirrus/freebsd-14.vars
similarity index 95%
rename from .gitlab-ci.d/cirrus/freebsd-13.vars
rename to .gitlab-ci.d/cirrus/freebsd-14.vars
index 69c948b503..aba0eff4b9 100644
--- a/.gitlab-ci.d/cirrus/freebsd-13.vars
+++ b/.gitlab-ci.d/cirrus/freebsd-14.vars
@@ -1,6 +1,6 @@
 # THIS FILE WAS AUTO-GENERATED
 #
-#  $ lcitool variables freebsd-13 qemu
+#  $ lcitool variables freebsd-14 qemu
 #
 # https://gitlab.com/libvirt/libvirt-ci
 
diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh
index ac803e34f1..290804f6be 100755
--- a/tests/lcitool/refresh
+++ b/tests/lcitool/refresh
@@ -207,14 +207,14 @@ try:
 #
 # Cirrus packages lists for GitLab
 #
-generate_cirrus("freebsd-13")
+generate_cirrus("freebsd-14")
 generate_cirrus("macos-13")
 generate_cirrus("macos-14")
 
 #
 # VM packages lists
 #
-generate_pkglist("freebsd", "freebsd-13")
+generate_pkglist("freebsd", "freebsd-14")
 
 #
 # Ansible package lists
diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index 1247f40a38..74b3b1e520 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -28,8 +28,8 @@ class FreeBSDVM(basevm.BaseVM):
 name = "freebsd"
 arch = "x86_64"
 
-link = 
"https://download.freebsd.org/releases/CI-IMAGES/13.2-RELEASE/amd64/Latest/FreeBSD-13.2-RELEASE-amd64-BASIC-CI.raw.xz";
-csum = "a4fb3b6c7b75dd4d58fb0d75e4caf72844bffe0ca00e66459c028b198ffb3c0e"
+link = 
"https://download.freebsd.org/releases/CI-IMAGES/14.1-RELEASE/amd64/Latest/FreeBSD-14.1-RELEASE-amd64-BASIC-CI.raw.xz";
+csum = "202fe27a05427f0a86d3ebb97712745186f2776ccc4f70d95466dd99a0238ba5"
 size = "20G"
 
 BUILD_SCRIPT = """
@@ -39,7 +39,7 @@ class FreeBSDVM(basevm.BaseVM):
 mkdir src build; cd src;
 tar -xf /dev/vtbd1;
 cd ../build;
-../src/configure --python=python3.9  --extra-ldflags=-L/usr/local/lib \
+../src/configure --extra-ldflags=-L/usr/local/lib \
  --extra-cflags=-I/usr/local/include {configure_opts};
 gmake --output-sync -j{jobs} {target} {verbose};
 """
-- 
2.46.0




[PULL v2 00/24] Tests and misc patches

2024-09-11 Thread Thomas Huth
 Hi Peter!

The following changes since commit a66f28df650166ae8b50c992eea45e7b247f4143:

  Merge tag 'migration-20240909-pull-request' of https://gitlab.com/peterx/qemu 
into staging (2024-09-10 11:19:22 +0100)

are available in the Git repository at:

  https://gitlab.com/thuth/qemu.git tags/pull-request-2024-09-11

for you to fetch changes up to b4358ed4fd29c21c69e492d814f0926c58caa10f:

  Update FreeBSD CI jobs FreeBSD 14.1 (2024-09-11 11:26:41 +0200)


* Split --enable-sanitizers to --enable-{asan, ubsan}
* Build MSYS2 job using multiple CPUs
* Fix "make distclean" wrt contrib/plugins/
* Convert more Avocado tests to plain standalone functional tests
* Fix bug that breaks "make check-functional" when tesseract is missing
* Use builtin hashlib of Python in the functional tests
* Update the FreeBSD CI jobs to 14.1

v2:
 - Use python hashlib instead of external programs
 - Update FreeBSD CI jobs FreeBSD 14.1


Beraldo Leal (1):
  MAINTAINERS: Remove myself as reviewer

Philippe Mathieu-Daudé (10):
  gitlab-ci: Build MSYS2 job using multiple CPUs
  tests/functional: Convert mips64el Fuloong2e avocado test (2/2)
  tests/functional: Convert mips64el I6400 Malta avocado tests
  tests/functional: Convert mips64el 5KEc Malta avocado tests
  tests/functional: Convert mips32el Malta YAMON avocado test
  tests/functional: Convert nanomips Malta avocado tests
  tests/functional: Convert mips32eb 4Kc Malta avocado tests
  tests/functional: Convert ARM Raspi2 avocado tests
  tests/functional: Convert Aarch64 Raspi3 avocado tests
  tests/functional: Convert Aarch64 Raspi4 avocado tests

Richard Henderson (2):
  meson: Split --enable-sanitizers to --enable-{asan, ubsan}
  meson: Move -fsanitize=undefined into normal configuraton

Thomas Huth (11):
  contrib/plugins/Makefile: Add a 'distclean' target
  MAINTAINERS: Remove myself from the Meson section
  tests/functional: Add the LinuxKernelTest for testing the Linux boot 
process
  tests/functional: Convert the m68k Q800 Avocado test into a functional 
test
  tests/functional: Convert the Alpha Clipper Avocado test
  tests/functional: Convert the m68k MCF5208EVB Avocado test
  tests/functional: Convert the or1k-sim Avocado test
  tests/functional: Convert the multiprocess avocado test into a standalone 
test
  tests/functional: Fix bad usage of has_cmd
  tests/functional/qemu_test: Use Python hashlib instead of external 
programs
  Update FreeBSD CI jobs FreeBSD 14.1

 MAINTAINERS|  12 +-
 docs/devel/testing/fuzzing.rst |   4 +-
 meson.build|  26 +-
 tests/qtest/fdc-test.c |   2 +-
 .gitlab-ci.d/buildtest.yml |  12 +-
 .gitlab-ci.d/cirrus.yml|   6 +-
 .../cirrus/{freebsd-13.vars => freebsd-14.vars}|   2 +-
 .../custom-runners/ubuntu-22.04-aarch64.yml|   2 +-
 .gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml |   2 +-
 .gitlab-ci.d/windows.yml   |   3 +-
 contrib/plugins/Makefile   |   2 +-
 meson_options.txt  |   6 +-
 scripts/meson-buildoptions.sh  |   9 +-
 tests/avocado/avocado_qemu/__init__.py |  10 -
 tests/avocado/boot_linux_console.py| 483 -
 tests/avocado/machine_mips_malta.py| 162 ---
 tests/avocado/multiprocess.py  | 102 -
 tests/docker/test-debug|   4 +-
 tests/functional/meson.build   |  26 +-
 tests/functional/qemu_test/__init__.py |   1 +
 tests/functional/qemu_test/asset.py|  16 +-
 tests/functional/qemu_test/cmd.py  |   6 +-
 tests/functional/qemu_test/linuxkernel.py  |  41 ++
 tests/functional/qemu_test/tesseract.py|   3 +-
 tests/functional/test_aarch64_raspi3.py|  41 ++
 tests/functional/test_aarch64_raspi4.py|  99 +
 tests/functional/test_alpha_clipper.py |  38 ++
 tests/functional/test_arm_raspi2.py|  95 
 tests/functional/test_m68k_mcf5208evb.py   |  29 ++
 tests/functional/test_m68k_q800.py |  37 ++
 tests/functional/test_mips64el_fuloong2e.py|  25 +-
 tests/functional/test_mips64el_malta.py| 186 
 tests/functional/test_mips_malta.py|  81 
 tests/functional/test_mipsel_malta.py  |  96 
 tests/functional/test_multiprocess.py  | 100 +
 tests/functional/test_or1k_sim.py  |  29 ++
 tests/lcitool/refresh 

[PATCH] Update FreeBSD CI jobs FreeBSD 14.1

2024-09-11 Thread Thomas Huth
The current FreeBSD CI jobs are failing installation since the
"opencv" package is now missing there. Updating to 14.1 fixes
the issue.

Signed-off-by: Thomas Huth 
---
 Here's the output of a successful run:
 https://gitlab.com/thuth/qemu/-/jobs/7795460644

 .gitlab-ci.d/cirrus.yml  | 6 +++---
 .gitlab-ci.d/cirrus/{freebsd-13.vars => freebsd-14.vars} | 2 +-
 tests/lcitool/refresh| 4 ++--
 tests/vm/freebsd | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)
 rename .gitlab-ci.d/cirrus/{freebsd-13.vars => freebsd-14.vars} (95%)

diff --git a/.gitlab-ci.d/cirrus.yml b/.gitlab-ci.d/cirrus.yml
index 75df1273bc..92c97eefc1 100644
--- a/.gitlab-ci.d/cirrus.yml
+++ b/.gitlab-ci.d/cirrus.yml
@@ -46,13 +46,13 @@
   variables:
 QEMU_JOB_CIRRUS: 1
 
-x64-freebsd-13-build:
+x64-freebsd-14-build:
   extends: .cirrus_build_job
   variables:
-NAME: freebsd-13
+NAME: freebsd-14
 CIRRUS_VM_INSTANCE_TYPE: freebsd_instance
 CIRRUS_VM_IMAGE_SELECTOR: image_family
-CIRRUS_VM_IMAGE_NAME: freebsd-13-3
+CIRRUS_VM_IMAGE_NAME: freebsd-14-1
 CIRRUS_VM_CPUS: 8
 CIRRUS_VM_RAM: 8G
 UPDATE_COMMAND: pkg update; pkg upgrade -y
diff --git a/.gitlab-ci.d/cirrus/freebsd-13.vars 
b/.gitlab-ci.d/cirrus/freebsd-14.vars
similarity index 95%
rename from .gitlab-ci.d/cirrus/freebsd-13.vars
rename to .gitlab-ci.d/cirrus/freebsd-14.vars
index 69c948b503..aba0eff4b9 100644
--- a/.gitlab-ci.d/cirrus/freebsd-13.vars
+++ b/.gitlab-ci.d/cirrus/freebsd-14.vars
@@ -1,6 +1,6 @@
 # THIS FILE WAS AUTO-GENERATED
 #
-#  $ lcitool variables freebsd-13 qemu
+#  $ lcitool variables freebsd-14 qemu
 #
 # https://gitlab.com/libvirt/libvirt-ci
 
diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh
index ac803e34f1..290804f6be 100755
--- a/tests/lcitool/refresh
+++ b/tests/lcitool/refresh
@@ -207,14 +207,14 @@ try:
 #
 # Cirrus packages lists for GitLab
 #
-generate_cirrus("freebsd-13")
+generate_cirrus("freebsd-14")
 generate_cirrus("macos-13")
 generate_cirrus("macos-14")
 
 #
 # VM packages lists
 #
-generate_pkglist("freebsd", "freebsd-13")
+generate_pkglist("freebsd", "freebsd-14")
 
 #
 # Ansible package lists
diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index 1247f40a38..74b3b1e520 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -28,8 +28,8 @@ class FreeBSDVM(basevm.BaseVM):
 name = "freebsd"
 arch = "x86_64"
 
-link = 
"https://download.freebsd.org/releases/CI-IMAGES/13.2-RELEASE/amd64/Latest/FreeBSD-13.2-RELEASE-amd64-BASIC-CI.raw.xz";
-csum = "a4fb3b6c7b75dd4d58fb0d75e4caf72844bffe0ca00e66459c028b198ffb3c0e"
+link = 
"https://download.freebsd.org/releases/CI-IMAGES/14.1-RELEASE/amd64/Latest/FreeBSD-14.1-RELEASE-amd64-BASIC-CI.raw.xz";
+csum = "202fe27a05427f0a86d3ebb97712745186f2776ccc4f70d95466dd99a0238ba5"
 size = "20G"
 
 BUILD_SCRIPT = """
@@ -39,7 +39,7 @@ class FreeBSDVM(basevm.BaseVM):
 mkdir src build; cd src;
 tar -xf /dev/vtbd1;
 cd ../build;
-../src/configure --python=python3.9  --extra-ldflags=-L/usr/local/lib \
+../src/configure --extra-ldflags=-L/usr/local/lib \
  --extra-cflags=-I/usr/local/include {configure_opts};
 gmake --output-sync -j{jobs} {target} {verbose};
 """
-- 
2.46.0




Re: [PATCH 12/39] tests/qtest: replace assert(0) with g_assert_not_reached()

2024-09-10 Thread Thomas Huth

On 11/09/2024 00.15, Pierrick Bouvier wrote:

Signed-off-by: Pierrick Bouvier 
---
  tests/qtest/ipmi-bt-test.c  | 2 +-
  tests/qtest/ipmi-kcs-test.c | 4 ++--
  tests/qtest/rtl8139-test.c  | 2 +-
  3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c
index 383239bcd48..13f7c841f59 100644
--- a/tests/qtest/ipmi-bt-test.c
+++ b/tests/qtest/ipmi-bt-test.c
@@ -251,7 +251,7 @@ static void emu_msg_handler(void)
  msg[msg_len++] = 0xa0;
  write_emu_msg(msg, msg_len);
  } else {
-g_assert(0);
+g_assert_not_reached();
  }
  }
  
diff --git a/tests/qtest/ipmi-kcs-test.c b/tests/qtest/ipmi-kcs-test.c

index afc24dd3e46..3186c6ad64b 100644
--- a/tests/qtest/ipmi-kcs-test.c
+++ b/tests/qtest/ipmi-kcs-test.c
@@ -145,7 +145,7 @@ static void kcs_cmd(uint8_t *cmd, unsigned int cmd_len,
  break;
  
  default:

-g_assert(0);
+g_assert_not_reached();
  }
  *rsp_len = j;
  }
@@ -184,7 +184,7 @@ static void kcs_abort(uint8_t *cmd, unsigned int cmd_len,
  break;
  
  default:

-g_assert(0);
+g_assert_not_reached();
  }
  
  /* Start the abort here */

diff --git a/tests/qtest/rtl8139-test.c b/tests/qtest/rtl8139-test.c
index eedf90f65af..55f671f2f59 100644
--- a/tests/qtest/rtl8139-test.c
+++ b/tests/qtest/rtl8139-test.c
@@ -65,7 +65,7 @@ PORT(IntrMask, w, 0x3c)
  PORT(IntrStatus, w, 0x3E)
  PORT(TimerInt, l, 0x54)
  
-#define fatal(...) do { g_test_message(__VA_ARGS__); g_assert(0); } while (0)

+#define fatal(...) do { g_test_message(__VA_ARGS__); g_assert_not_reached(); } 
while (0)
  
  static void test_timer(void)

  {


Reviewed-by: Thomas Huth 




Re: [PATCH 14/39] include/hw/s390x: replace assert(false) with g_assert_not_reached()

2024-09-10 Thread Thomas Huth

On 11/09/2024 00.15, Pierrick Bouvier wrote:

Signed-off-by: Pierrick Bouvier 
---
  include/hw/s390x/cpu-topology.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/s390x/cpu-topology.h b/include/hw/s390x/cpu-topology.h
index c064f427e94..dcb25956a64 100644
--- a/include/hw/s390x/cpu-topology.h
+++ b/include/hw/s390x/cpu-topology.h
@@ -57,7 +57,7 @@ static inline void s390_topology_setup_cpu(MachineState *ms,
  static inline void s390_topology_reset(void)
  {
  /* Unreachable, CPU topology not implemented for TCG */
-assert(false);
+g_assert_not_reached();
  }
  #endif
  


Reviewed-by: Thomas Huth 




[PATCH] tests/functional/qemu_test: Use Python hashlib instead of external programs

2024-09-10 Thread Thomas Huth
Some systems (like OpenBSD) do not have the sha256sum or sha512sum programs
installed by default. Use the Python hashlib instead so we don't have to
rely on the external programs.

Reported-by: Peter Maydell 
Signed-off-by: Thomas Huth 
---
 tests/functional/qemu_test/asset.py | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/functional/qemu_test/asset.py 
b/tests/functional/qemu_test/asset.py
index d3be2aff82..3ec429217e 100644
--- a/tests/functional/qemu_test/asset.py
+++ b/tests/functional/qemu_test/asset.py
@@ -43,15 +43,21 @@ def _check(self, cache_file):
 if self.hash is None:
 return True
 if len(self.hash) == 64:
-sum_prog = 'sha256sum'
+hl = hashlib.sha256()
 elif len(self.hash) == 128:
-sum_prog = 'sha512sum'
+hl = hashlib.sha512()
 else:
 raise Exception("unknown hash type")
 
-checksum = subprocess.check_output(
-[sum_prog, str(cache_file)]).split()[0]
-return self.hash == checksum.decode("utf-8")
+# Calculate the hash of the file:
+with open(cache_file, 'rb') as file:
+while True:
+chunk = file.read(1 << 20)
+if not chunk:
+break
+hl.update(chunk)
+
+return  hl.hexdigest()
 
 def valid(self):
 return self.cache_file.exists() and self._check(self.cache_file)
-- 
2.46.0




Re: [PULL 00/22] Tests and misc patches

2024-09-10 Thread Thomas Huth

On 10/09/2024 17.38, Peter Maydell wrote:

On Tue, 10 Sept 2024 at 13:37, Thomas Huth  wrote:


The following changes since commit 7bbadc60b58b742494555f06cd342311ddab9351:

   Merge tag 'crypto-fixes-pull-request' of https://gitlab.com/berrange/qemu 
into staging (2024-09-09 15:19:32 +0100)

are available in the Git repository at:

   https://gitlab.com/thuth/qemu.git tags/pull-request-2024-09-10

for you to fetch changes up to cc3e005eb22332ba277bff2e39025d0087f3795e:

   tests/functional: Fix bad usage of has_cmd (2024-09-10 13:44:42 +0200)


* Split --enable-sanitizers to --enable-{asan, ubsan}
* Build MSYS2 job using multiple CPUs
* Fix "make distclean" wrt contrib/plugins/
* Convert more Avocado tests to plain standalone functional tests
* Fix bug that breaks "make check-functional" when tesseract is missing




On the 'make check-vm-openbsd' test I run:

595/944 qemu:func-quick+func-mips64el /
func-mips64el-mips64el_fuloong2e  ERROR6.16s
exit status 1
602/944 qemu:func-quick+func-or1k / func-or1k-or1k_sim
ERROR6.91s   exit status 1

Slightly more detail further up in the log:


595/944 qemu:func-quick+func-mips64el /
func-mips64el-mips64el_fuloong2e  ERROR6.16s
exit status 1
― ✀  ―
stderr:
Traceback (most recent call last):
   File 
"/home/qemu/qemu-test.fsnflZ/src/tests/functional/test_mips64el_fuloong2e.py",
line 29, in test_linux_kernel_3_16
 deb_path = self.ASSET_KERNEL.fetch()
   File "/home/qemu/qemu-test.fsnflZ/src/tests/functional/qemu_test/asset.py",
line 135, in fetch
 if not self._check(tmp_cache_file):
   File "/home/qemu/qemu-test.fsnflZ/src/tests/functional/qemu_test/asset.py",
line 52, in _check
 checksum = subprocess.check_output(
   File "/usr/local/lib/python3.10/subprocess.py", line 421, in check_output
 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
   File "/usr/local/lib/python3.10/subprocess.py", line 503, in run
 with Popen(*popenargs, **kwargs) as process:
   File "/usr/local/lib/python3.10/subprocess.py", line 971, in __init__
 self._execute_child(args, executable, preexec_fn, close_fds,
   File "/usr/local/lib/python3.10/subprocess.py", line 1863, in _execute_child
 raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'sha256sum'


(test program exited with status code 1)


Similarly for the or1k failure.

If you want to use sha256sum in "make check" then we should
ensure that it's installed in these BSD VM images.


Ok ... I'm looking into using the hashlib from Python instead, that way 
we'll be independent from external binaries here.



Also, does this mean that "make check" is now going to run
a lot of the tests that were previously in "make check-avocado"?
That seems like it might make our CI jobs take longer...


No, it will only some basic tests that don't download any assets. These 
should be the rather quick ones.


 Thomas




[PULL 08/22] tests/functional: Convert the m68k Q800 Avocado test into a functional test

2024-09-10 Thread Thomas Huth
Just had to update the asset checksum to use SHA256 instead of SHA1,
but apart from that it is a pretty much straightforward conversion.

Message-ID: <20240906180549.792832-3-th...@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé 
Tested-by: Philippe Mathieu-Daudé 
Signed-off-by: Thomas Huth 
---
 MAINTAINERS |  1 +
 tests/avocado/boot_linux_console.py | 24 ---
 tests/functional/meson.build|  3 ++-
 tests/functional/test_m68k_q800.py  | 37 +
 4 files changed, 40 insertions(+), 25 deletions(-)
 create mode 100755 tests/functional/test_m68k_q800.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 822f89847b..a25022a77a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1310,6 +1310,7 @@ F: include/hw/m68k/q800-glue.h
 F: include/hw/misc/djmemc.h
 F: include/hw/misc/iosb.h
 F: include/hw/audio/asc.h
+F: tests/functional/test_m68k_q800.py
 
 virt
 M: Laurent Vivier 
diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index 18c69d6acc..396836bf64 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -1325,30 +1325,6 @@ def test_alpha_clipper(self):
 console_pattern = 'Kernel command line: %s' % kernel_command_line
 self.wait_for_console_pattern(console_pattern)
 
-def test_m68k_q800(self):
-"""
-:avocado: tags=arch:m68k
-:avocado: tags=machine:q800
-"""
-deb_url = ('https://snapshot.debian.org/archive/debian-ports'
-   '/20191021T083923Z/pool-m68k/main'
-   '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb')
-deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1'
-deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
-kernel_path = self.extract_from_deb(deb_path,
-'/boot/vmlinux-5.3.0-1-m68k')
-
-self.vm.set_console()
-kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
-   'console=ttyS0 vga=off')
-self.vm.add_args('-kernel', kernel_path,
- '-append', kernel_command_line)
-self.vm.launch()
-console_pattern = 'Kernel command line: %s' % kernel_command_line
-self.wait_for_console_pattern(console_pattern)
-console_pattern = 'No filesystem could mount root'
-self.wait_for_console_pattern(console_pattern)
-
 def do_test_advcal_2018(self, day, tar_hash, kernel_name, console=0):
 tar_url = ('https://qemu-advcal.gitlab.io'
'/qac-best-of-multiarch/download/day' + day + '.tar.xz')
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index cda89c4b0c..c6bb345d2c 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -57,7 +57,8 @@ tests_loongarch64_system_thorough = [
 ]
 
 tests_m68k_system_thorough = [
-  'm68k_nextcube'
+  'm68k_nextcube',
+  'm68k_q800',
 ]
 
 tests_microblaze_system_thorough = [
diff --git a/tests/functional/test_m68k_q800.py 
b/tests/functional/test_m68k_q800.py
new file mode 100755
index 00..3b17244b98
--- /dev/null
+++ b/tests/functional/test_m68k_q800.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+#
+# Functional test for testing the q800 m68k machine
+#
+# 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 LinuxKernelTest, Asset
+
+class Q800MachineTest(LinuxKernelTest):
+
+ASSET_KERNEL = Asset(
+('https://snapshot.debian.org/'
+ 'archive/debian-ports/20191021T083923Z/pool-m68k/main/l/linux/'
+ 'kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb'),
+'949e50d74d4b9bc15d26c06d402717b7a4c0e32ff8100014f5930d8024de7b73')
+
+def test_m68k_q800(self):
+self.set_machine('q800')
+
+deb_path = self.ASSET_KERNEL.fetch()
+kernel_path = self.extract_from_deb(deb_path,
+'/boot/vmlinux-5.3.0-1-m68k')
+
+self.vm.set_console()
+kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+   'console=ttyS0 vga=off')
+self.vm.add_args('-kernel', kernel_path,
+ '-append', kernel_command_line)
+self.vm.launch()
+console_pattern = 'Kernel command line: %s' % kernel_command_line
+self.wait_for_console_pattern(console_pattern)
+console_pattern = 'No filesystem could mount root'
+self.wait_for_console_pattern(console_pattern)
+
+if __name__ == '__main__':
+LinuxKernelTest.main()
-- 
2.46.0




[PULL 18/22] tests/functional: Convert the Alpha Clipper Avocado test

2024-09-10 Thread Thomas Huth
Straight forward conversion, just switch to SHA256 hashsum now.

Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Message-ID: <20240906180549.792832-13-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 tests/avocado/boot_linux_console.py| 21 --
 tests/functional/meson.build   |  4 +++
 tests/functional/test_alpha_clipper.py | 38 ++
 3 files changed, 42 insertions(+), 21 deletions(-)
 create mode 100755 tests/functional/test_alpha_clipper.py

diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index a8eac44d9f..75aab90320 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -882,27 +882,6 @@ def test_arm_orangepi_uboot_netbsd9(self):
 # Wait for user-space
 wait_for_console_pattern(self, 'Starting root file system check')
 
-def test_alpha_clipper(self):
-"""
-:avocado: tags=arch:alpha
-:avocado: tags=machine:clipper
-"""
-kernel_url = ('http://archive.debian.org/debian/dists/lenny/main/'
-  'installer-alpha/20090123lenny10/images/cdrom/vmlinuz')
-kernel_hash = '3a943149335529e2ed3e74d0d787b85fb5671ba3'
-kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-
-uncompressed_kernel = archive.uncompress(kernel_path, self.workdir)
-
-self.vm.set_console()
-kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
-self.vm.add_args('-nodefaults',
- '-kernel', uncompressed_kernel,
- '-append', kernel_command_line)
-self.vm.launch()
-console_pattern = 'Kernel command line: %s' % kernel_command_line
-self.wait_for_console_pattern(console_pattern)
-
 def do_test_advcal_2018(self, day, tar_hash, kernel_name, console=0):
 tar_url = ('https://qemu-advcal.gitlab.io'
'/qac-best-of-multiarch/download/day' + day + '.tar.xz')
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index a79083b0f9..e1903132a1 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -41,6 +41,10 @@ tests_aarch64_system_thorough = [
   'aarch64_virt',
 ]
 
+tests_alpha_system_thorough = [
+  'alpha_clipper',
+]
+
 tests_arm_system_thorough = [
   'arm_canona1100',
   'arm_integratorcp',
diff --git a/tests/functional/test_alpha_clipper.py 
b/tests/functional/test_alpha_clipper.py
new file mode 100755
index 00..c1fbf0e395
--- /dev/null
+++ b/tests/functional/test_alpha_clipper.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python3
+#
+# Functional test that boots a Linux kernel on an Alpha Clipper machine
+# and checks the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+
+from qemu_test import LinuxKernelTest, Asset
+from qemu_test.utils import gzip_uncompress
+
+
+class AlphaClipperTest(LinuxKernelTest):
+
+ASSET_KERNEL = Asset(
+('http://archive.debian.org/debian/dists/lenny/main/'
+ 'installer-alpha/20090123lenny10/images/cdrom/vmlinuz'),
+'34f53da3fa32212e4f00b03cb944b2ad81c06bc8faaf9b7193b2e544ceeca576')
+
+def test_alpha_clipper(self):
+self.set_machine('clipper')
+kernel_path = self.ASSET_KERNEL.fetch()
+
+uncompressed_kernel = os.path.join(self.workdir, 'vmlinux')
+gzip_uncompress(kernel_path, uncompressed_kernel)
+
+self.vm.set_console()
+kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
+self.vm.add_args('-nodefaults',
+ '-kernel', uncompressed_kernel,
+ '-append', kernel_command_line)
+self.vm.launch()
+console_pattern = 'Kernel command line: %s' % kernel_command_line
+self.wait_for_console_pattern(console_pattern)
+
+if __name__ == '__main__':
+LinuxKernelTest.main()
-- 
2.46.0




[PULL 15/22] tests/functional: Convert ARM Raspi2 avocado tests

2024-09-10 Thread Thomas Huth
From: Philippe Mathieu-Daudé 

Straight forward conversion. Update the SHA1 hashes to SHA256
hashes since SHA1 should not be used anymore nowadays.

Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240826221058.75126-3-phi...@linaro.org>
[thuth: Use LinuxKernelTest class]
Message-ID: <20240906180549.792832-10-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 MAINTAINERS |  1 +
 tests/avocado/boot_linux_console.py | 85 --
 tests/functional/meson.build|  1 +
 tests/functional/test_arm_raspi2.py | 95 +
 4 files changed, 97 insertions(+), 85 deletions(-)
 create mode 100755 tests/functional/test_arm_raspi2.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 6e0044ab58..3cc9c19d02 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -911,6 +911,7 @@ F: hw/*/bcm283*
 F: include/hw/arm/rasp*
 F: include/hw/*/bcm283*
 F: docs/system/arm/raspi.rst
+F: tests/functional/test_arm_raspi2.py
 
 Real View
 M: Peter Maydell 
diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index e3e4576099..827a286429 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -203,91 +203,6 @@ def test_arm_emcraft_sf2(self):
 exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
 '3 packets transmitted, 3 packets received, 0% packet loss')
 
-def do_test_arm_raspi2(self, uart_id):
-"""
-:avocado: tags=accel:tcg
-
-The kernel can be rebuilt using the kernel source referenced
-and following the instructions on the on:
-https://www.raspberrypi.org/documentation/linux/kernel/building.md
-"""
-serial_kernel_cmdline = {
-0: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
-}
-deb_url = ('http://archive.raspberrypi.org/debian/'
-   'pool/main/r/raspberrypi-firmware/'
-   'raspberrypi-kernel_1.20190215-1_armhf.deb')
-deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
-deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
-kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
-dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
-
-self.vm.set_console()
-kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
-   serial_kernel_cmdline[uart_id] +
-   ' root=/dev/mmcblk0p2 rootwait ' +
-   'dwc_otg.fiq_fsm_enable=0')
-self.vm.add_args('-kernel', kernel_path,
- '-dtb', dtb_path,
- '-append', kernel_command_line,
- '-device', 'usb-kbd')
-self.vm.launch()
-console_pattern = 'Kernel command line: %s' % kernel_command_line
-self.wait_for_console_pattern(console_pattern)
-console_pattern = 'Product: QEMU USB Keyboard'
-self.wait_for_console_pattern(console_pattern)
-
-def test_arm_raspi2_uart0(self):
-"""
-:avocado: tags=arch:arm
-:avocado: tags=machine:raspi2b
-:avocado: tags=device:pl011
-:avocado: tags=accel:tcg
-"""
-self.do_test_arm_raspi2(0)
-
-def test_arm_raspi2_initrd(self):
-"""
-:avocado: tags=arch:arm
-:avocado: tags=machine:raspi2b
-"""
-deb_url = ('http://archive.raspberrypi.org/debian/'
-   'pool/main/r/raspberrypi-firmware/'
-   'raspberrypi-kernel_1.20190215-1_armhf.deb')
-deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
-deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
-kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
-dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
-
-initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
-  '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
-  'arm/rootfs-armv7a.cpio.gz')
-initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
-initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
-initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
-archive.gzip_uncompress(initrd_path_gz, initrd_path)
-
-self.vm.set_console()
-kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
-   'earlycon=pl011,0x3f201000 console=ttyAMA0 '
-   

[PULL 10/22] tests/functional: Convert mips64el I6400 Malta avocado tests

2024-09-10 Thread Thomas Huth
From: Philippe Mathieu-Daudé 

Straight forward conversion. Update the SHA1 hashes to SHA256
hashes since SHA1 should not be used anymore nowadays.

Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240827094905.80648-4-phi...@linaro.org>
Reviewed-by: Thomas Huth 
Message-ID: <20240906180549.792832-5-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 MAINTAINERS |   1 +
 tests/avocado/machine_mips_malta.py | 108 
 tests/functional/meson.build|   1 +
 tests/functional/test_mips64el_malta.py | 108 
 4 files changed, 110 insertions(+), 108 deletions(-)
 create mode 100755 tests/functional/test_mips64el_malta.py

diff --git a/MAINTAINERS b/MAINTAINERS
index a25022a77a..dcf3823169 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1371,6 +1371,7 @@ F: hw/pci-host/gt64120.c
 F: include/hw/southbridge/piix.h
 F: tests/avocado/linux_ssh_mips_malta.py
 F: tests/avocado/machine_mips_malta.py
+F: tests/functional/test_mips64el_malta.py
 
 Mipssim
 R: Aleksandar Rikalo 
diff --git a/tests/avocado/machine_mips_malta.py 
b/tests/avocado/machine_mips_malta.py
index 07a80633b5..05c64e18c4 100644
--- a/tests/avocado/machine_mips_malta.py
+++ b/tests/avocado/machine_mips_malta.py
@@ -8,121 +8,13 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 import os
-import gzip
-import logging
 
-from avocado import skipUnless
-from avocado import skipUnless
 from avocado.utils import archive
 from avocado_qemu import QemuSystemTest
-from avocado_qemu import exec_command_and_wait_for_pattern
 from avocado_qemu import interrupt_interactive_console_until_pattern
 from avocado_qemu import wait_for_console_pattern
 
 
-NUMPY_AVAILABLE = True
-try:
-import numpy as np
-except ImportError:
-NUMPY_AVAILABLE = False
-
-CV2_AVAILABLE = True
-try:
-import cv2
-except ImportError:
-CV2_AVAILABLE = False
-
-
-@skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed')
-@skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed')
-class MaltaMachineFramebuffer(QemuSystemTest):
-
-timeout = 30
-
-KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
-
-def do_test_i6400_framebuffer_logo(self, cpu_cores_count):
-"""
-Boot Linux kernel and check Tux logo is displayed on the framebuffer.
-"""
-screendump_path = os.path.join(self.workdir, 'screendump.pbm')
-
-kernel_url = ('https://github.com/philmd/qemu-testing-blob/raw/'
-  'a5966ca4b5/mips/malta/mips64el/'
-  'vmlinux-4.7.0-rc1.I6400.gz')
-kernel_hash = '096f50c377ec5072e6a366943324622c312045f6'
-kernel_path_gz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-kernel_path = self.workdir + "vmlinux"
-archive.gzip_uncompress(kernel_path_gz, kernel_path)
-
-tuxlogo_url = ('https://github.com/torvalds/linux/raw/v2.6.12/'
-   'drivers/video/logo/logo_linux_vga16.ppm')
-tuxlogo_hash = '3991c2ddbd1ddaecda7601f8aafbcf5b02dc86af'
-tuxlogo_path = self.fetch_asset(tuxlogo_url, asset_hash=tuxlogo_hash)
-
-self.vm.set_console()
-kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
-   'clocksource=GIC console=tty0 console=ttyS0')
-self.vm.add_args('-kernel', kernel_path,
- '-smp', '%u' % cpu_cores_count,
- '-vga', 'std',
- '-append', kernel_command_line)
-self.vm.launch()
-framebuffer_ready = 'Console: switching to colour frame buffer device'
-wait_for_console_pattern(self, framebuffer_ready,
- failure_message='Kernel panic - not syncing')
-self.vm.cmd('human-monitor-command', command_line='stop')
-self.vm.cmd('human-monitor-command',
-command_line='screendump %s' % screendump_path)
-logger = logging.getLogger('framebuffer')
-
-match_threshold = 0.95
-screendump_bgr = cv2.imread(screendump_path, cv2.IMREAD_COLOR)
-tuxlogo_bgr = cv2.imread(tuxlogo_path, cv2.IMREAD_COLOR)
-result = cv2.matchTemplate(screendump_bgr, tuxlogo_bgr,
-   cv2.TM_CCOEFF_NORMED)
-loc = np.where(result >= match_threshold)
-tuxlogo_count = 0
-h, w = tuxlogo_bgr.shape[:2]
-debug_png = os.getenv('AVOCADO_CV2_SCREENDUMP_PNG_PATH')
-for tuxlogo_count, pt in enumerate(zip(*loc[::-1]), start=1):
-logger.debug('found Tux at position (x, y) = %s', pt)
-cv2.rectangle(screendump_bgr, pt,
-  

[PULL 14/22] tests/functional: Convert mips32eb 4Kc Malta avocado tests

2024-09-10 Thread Thomas Huth
From: Philippe Mathieu-Daudé 

Straight forward conversion. Update the SHA1 hashes to
SHA256 hashes since SHA1 should not be used anymore nowadays.

Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240827094905.80648-8-phi...@linaro.org>
[thuth: Use LinuxKernelTest class]
Message-ID: <20240906180549.792832-9-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 MAINTAINERS |  1 +
 tests/avocado/boot_linux_console.py | 63 --
 tests/functional/meson.build|  4 ++
 tests/functional/test_mips_malta.py | 81 +
 4 files changed, 86 insertions(+), 63 deletions(-)
 create mode 100755 tests/functional/test_mips_malta.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 2f76098230..6e0044ab58 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1370,6 +1370,7 @@ F: hw/mips/malta.c
 F: hw/pci-host/gt64120.c
 F: include/hw/southbridge/piix.h
 F: tests/avocado/linux_ssh_mips_malta.py
+F: tests/functional/test_mips_malta.py
 F: tests/functional/test_mipsel_malta.py
 F: tests/functional/test_mips64el_malta.py
 
diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index 34f4abadd0..e3e4576099 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -116,69 +116,6 @@ def test_x86_64_pc(self):
 console_pattern = 'Kernel command line: %s' % kernel_command_line
 self.wait_for_console_pattern(console_pattern)
 
-def test_mips_malta(self):
-"""
-:avocado: tags=arch:mips
-:avocado: tags=machine:malta
-:avocado: tags=endian:big
-"""
-deb_url = ('http://snapshot.debian.org/archive/debian/'
-   '20130217T032700Z/pool/main/l/linux-2.6/'
-   'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb')
-deb_hash = 'a8cfc28ad8f45f54811fc6cf74fc43ffcfe0ba04'
-deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
-kernel_path = self.extract_from_deb(deb_path,
-'/boot/vmlinux-2.6.32-5-4kc-malta')
-
-self.vm.set_console()
-kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
-self.vm.add_args('-kernel', kernel_path,
- '-append', kernel_command_line)
-self.vm.launch()
-console_pattern = 'Kernel command line: %s' % kernel_command_line
-self.wait_for_console_pattern(console_pattern)
-
-def test_mips_malta_cpio(self):
-"""
-:avocado: tags=arch:mips
-:avocado: tags=machine:malta
-:avocado: tags=endian:big
-"""
-deb_url = ('http://snapshot.debian.org/archive/debian/'
-   '20160601T041800Z/pool/main/l/linux/'
-   'linux-image-4.5.0-2-4kc-malta_4.5.5-1_mips.deb')
-deb_hash = 'a3c84f3e88b54e06107d65a410d1d1e8e0f340f8'
-deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
-kernel_path = self.extract_from_deb(deb_path,
-'/boot/vmlinux-4.5.0-2-4kc-malta')
-initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
-  '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/'
-  'mips/rootfs.cpio.gz')
-initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99'
-initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
-initrd_path = self.workdir + "rootfs.cpio"
-archive.gzip_uncompress(initrd_path_gz, initrd_path)
-
-self.vm.set_console()
-kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
-   + 'console=ttyS0 console=tty '
-   + 'rdinit=/sbin/init noreboot')
-self.vm.add_args('-kernel', kernel_path,
- '-initrd', initrd_path,
- '-append', kernel_command_line,
- '-no-reboot')
-self.vm.launch()
-self.wait_for_console_pattern('Boot successful.')
-
-exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
-'BogoMIPS')
-exec_command_and_wait_for_pattern(self, 'uname -a',
-'Debian')
-exec_command_and_wait_for_pattern(self, 'reboot',
-'reboot: Restarting system')
-# Wait for VM to shut down gracefully
-self.vm.wait()
-
 def test_aarch64_xlnx_versal_virt(self):
  

[PULL 12/22] tests/functional: Convert mips32el Malta YAMON avocado test

2024-09-10 Thread Thomas Huth
From: Philippe Mathieu-Daudé 

Straight forward conversion using the Python standard zipfile
module instead of avocado.utils package. Update the SHA1 hashes
to SHA256 hashes since SHA1 should not be used anymore nowadays.

Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240827094905.80648-6-phi...@linaro.org>
Reviewed-by: Thomas Huth 
Message-ID: <20240906180549.792832-7-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 MAINTAINERS |  2 +-
 tests/avocado/machine_mips_malta.py | 54 -
 tests/functional/meson.build|  4 ++
 tests/functional/test_mips64el_malta.py | 16 
 tests/functional/test_mipsel_malta.py   | 47 +
 5 files changed, 61 insertions(+), 62 deletions(-)
 delete mode 100644 tests/avocado/machine_mips_malta.py
 create mode 100755 tests/functional/test_mipsel_malta.py

diff --git a/MAINTAINERS b/MAINTAINERS
index dcf3823169..2f76098230 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1370,7 +1370,7 @@ F: hw/mips/malta.c
 F: hw/pci-host/gt64120.c
 F: include/hw/southbridge/piix.h
 F: tests/avocado/linux_ssh_mips_malta.py
-F: tests/avocado/machine_mips_malta.py
+F: tests/functional/test_mipsel_malta.py
 F: tests/functional/test_mips64el_malta.py
 
 Mipssim
diff --git a/tests/avocado/machine_mips_malta.py 
b/tests/avocado/machine_mips_malta.py
deleted file mode 100644
index 05c64e18c4..00
--- a/tests/avocado/machine_mips_malta.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# Functional tests for the MIPS Malta board
-#
-# Copyright (c) Philippe Mathieu-Daudé 
-#
-# This work is licensed under the terms of the GNU GPL, version 2 or later.
-# See the COPYING file in the top-level directory.
-#
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-import os
-
-from avocado.utils import archive
-from avocado_qemu import QemuSystemTest
-from avocado_qemu import interrupt_interactive_console_until_pattern
-from avocado_qemu import wait_for_console_pattern
-
-
-class MaltaMachine(QemuSystemTest):
-
-def do_test_yamon(self):
-rom_url = ('https://s3-eu-west-1.amazonaws.com/'
-   'downloads-mips/mips-downloads/'
-   'YAMON/yamon-bin-02.22.zip')
-rom_hash = '8da7ecddbc5312704b8b324341ee238189bde480'
-zip_path = self.fetch_asset(rom_url, asset_hash=rom_hash)
-
-archive.extract(zip_path, self.workdir)
-yamon_path = os.path.join(self.workdir, 'yamon-02.22.bin')
-
-self.vm.set_console()
-self.vm.add_args('-bios', yamon_path)
-self.vm.launch()
-
-prompt =  'YAMON>'
-pattern = 'YAMON ROM Monitor'
-interrupt_interactive_console_until_pattern(self, pattern, prompt)
-wait_for_console_pattern(self, prompt)
-self.vm.shutdown()
-
-def test_mipsel_malta_yamon(self):
-"""
-:avocado: tags=arch:mipsel
-:avocado: tags=machine:malta
-:avocado: tags=endian:little
-"""
-self.do_test_yamon()
-
-def test_mips64el_malta_yamon(self):
-"""
-:avocado: tags=arch:mips64el
-:avocado: tags=machine:malta
-:avocado: tags=endian:little
-"""
-self.do_test_yamon()
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 9baf903e39..daee61ec3c 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -69,6 +69,10 @@ tests_microblazeel_system_thorough = [
   'microblazeel_s3adsp1800'
 ]
 
+tests_mipsel_system_thorough = [
+  'mipsel_malta',
+]
+
 tests_mips64el_system_quick = [
   'mips64el_fuloong2e',
 ]
diff --git a/tests/functional/test_mips64el_malta.py 
b/tests/functional/test_mips64el_malta.py
index 1be93d7ff0..6c6355b131 100755
--- a/tests/functional/test_mips64el_malta.py
+++ b/tests/functional/test_mips64el_malta.py
@@ -30,7 +30,7 @@
 CV2_AVAILABLE = False
 
 
-class MaltaMachineConsole(QemuSystemTest):
+class MaltaMachineConsole(LinuxKernelTest):
 
 ASSET_KERNEL_2_63_2 = Asset(
 ('http://snapshot.debian.org/archive/debian/'
@@ -52,17 +52,17 @@ def test_mips64el_malta(self):
 ch-common-tasks.html#s-common-official
 """
 deb_path = self.ASSET_KERNEL_2_63_2.fetch()
-kernel_path = extract_from_deb(deb_path, self.workdir,
-   '/boot/vmlinux-2.6.32-5-5kc-malta')
+kernel_path = self.extract_from_deb(deb_path,
+'/boot/vmlinux-2.6.32-5-5kc-malta')
 
 self.set_machine('malta')
 self.vm.set_console()
-kernel_command_line = KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
+kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
 

[PULL 05/22] MAINTAINERS: Remove myself as reviewer

2024-09-10 Thread Thomas Huth
From: Beraldo Leal 

Finally taking this off my to-do list. It’s been a privilege to be part
of this project, but I am no longer actively involved in reviewing
Python code here, so I believe it's best to update the list to reflect
the current maintainers.

Please, feel free to reach out if any questions arise.

Signed-off-by: Beraldo Leal 
Reviewed-by: Philippe Mathieu-Daudé 
Message-ID: <20240819150035.2180786-1-bl...@redhat.com>
Signed-off-by: Thomas Huth 
---
 MAINTAINERS | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 0c1bc69828..8c7358fd5b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3188,7 +3188,6 @@ F: qapi/cryptodev.json
 Python library
 M: John Snow 
 M: Cleber Rosa 
-R: Beraldo Leal 
 S: Maintained
 F: python/
 T: git https://gitlab.com/jsnow/qemu.git python
@@ -4135,7 +4134,6 @@ M: Alex Bennée 
 M: Philippe Mathieu-Daudé 
 M: Thomas Huth 
 R: Wainer dos Santos Moschetta 
-R: Beraldo Leal 
 S: Maintained
 F: .github/workflows/lockdown.yml
 F: .gitlab-ci.yml
@@ -4181,7 +4179,6 @@ W: https://trello.com/b/6Qi1pxVn/avocado-qemu
 R: Cleber Rosa 
 R: Philippe Mathieu-Daudé 
 R: Wainer dos Santos Moschetta 
-R: Beraldo Leal 
 S: Odd Fixes
 F: tests/avocado/
 
-- 
2.46.0




[PULL 20/22] tests/functional: Convert the or1k-sim Avocado test

2024-09-10 Thread Thomas Huth
We've got to do_test_advcal_2018() here now that the test resides
in a separate file. Also switch back to the original URL (since
the site did not vanish as originally expected) and update the
hashsum to use SHA256.

Message-ID: <20240906180549.792832-15-th...@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé 
Tested-by: Philippe Mathieu-Daudé 
Signed-off-by: Thomas Huth 
---
 tests/avocado/boot_linux_console.py |  8 
 tests/functional/meson.build|  4 
 tests/functional/test_or1k_sim.py   | 29 +
 3 files changed, 33 insertions(+), 8 deletions(-)
 create mode 100755 tests/functional/test_or1k_sim.py

diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index db72bd1b5e..6c50284986 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -927,14 +927,6 @@ def test_arm_ast2600_debian(self):
 self.wait_for_console_pattern("SMP: Total of 2 processors activated")
 self.wait_for_console_pattern("No filesystem could mount root")
 
-def test_or1k_sim(self):
-"""
-:avocado: tags=arch:or1k
-:avocado: tags=machine:or1k-sim
-"""
-tar_hash = '20334cdaf386108c530ff0badaecc955693027dd'
-self.do_test_advcal_2018('20', tar_hash, 'vmlinux')
-
 def test_ppc64_e500(self):
 """
 :avocado: tags=arch:ppc64
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 8f9694244f..68a7570119 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -94,6 +94,10 @@ tests_mips64el_system_thorough = [
   'mips64el_malta',
 ]
 
+tests_or1k_system_quick = [
+  'or1k_sim',
+]
+
 tests_ppc_system_quick = [
   'ppc_74xx',
 ]
diff --git a/tests/functional/test_or1k_sim.py 
b/tests/functional/test_or1k_sim.py
new file mode 100755
index 00..aa2a1f08d2
--- /dev/null
+++ b/tests/functional/test_or1k_sim.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+#
+# Functional test that boots a Linux kernel on an OpenRISC-1000 SIM machine
+# and checks the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+
+from qemu_test import LinuxKernelTest, Asset
+from qemu_test.utils import archive_extract
+
+class OpenRISC1kSimTest(LinuxKernelTest):
+
+ASSET_DAY20 = Asset(
+'https://www.qemu-advent-calendar.org/2018/download/day20.tar.xz',
+'ff9d7dd7c6bdba325bd85ee85c02db61ff653e129558aeffe6aff55bffb6763a')
+
+def test_or1k_sim(self):
+self.set_machine('or1k-sim')
+file_path = self.ASSET_DAY20.fetch()
+archive_extract(file_path, self.workdir)
+self.vm.set_console()
+self.vm.add_args('-kernel', self.workdir + '/day20/vmlinux')
+self.vm.launch()
+self.wait_for_console_pattern('QEMU advent calendar')
+
+if __name__ == '__main__':
+LinuxKernelTest.main()
-- 
2.46.0




[PULL 21/22] tests/functional: Convert the multiprocess avocado test into a standalone test

2024-09-10 Thread Thomas Huth
This test handles both, aarch64 and x86_64, with the same test code
(apart from some initial setup), so don't split this file by target
but add a check for self.arch in the main test function.

Message-ID: <20240903051333.102494-1-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 tests/avocado/avocado_qemu/__init__.py |  10 ---
 tests/avocado/multiprocess.py  | 102 -
 tests/functional/meson.build   |   2 +
 tests/functional/test_multiprocess.py  | 100 
 4 files changed, 102 insertions(+), 112 deletions(-)
 delete mode 100644 tests/avocado/multiprocess.py
 create mode 100755 tests/functional/test_multiprocess.py

diff --git a/tests/avocado/avocado_qemu/__init__.py 
b/tests/avocado/avocado_qemu/__init__.py
index 0e4ecea7a0..93c3460242 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -307,16 +307,6 @@ def require_netdev(self, netdevname):
 if netdevhelp.find('\n' + netdevname + '\n') < 0:
 self.cancel('no support for user networking')
 
-def require_multiprocess(self):
-"""
-Test for the presence of the x-pci-proxy-dev which is required
-to support multiprocess.
-"""
-devhelp = run_cmd([self.qemu_bin,
-   '-M', 'none', '-device', 'help'])[0];
-if devhelp.find('x-pci-proxy-dev') < 0:
-self.cancel('no support for multiprocess device emulation')
-
 def _new_vm(self, name, *args):
 self._sd = tempfile.TemporaryDirectory(prefix="qemu_")
 vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir,
diff --git a/tests/avocado/multiprocess.py b/tests/avocado/multiprocess.py
deleted file mode 100644
index ee7490ae08..00
--- a/tests/avocado/multiprocess.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# Test for multiprocess qemu
-#
-# 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
-
-from avocado_qemu import QemuSystemTest
-from avocado_qemu import wait_for_console_pattern
-from avocado_qemu import exec_command
-from avocado_qemu import exec_command_and_wait_for_pattern
-
-class Multiprocess(QemuSystemTest):
-"""
-:avocado: tags=multiprocess
-"""
-KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
-
-def do_test(self, kernel_url, kernel_hash, initrd_url, initrd_hash,
-kernel_command_line, machine_type):
-"""Main test method"""
-self.require_accelerator('kvm')
-self.require_multiprocess()
-
-# Create socketpair to connect proxy and remote processes
-proxy_sock, remote_sock = socket.socketpair(socket.AF_UNIX,
-socket.SOCK_STREAM)
-os.set_inheritable(proxy_sock.fileno(), True)
-os.set_inheritable(remote_sock.fileno(), True)
-
-kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
-
-# Create remote process
-remote_vm = self.get_vm()
-remote_vm.add_args('-machine', 'x-remote')
-remote_vm.add_args('-nodefaults')
-remote_vm.add_args('-device', 'lsi53c895a,id=lsi1')
-remote_vm.add_args('-object', 'x-remote-object,id=robj1,'
-   'devid=lsi1,fd='+str(remote_sock.fileno()))
-remote_vm.launch()
-
-# Create proxy process
-self.vm.set_console()
-self.vm.add_args('-machine', machine_type)
-self.vm.add_args('-accel', 'kvm')
-self.vm.add_args('-cpu', 'host')
-self.vm.add_args('-object',
- 'memory-backend-memfd,id=sysmem-file,size=2G')
-self.vm.add_args('--numa', 'node,memdev=sysmem-file')
-self.vm.add_args('-m', '2048')
-self.vm.add_args('-kernel', kernel_path,
- '-initrd', initrd_path,
- '-append', kernel_command_line)
-self.vm.add_args('-device',
- 'x-pci-proxy-dev,'
- 'id=lsi1,fd='+str(proxy_sock.fileno()))
-self.vm.launch()
-wait_for_console_pattern(self, 'as init process',
- 'Kernel panic - not syncing')
-exec_command(self, 'mount -t sysfs sysfs /sys')
-exec_command_and_wait_for_pattern(self,
-   

[PULL 17/22] tests/functional: Convert Aarch64 Raspi4 avocado tests

2024-09-10 Thread Thomas Huth
From: Philippe Mathieu-Daudé 

Straight forward conversion. Update the SHA1 hashes to SHA256
hashes since SHA1 should not be used anymore nowadays.

Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240826221058.75126-5-phi...@linaro.org>
[thuth: Use LinuxKernelTest class]
Message-ID: <20240906180549.792832-12-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 MAINTAINERS |  1 +
 tests/avocado/boot_linux_console.py | 97 
 tests/functional/meson.build|  1 +
 tests/functional/test_aarch64_raspi4.py | 99 +
 4 files changed, 101 insertions(+), 97 deletions(-)
 create mode 100755 tests/functional/test_aarch64_raspi4.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 828c469478..c59f7b2538 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -913,6 +913,7 @@ F: include/hw/*/bcm283*
 F: docs/system/arm/raspi.rst
 F: tests/functional/test_arm_raspi2.py
 F: tests/functional/test_aarch64_raspi3.py
+F: tests/functional/test_aarch64_raspi4.py
 
 Real View
 M: Peter Maydell 
diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index e4caf34379..a8eac44d9f 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -203,103 +203,6 @@ def test_arm_emcraft_sf2(self):
 exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
 '3 packets transmitted, 3 packets received, 0% packet loss')
 
-def test_arm_raspi4(self):
-"""
-:avocado: tags=arch:aarch64
-:avocado: tags=machine:raspi4b
-:avocado: tags=device:pl011
-:avocado: tags=accel:tcg
-:avocado: tags=rpi4b
-
-The kernel can be rebuilt using the kernel source referenced
-and following the instructions on the on:
-https://www.raspberrypi.org/documentation/linux/kernel/building.md
-"""
-
-deb_url = ('http://archive.raspberrypi.org/debian/'
-'pool/main/r/raspberrypi-firmware/'
-'raspberrypi-kernel_1.20230106-1_arm64.deb')
-deb_hash = '08dc55696535b18a6d4fe6fa10d4c0d905cbb2ed'
-deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
-kernel_path = self.extract_from_deb(deb_path, '/boot/kernel8.img')
-dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2711-rpi-4-b.dtb')
-
-self.vm.set_console()
-kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
-   'earlycon=pl011,mmio32,0xfe201000 ' +
-   'console=ttyAMA0,115200 ' +
-   'root=/dev/mmcblk1p2 rootwait ' +
-   'dwc_otg.fiq_fsm_enable=0')
-self.vm.add_args('-kernel', kernel_path,
- '-dtb', dtb_path,
- '-append', kernel_command_line)
-# When PCI is supported we can add a USB controller:
-#'-device', 'qemu-xhci,bus=pcie.1,id=xhci',
-#'-device', 'usb-kbd,bus=xhci.0',
-self.vm.launch()
-console_pattern = 'Kernel command line: %s' % kernel_command_line
-self.wait_for_console_pattern(console_pattern)
-# When USB is enabled we can look for this
-# console_pattern = 'Product: QEMU USB Keyboard'
-# self.wait_for_console_pattern(console_pattern)
-console_pattern = 'Waiting for root device'
-self.wait_for_console_pattern(console_pattern)
-
-
-def test_arm_raspi4_initrd(self):
-"""
-:avocado: tags=arch:aarch64
-:avocado: tags=machine:raspi4b
-:avocado: tags=device:pl011
-:avocado: tags=accel:tcg
-:avocado: tags=rpi4b
-
-The kernel can be rebuilt using the kernel source referenced
-and following the instructions on the on:
-https://www.raspberrypi.org/documentation/linux/kernel/building.md
-"""
-deb_url = ('http://archive.raspberrypi.org/debian/'
-'pool/main/r/raspberrypi-firmware/'
-'raspberrypi-kernel_1.20230106-1_arm64.deb')
-deb_hash = '08dc55696535b18a6d4fe6fa10d4c0d905cbb2ed'
-deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
-kernel_path = self.extract_from_deb(deb_path, '/boot/kernel8.img')
-dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2711-rpi-4-b.dtb')
-
-initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
-  '86b2be1384d41c8c388e63078a847f1e1c4cb1de/rootfs/'
-  'arm64/rootfs.c

[PULL 22/22] tests/functional: Fix bad usage of has_cmd

2024-09-10 Thread Thomas Huth
has_cmd returns a tuple, not a boolean value. This fixes a crash when
e.g. "tesseract" is not available in the test_m68k_nextcube test.

Reported-by: Richard Henderson 
Message-ID: <20240910075820.51346-1-th...@redhat.com>
Reviewed-by: Daniel P. Berrangé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Thomas Huth 
---
 tests/functional/qemu_test/cmd.py   | 6 +++---
 tests/functional/qemu_test/tesseract.py | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/functional/qemu_test/cmd.py 
b/tests/functional/qemu_test/cmd.py
index 3acd617324..cbabb1ceed 100644
--- a/tests/functional/qemu_test/cmd.py
+++ b/tests/functional/qemu_test/cmd.py
@@ -187,7 +187,7 @@ def get_qemu_img(test):
 qemu_img = os.path.join(BUILD_DIR, 'qemu-img')
 if os.path.exists(qemu_img):
 return qemu_img
-if has_cmd('qemu-img'):
+(has_system_qemu_img, errmsg) = has_cmd('qemu-img')
+if has_system_qemu_img:
 return 'qemu-img'
-test.skipTest('Could not find "qemu-img", which is required to '
-  'create temporary images')
+test.skipTest(errmsg)
diff --git a/tests/functional/qemu_test/tesseract.py 
b/tests/functional/qemu_test/tesseract.py
index c4087b7c11..db441027b9 100644
--- a/tests/functional/qemu_test/tesseract.py
+++ b/tests/functional/qemu_test/tesseract.py
@@ -11,7 +11,8 @@
 from . import has_cmd, run_cmd
 
 def tesseract_available(expected_version):
-if not has_cmd('tesseract'):
+(has_tesseract, _) = has_cmd('tesseract')
+if not has_tesseract:
 return False
 (stdout, stderr, ret) = run_cmd([ 'tesseract', '--version'])
 if ret:
-- 
2.46.0




[PULL 11/22] tests/functional: Convert mips64el 5KEc Malta avocado tests

2024-09-10 Thread Thomas Huth
From: Philippe Mathieu-Daudé 

Straight forward conversion. Update the SHA1 hashes to
SHA256 hashes since SHA1 should not be used anymore nowadays.

Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240827094905.80648-5-phi...@linaro.org>
Message-ID: <20240906180549.792832-6-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 tests/avocado/boot_linux_console.py | 74 
 tests/functional/test_mips64el_malta.py | 76 +
 2 files changed, 76 insertions(+), 74 deletions(-)

diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index e1e20c36f7..84b31cb84e 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -138,38 +138,6 @@ def test_mips_malta(self):
 console_pattern = 'Kernel command line: %s' % kernel_command_line
 self.wait_for_console_pattern(console_pattern)
 
-def test_mips64el_malta(self):
-"""
-This test requires the ar tool to extract "data.tar.gz" from
-the Debian package.
-
-The kernel can be rebuilt using this Debian kernel source [1] and
-following the instructions on [2].
-
-[1] http://snapshot.debian.org/package/linux-2.6/2.6.32-48/
-#linux-source-2.6.32_2.6.32-48
-[2] https://kernel-team.pages.debian.net/kernel-handbook/
-ch-common-tasks.html#s-common-official
-
-:avocado: tags=arch:mips64el
-:avocado: tags=machine:malta
-"""
-deb_url = ('http://snapshot.debian.org/archive/debian/'
-   '20130217T032700Z/pool/main/l/linux-2.6/'
-   'linux-image-2.6.32-5-5kc-malta_2.6.32-48_mipsel.deb')
-deb_hash = '1aaec92083bf22fda31e0d27fa8d9a388e5fc3d5'
-deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
-kernel_path = self.extract_from_deb(deb_path,
-'/boot/vmlinux-2.6.32-5-5kc-malta')
-
-self.vm.set_console()
-kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
-self.vm.add_args('-kernel', kernel_path,
- '-append', kernel_command_line)
-self.vm.launch()
-console_pattern = 'Kernel command line: %s' % kernel_command_line
-self.wait_for_console_pattern(console_pattern)
-
 def test_mips_malta_cpio(self):
 """
 :avocado: tags=arch:mips
@@ -211,48 +179,6 @@ def test_mips_malta_cpio(self):
 # Wait for VM to shut down gracefully
 self.vm.wait()
 
-@skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
-def test_mips64el_malta_5KEc_cpio(self):
-"""
-:avocado: tags=arch:mips64el
-:avocado: tags=machine:malta
-:avocado: tags=endian:little
-:avocado: tags=cpu:5KEc
-"""
-kernel_url = ('https://github.com/philmd/qemu-testing-blob/'
-  'raw/9ad2df38/mips/malta/mips64el/'
-  'vmlinux-3.19.3.mtoman.20150408')
-kernel_hash = '00d1d268fb9f7d8beda1de6bebcc46e884d71754'
-kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-initrd_url = ('https://github.com/groeck/linux-build-test/'
-  'raw/8584a59e/rootfs/'
-  'mipsel64/rootfs.mipsel64r1.cpio.gz')
-initrd_hash = '1dbb8a396e916847325284dbe2151167'
-initrd_path_gz = self.fetch_asset(initrd_url, algorithm='md5',
-  asset_hash=initrd_hash)
-initrd_path = self.workdir + "rootfs.cpio"
-archive.gzip_uncompress(initrd_path_gz, initrd_path)
-
-self.vm.set_console()
-kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
-   + 'console=ttyS0 console=tty '
-   + 'rdinit=/sbin/init noreboot')
-self.vm.add_args('-kernel', kernel_path,
- '-initrd', initrd_path,
- '-append', kernel_command_line,
- '-no-reboot')
-self.vm.launch()
-wait_for_console_pattern(self, 'Boot successful.')
-
-exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
-'MIPS 5KE')
-exec_command_and_wait_for_pattern(self, 'uname -a',
-'3.19.3.mtoman.20150408')
-exec_command_and_wait_for_pattern(self, 'reboot',
- 

[PULL 04/22] contrib/plugins/Makefile: Add a 'distclean' target

2024-09-10 Thread Thomas Huth
Running "make distclean" in the build tree currently fails since this
tries to run the "distclean" target in the contrib/plugins/ folder, too,
but the Makefile there is missing this target. Thus add 'distclean' there
to fix this issue.

And to avoid regressions with "make distclean", add this command to one
of the build jobs, too.

Message-ID: <20240902154749.73876-1-th...@redhat.com>
Reviewed-by: Pierrick Bouvier 
Signed-off-by: Thomas Huth 
---
 .gitlab-ci.d/buildtest.yml | 2 ++
 contrib/plugins/Makefile   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index 9ac0776b94..98bac9e2c8 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -345,6 +345,8 @@ build-tcg-disabled:
 124 132 139 142 144 145 151 152 155 157 165 194 196 200 202
 208 209 216 218 227 234 246 247 248 250 254 255 257 258
 260 261 262 263 264 270 272 273 277 279 image-fleecing
+- cd ../..
+- make distclean
 
 build-user:
   extends: .native_build_job_template
diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
index edf256cd9d..05a2a45c5c 100644
--- a/contrib/plugins/Makefile
+++ b/contrib/plugins/Makefile
@@ -77,7 +77,7 @@ lib%$(SO_SUFFIX): %.o
 endif
 
 
-clean:
+clean distclean:
rm -f *.o *$(SO_SUFFIX) *.d
rm -Rf .libs
 
-- 
2.46.0




[PULL 09/22] tests/functional: Convert mips64el Fuloong2e avocado test (2/2)

2024-09-10 Thread Thomas Huth
From: Philippe Mathieu-Daudé 

Straight forward conversion. Update the SHA1 hashes to
SHA256 hashes since SHA1 should not be used anymore nowadays.

Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240827094905.80648-3-phi...@linaro.org>
[thuth: Use LinuxKernelTest class for this test]
Message-ID: <20240906180549.792832-4-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 tests/avocado/boot_linux_console.py | 21 -
 tests/functional/test_mips64el_fuloong2e.py | 25 ++---
 2 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index 396836bf64..e1e20c36f7 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -170,27 +170,6 @@ def test_mips64el_malta(self):
 console_pattern = 'Kernel command line: %s' % kernel_command_line
 self.wait_for_console_pattern(console_pattern)
 
-def test_mips64el_fuloong2e(self):
-"""
-:avocado: tags=arch:mips64el
-:avocado: tags=machine:fuloong2e
-:avocado: tags=endian:little
-"""
-deb_url = ('http://archive.debian.org/debian/pool/main/l/linux/'
-   
'linux-image-3.16.0-6-loongson-2e_3.16.56-1+deb8u1_mipsel.deb')
-deb_hash = 'd04d446045deecf7b755ef576551de0c4184dd44'
-deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
-kernel_path = self.extract_from_deb(deb_path,
-
'/boot/vmlinux-3.16.0-6-loongson-2e')
-
-self.vm.set_console()
-kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
-self.vm.add_args('-kernel', kernel_path,
- '-append', kernel_command_line)
-self.vm.launch()
-console_pattern = 'Kernel command line: %s' % kernel_command_line
-self.wait_for_console_pattern(console_pattern)
-
 def test_mips_malta_cpio(self):
 """
 :avocado: tags=arch:mips
diff --git a/tests/functional/test_mips64el_fuloong2e.py 
b/tests/functional/test_mips64el_fuloong2e.py
index 7688a32713..a32d5f9d08 100755
--- a/tests/functional/test_mips64el_fuloong2e.py
+++ b/tests/functional/test_mips64el_fuloong2e.py
@@ -12,14 +12,33 @@
 import os
 import subprocess
 
-from qemu_test import QemuSystemTest
+from qemu_test import LinuxKernelTest, Asset
 from qemu_test import wait_for_console_pattern
 from unittest import skipUnless
 
-class MipsFuloong2e(QemuSystemTest):
+class MipsFuloong2e(LinuxKernelTest):
 
 timeout = 60
 
+ASSET_KERNEL = Asset(
+('http://archive.debian.org/debian/pool/main/l/linux/'
+ 'linux-image-3.16.0-6-loongson-2e_3.16.56-1+deb8u1_mipsel.deb'),
+'2a70f15b397f4ced632b0c15cb22660394190644146d804d60a4796eefbe1f50')
+
+def test_linux_kernel_3_16(self):
+deb_path = self.ASSET_KERNEL.fetch()
+kernel_path = self.extract_from_deb(deb_path,
+
'/boot/vmlinux-3.16.0-6-loongson-2e')
+
+self.set_machine('fuloong2e')
+self.vm.set_console()
+kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
+self.vm.add_args('-kernel', kernel_path,
+ '-append', kernel_command_line)
+self.vm.launch()
+console_pattern = 'Kernel command line: %s' % kernel_command_line
+self.wait_for_console_pattern(console_pattern)
+
 @skipUnless(os.getenv('QEMU_TEST_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
 @skipUnless(os.getenv('RESCUE_YL_PATH'), 'RESCUE_YL_PATH not available')
 def test_linux_kernel_2_6_27_isa_serial(self):
@@ -42,4 +61,4 @@ def test_linux_kernel_2_6_27_isa_serial(self):
 
 
 if __name__ == '__main__':
-QemuSystemTest.main()
+LinuxKernelTest.main()
-- 
2.46.0




[PULL 07/22] tests/functional: Add the LinuxKernelTest for testing the Linux boot process

2024-09-10 Thread Thomas Huth
Copy the LinuxKernelTest from tests/acceptance/boot_linux_console.py
to be able to convert the related tests to the functional test framework
in the following patches.

Message-ID: <20240906180549.792832-2-th...@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Thomas Huth 
---
 tests/functional/qemu_test/__init__.py|  1 +
 tests/functional/qemu_test/linuxkernel.py | 41 +++
 2 files changed, 42 insertions(+)
 create mode 100644 tests/functional/qemu_test/linuxkernel.py

diff --git a/tests/functional/qemu_test/__init__.py 
b/tests/functional/qemu_test/__init__.py
index f33282efe8..67f87be9c4 100644
--- a/tests/functional/qemu_test/__init__.py
+++ b/tests/functional/qemu_test/__init__.py
@@ -12,3 +12,4 @@
 interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
 exec_command, exec_command_and_wait_for_pattern, get_qemu_img
 from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest
+from .linuxkernel import LinuxKernelTest
diff --git a/tests/functional/qemu_test/linuxkernel.py 
b/tests/functional/qemu_test/linuxkernel.py
new file mode 100644
index 00..fdd5307629
--- /dev/null
+++ b/tests/functional/qemu_test/linuxkernel.py
@@ -0,0 +1,41 @@
+# Test class for testing the boot process of a Linux kernel
+#
+# 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
+
+from .testcase import QemuSystemTest
+from .cmd import run_cmd, wait_for_console_pattern
+from .utils import archive_extract
+
+class LinuxKernelTest(QemuSystemTest):
+KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+
+def wait_for_console_pattern(self, success_message, vm=None):
+wait_for_console_pattern(self, success_message,
+ failure_message='Kernel panic - not syncing',
+ vm=vm)
+
+def extract_from_deb(self, deb_path, path):
+"""
+Extracts a file from a deb package into the test workdir
+
+:param deb_path: path to the deb archive
+:param path: path within the deb archive of the file to be extracted
+:returns: path of the extracted file
+"""
+cwd = os.getcwd()
+os.chdir(self.workdir)
+(stdout, stderr, ret) = run_cmd(['ar', 't', deb_path])
+file_path = stdout.split()[2]
+run_cmd(['ar', 'x', deb_path, file_path])
+archive_extract(file_path, self.workdir)
+os.chdir(cwd)
+# Return complete path to extracted file.  Because callers to
+# extract_from_deb() specify 'path' with a leading slash, it is
+# necessary to use os.path.relpath() as otherwise os.path.join()
+# interprets it as an absolute path and drops the self.workdir part.
+return os.path.normpath(os.path.join(self.workdir,
+ os.path.relpath(path, '/')))
+
-- 
2.46.0




[PULL 03/22] gitlab-ci: Build MSYS2 job using multiple CPUs

2024-09-10 Thread Thomas Huth
From: Philippe Mathieu-Daudé 

Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240819112141.13786-1-phi...@linaro.org>
Signed-off-by: Thomas Huth 
---
 .gitlab-ci.d/windows.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.d/windows.yml b/.gitlab-ci.d/windows.yml
index 759e9a76b5..45ed0c96fe 100644
--- a/.gitlab-ci.d/windows.yml
+++ b/.gitlab-ci.d/windows.yml
@@ -88,6 +88,7 @@ msys2-64bit:
   mingw-w64-x86_64-python
   mingw-w64-x86_64-zstd"
   - Write-Output "Running build at $(Get-Date -Format u)"
+  - $env:JOBS = $(.\msys64\usr\bin\bash -lc nproc)
   - $env:CHERE_INVOKING = 'yes'  # Preserve the current working directory
   - $env:MSYS = 'winsymlinks:native' # Enable native Windows symlink
   - $env:CCACHE_BASEDIR = "$env:CI_PROJECT_DIR"
@@ -99,7 +100,7 @@ msys2-64bit:
   - cd build
   - ..\msys64\usr\bin\bash -lc "ccache --zero-stats"
   - ..\msys64\usr\bin\bash -lc "../configure $CONFIGURE_ARGS"
-  - ..\msys64\usr\bin\bash -lc "make"
+  - ..\msys64\usr\bin\bash -lc "make -j$env:JOBS"
   - ..\msys64\usr\bin\bash -lc "make check MTESTARGS='$TEST_ARGS' || { cat 
meson-logs/testlog.txt; exit 1; } ;"
   - ..\msys64\usr\bin\bash -lc "ccache --show-stats"
   - Write-Output "Finished build at $(Get-Date -Format u)"
-- 
2.46.0




[PULL 13/22] tests/functional: Convert nanomips Malta avocado tests

2024-09-10 Thread Thomas Huth
From: Philippe Mathieu-Daudé 

Straight forward conversion. Update the SHA1 hashes to
SHA256 hashes since SHA1 should not be used anymore nowadays.

  $ QEMU_TEST_ALLOW_UNTRUSTED_CODE=1 \
make check-functional-mipsel
  ...
  ▶ 4/4 
test_mipsel_malta.MaltaMachineConsole.test_mips_malta32el_nanomips_16k_up   OK
  ▶ 4/4 test_mipsel_malta.MaltaMachineConsole.test_mips_malta32el_nanomips_4k   
OK
  ▶ 4/4 
test_mipsel_malta.MaltaMachineConsole.test_mips_malta32el_nanomips_64k_dbg  OK
  ▶ 4/4 test_mipsel_malta.MaltaMachineYAMON.test_mipsel_malta_yamon 
OK
  4/4 qemu:func-thorough+func-mipsel-thorough+thorough / 
func-mipsel-mipsel_malta   OK   9.95s   4 subtests passed

Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240827094905.80648-7-phi...@linaro.org>
[thuth: Use LinuxKernelTest]
Message-ID: <20240906180549.792832-8-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 tests/avocado/boot_linux_console.py   | 59 ---
 tests/functional/test_mipsel_malta.py | 51 ++-
 2 files changed, 50 insertions(+), 60 deletions(-)

diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index 84b31cb84e..34f4abadd0 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -179,65 +179,6 @@ def test_mips_malta_cpio(self):
 # Wait for VM to shut down gracefully
 self.vm.wait()
 
-def do_test_mips_malta32el_nanomips(self, kernel_path_xz):
-kernel_path = self.workdir + "kernel"
-with lzma.open(kernel_path_xz, 'rb') as f_in:
-with open(kernel_path, 'wb') as f_out:
-shutil.copyfileobj(f_in, f_out)
-
-self.vm.set_console()
-kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE
-   + 'mem=256m@@0x0 '
-   + 'console=ttyS0')
-self.vm.add_args('-no-reboot',
- '-kernel', kernel_path,
- '-append', kernel_command_line)
-self.vm.launch()
-console_pattern = 'Kernel command line: %s' % kernel_command_line
-self.wait_for_console_pattern(console_pattern)
-
-def test_mips_malta32el_nanomips_4k(self):
-"""
-:avocado: tags=arch:mipsel
-:avocado: tags=machine:malta
-:avocado: tags=endian:little
-:avocado: tags=cpu:I7200
-"""
-kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/'
-  'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
-  'generic_nano32r6el_page4k.xz')
-kernel_hash = '477456aafd2a0f1ddc9482727f20fe9575565dd6'
-kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-self.do_test_mips_malta32el_nanomips(kernel_path_xz)
-
-def test_mips_malta32el_nanomips_16k_up(self):
-"""
-:avocado: tags=arch:mipsel
-:avocado: tags=machine:malta
-:avocado: tags=endian:little
-:avocado: tags=cpu:I7200
-"""
-kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/'
-  'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
-  'generic_nano32r6el_page16k_up.xz')
-kernel_hash = 'e882868f944c71c816e832e2303b7874d044a7bc'
-kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-self.do_test_mips_malta32el_nanomips(kernel_path_xz)
-
-def test_mips_malta32el_nanomips_64k_dbg(self):
-"""
-:avocado: tags=arch:mipsel
-:avocado: tags=machine:malta
-:avocado: tags=endian:little
-:avocado: tags=cpu:I7200
-"""
-kernel_url = ('http://mipsdistros.mips.com/LinuxDistro/nanomips/'
-  'kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/'
-  'generic_nano32r6el_page64k_dbg.xz')
-kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180'
-kernel_path_xz = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-self.do_test_mips_malta32el_nanomips(kernel_path_xz)
-
 def test_aarch64_xlnx_versal_virt(self):
 """
 :avocado: tags=arch:aarch64
diff --git a/tests/functional/test_mipsel_malta.py 
b/tests/functional/test_mipsel_malta.py
index f31f96b012..b8dfddd856 100755
--- a/tests/functional/test_mipsel_malta.py
+++ b/tests/functional/test_mipsel_malta.py
@@ -11,12 +11,61 @@
 
 import os
 
-from qemu_test import QemuSystemTest, Asset
+from qemu_test import QemuSystemTest, LinuxKernelTest, Asset
 from qemu_test import interrupt_interactive_console_until_patter

[PULL 06/22] MAINTAINERS: Remove myself from the Meson section

2024-09-10 Thread Thomas Huth
The Meson section has plenty of reviewers, and in order to reduce the
load on my Inbox a little bit, I'm stepping back as a reviewer here.

Message-ID: <20240906155900.742157-1-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 MAINTAINERS | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8c7358fd5b..822f89847b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4212,7 +4212,6 @@ Meson
 M: Paolo Bonzini 
 R: Marc-André Lureau 
 R: Daniel P. Berrange 
-R: Thomas Huth 
 R: Philippe Mathieu-Daudé 
 S: Maintained
 F: meson.build
-- 
2.46.0




[PULL 00/22] Tests and misc patches

2024-09-10 Thread Thomas Huth
The following changes since commit 7bbadc60b58b742494555f06cd342311ddab9351:

  Merge tag 'crypto-fixes-pull-request' of https://gitlab.com/berrange/qemu 
into staging (2024-09-09 15:19:32 +0100)

are available in the Git repository at:

  https://gitlab.com/thuth/qemu.git tags/pull-request-2024-09-10

for you to fetch changes up to cc3e005eb22332ba277bff2e39025d0087f3795e:

  tests/functional: Fix bad usage of has_cmd (2024-09-10 13:44:42 +0200)


* Split --enable-sanitizers to --enable-{asan, ubsan}
* Build MSYS2 job using multiple CPUs
* Fix "make distclean" wrt contrib/plugins/
* Convert more Avocado tests to plain standalone functional tests
* Fix bug that breaks "make check-functional" when tesseract is missing


Beraldo Leal (1):
  MAINTAINERS: Remove myself as reviewer

Philippe Mathieu-Daudé (10):
  gitlab-ci: Build MSYS2 job using multiple CPUs
  tests/functional: Convert mips64el Fuloong2e avocado test (2/2)
  tests/functional: Convert mips64el I6400 Malta avocado tests
  tests/functional: Convert mips64el 5KEc Malta avocado tests
  tests/functional: Convert mips32el Malta YAMON avocado test
  tests/functional: Convert nanomips Malta avocado tests
  tests/functional: Convert mips32eb 4Kc Malta avocado tests
  tests/functional: Convert ARM Raspi2 avocado tests
  tests/functional: Convert Aarch64 Raspi3 avocado tests
  tests/functional: Convert Aarch64 Raspi4 avocado tests

Richard Henderson (2):
  meson: Split --enable-sanitizers to --enable-{asan, ubsan}
  meson: Move -fsanitize=undefined into normal configuraton

Thomas Huth (9):
  contrib/plugins/Makefile: Add a 'distclean' target
  MAINTAINERS: Remove myself from the Meson section
  tests/functional: Add the LinuxKernelTest for testing the Linux boot 
process
  tests/functional: Convert the m68k Q800 Avocado test into a functional 
test
  tests/functional: Convert the Alpha Clipper Avocado test
  tests/functional: Convert the m68k MCF5208EVB Avocado test
  tests/functional: Convert the or1k-sim Avocado test
  tests/functional: Convert the multiprocess avocado test into a standalone 
test
  tests/functional: Fix bad usage of has_cmd

 MAINTAINERS|  12 +-
 docs/devel/testing/fuzzing.rst |   4 +-
 meson.build|  26 +-
 tests/qtest/fdc-test.c |   2 +-
 .gitlab-ci.d/buildtest.yml |  12 +-
 .../custom-runners/ubuntu-22.04-aarch64.yml|   2 +-
 .gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml |   2 +-
 .gitlab-ci.d/windows.yml   |   3 +-
 contrib/plugins/Makefile   |   2 +-
 meson_options.txt  |   6 +-
 scripts/meson-buildoptions.sh  |   9 +-
 tests/avocado/avocado_qemu/__init__.py |  10 -
 tests/avocado/boot_linux_console.py| 483 -
 tests/avocado/machine_mips_malta.py| 162 ---
 tests/avocado/multiprocess.py  | 102 -
 tests/docker/test-debug|   4 +-
 tests/functional/meson.build   |  26 +-
 tests/functional/qemu_test/__init__.py |   1 +
 tests/functional/qemu_test/cmd.py  |   6 +-
 tests/functional/qemu_test/linuxkernel.py  |  41 ++
 tests/functional/qemu_test/tesseract.py|   3 +-
 tests/functional/test_aarch64_raspi3.py|  41 ++
 tests/functional/test_aarch64_raspi4.py|  99 +
 tests/functional/test_alpha_clipper.py |  38 ++
 tests/functional/test_arm_raspi2.py|  95 
 tests/functional/test_m68k_mcf5208evb.py   |  29 ++
 tests/functional/test_m68k_q800.py |  37 ++
 tests/functional/test_mips64el_fuloong2e.py|  25 +-
 tests/functional/test_mips64el_malta.py| 186 
 tests/functional/test_mips_malta.py|  81 
 tests/functional/test_mipsel_malta.py  |  96 
 tests/functional/test_multiprocess.py  | 100 +
 tests/functional/test_or1k_sim.py  |  29 ++
 33 files changed, 978 insertions(+), 796 deletions(-)
 delete mode 100644 tests/avocado/machine_mips_malta.py
 delete mode 100644 tests/avocado/multiprocess.py
 create mode 100644 tests/functional/qemu_test/linuxkernel.py
 create mode 100755 tests/functional/test_aarch64_raspi3.py
 create mode 100755 tests/functional/test_aarch64_raspi4.py
 create mode 100755 tests/functional/test_alpha_clipper.py
 create mode 100755 tests/functional/test_arm_raspi2.py
 create mode 100755 tests/functional/test_m68k_mcf5208evb.py
 create mode 100755 tests/f

[PULL 16/22] tests/functional: Convert Aarch64 Raspi3 avocado tests

2024-09-10 Thread Thomas Huth
From: Philippe Mathieu-Daudé 

Straight forward conversion. Update the SHA1 hashes to SHA256
hashes since SHA1 should not be used anymore nowadays.

Signed-off-by: Philippe Mathieu-Daudé 
Message-ID: <20240826221058.75126-4-phi...@linaro.org>
[thuth: Use the LinuxKernelTest class]
Message-ID: <20240906180549.792832-11-th...@redhat.com>
Signed-off-by: Thomas Huth 
---
 MAINTAINERS |  1 +
 tests/avocado/boot_linux_console.py | 23 --
 tests/functional/meson.build|  1 +
 tests/functional/test_aarch64_raspi3.py | 41 +
 4 files changed, 43 insertions(+), 23 deletions(-)
 create mode 100755 tests/functional/test_aarch64_raspi3.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 3cc9c19d02..828c469478 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -912,6 +912,7 @@ F: include/hw/arm/rasp*
 F: include/hw/*/bcm283*
 F: docs/system/arm/raspi.rst
 F: tests/functional/test_arm_raspi2.py
+F: tests/functional/test_aarch64_raspi3.py
 
 Real View
 M: Peter Maydell 
diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index 827a286429..e4caf34379 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -979,29 +979,6 @@ def test_arm_orangepi_uboot_netbsd9(self):
 # Wait for user-space
 wait_for_console_pattern(self, 'Starting root file system check')
 
-def test_aarch64_raspi3_atf(self):
-"""
-:avocado: tags=accel:tcg
-:avocado: tags=arch:aarch64
-:avocado: tags=machine:raspi3b
-:avocado: tags=cpu:cortex-a53
-:avocado: tags=device:pl011
-:avocado: tags=atf
-"""
-zip_url = ('https://github.com/pbatard/RPi3/releases/download/'
-   'v1.15/RPi3_UEFI_Firmware_v1.15.zip')
-zip_hash = '74b3bd0de92683cadb14e008a7575e1d0c3cafb9'
-zip_path = self.fetch_asset(zip_url, asset_hash=zip_hash)
-
-archive.extract(zip_path, self.workdir)
-efi_fd = os.path.join(self.workdir, 'RPI_EFI.fd')
-
-self.vm.set_console(console_index=1)
-self.vm.add_args('-nodefaults',
- '-device', 'loader,file=%s,force-raw=true' % efi_fd)
-self.vm.launch()
-self.wait_for_console_pattern('version UEFI Firmware v1.15')
-
 def test_alpha_clipper(self):
 """
 :avocado: tags=arch:alpha
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index ff3fe7981e..35eebbe9b9 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -35,6 +35,7 @@ tests_generic_bsduser = [
 ]
 
 tests_aarch64_system_thorough = [
+  'aarch64_raspi3',
   'aarch64_sbsaref',
   'aarch64_virt',
 ]
diff --git a/tests/functional/test_aarch64_raspi3.py 
b/tests/functional/test_aarch64_raspi3.py
new file mode 100755
index 00..369f95a3d9
--- /dev/null
+++ b/tests/functional/test_aarch64_raspi3.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python3
+#
+# Functional test that boots a Linux kernel on a Raspberry Pi machine
+# and checks the console
+#
+# Copyright (c) 2020 Philippe Mathieu-Daudé 
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+from zipfile import ZipFile
+
+from qemu_test import LinuxKernelTest, Asset
+
+
+class Aarch64Raspi3Machine(LinuxKernelTest):
+
+ASSET_RPI3_UEFI = Asset(
+('https://github.com/pbatard/RPi3/releases/download/'
+ 'v1.15/RPi3_UEFI_Firmware_v1.15.zip'),
+'8cff2e979560048b4c84921f41a91893240b9fb71a88f0b5c5d6c8edd994bd5b')
+
+def test_aarch64_raspi3_atf(self):
+efi_name = 'RPI_EFI.fd'
+zip_path = self.ASSET_RPI3_UEFI.fetch()
+
+with ZipFile(zip_path, 'r') as zf:
+ zf.extract(efi_name, path=self.workdir)
+efi_fd = os.path.join(self.workdir, efi_name)
+
+self.set_machine('raspi3b')
+self.vm.set_console(console_index=1)
+self.vm.add_args('-cpu', 'cortex-a53',
+ '-nodefaults',
+ '-device', f'loader,file={efi_fd},force-raw=true')
+self.vm.launch()
+self.wait_for_console_pattern('version UEFI Firmware v1.15')
+
+
+if __name__ == '__main__':
+LinuxKernelTest.main()
-- 
2.46.0




[PULL 02/22] meson: Move -fsanitize=undefined into normal configuraton

2024-09-10 Thread Thomas Huth
From: Richard Henderson 

With 8e466dd09246 and 23ef50ae2d0c, we disable function pointer
sanitization in CI because the qemu code base does not support it.
We must disable this for normal usage of --enable-ubsan as well,
so move it there.

Append options rather than prepend, since all of this requires
proper ordering of options.

Signed-off-by: Richard Henderson 
Reviewed-by: Thomas Huth 
Message-ID: <20240813095216.306555-3-richard.hender...@linaro.org>
Signed-off-by: Thomas Huth 
---
 meson.build| 11 +--
 .gitlab-ci.d/buildtest.yml | 10 --
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/meson.build b/meson.build
index f6b8060b72..4701ee3aab 100644
--- a/meson.build
+++ b/meson.build
@@ -493,8 +493,15 @@ if get_option('ubsan')
   # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
   if cc.links('int main(int argc, char **argv) { return argc + 1; }',
   args: [qemu_ldflags, '-fsanitize=undefined'])
-qemu_cflags = ['-fsanitize=undefined'] + qemu_cflags
-qemu_ldflags = ['-fsanitize=undefined'] + qemu_ldflags
+qemu_cflags += ['-fsanitize=undefined']
+qemu_ldflags += ['-fsanitize=undefined']
+
+# Suppress undefined behaviour from function call to mismatched type.
+# In addition, tcg prologue does not emit function type prefix
+# required by function call sanitizer.
+if cc.has_argument('-fno-sanitize=function')
+  qemu_cflags += ['-fno-sanitize=function']
+endif
   else
 error('Your compiler does not support -fsanitize=undefined')
   endif
diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index 1d2afae996..9ac0776b94 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -428,9 +428,8 @@ clang-system:
 job: amd64-fedora-container
   variables:
 IMAGE: fedora
-CONFIGURE_ARGS: --cc=clang --cxx=clang++
-  --extra-cflags=-fsanitize=undefined 
--extra-cflags=-fno-sanitize-recover=undefined
-  --extra-cflags=-fno-sanitize=function
+CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-ubsan
+  --extra-cflags=-fno-sanitize-recover=undefined
 TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu 
s390x-softmmu
 MAKE_CHECK_ARGS: check-qtest check-tcg
 
@@ -441,10 +440,9 @@ clang-user:
   timeout: 70m
   variables:
 IMAGE: debian-all-test-cross
-CONFIGURE_ARGS: --cc=clang --cxx=clang++ --disable-system
+CONFIGURE_ARGS: --cc=clang --cxx=clang++ --disable-system --enable-ubsan
   
--target-list-exclude=alpha-linux-user,microblazeel-linux-user,aarch64_be-linux-user,i386-linux-user,m68k-linux-user,mipsn32el-linux-user,xtensaeb-linux-user
-  --extra-cflags=-fsanitize=undefined 
--extra-cflags=-fno-sanitize-recover=undefined
-  --extra-cflags=-fno-sanitize=function
+  --extra-cflags=-fno-sanitize-recover=undefined
 MAKE_CHECK_ARGS: check-unit check-tcg
 
 # Set LD_JOBS=1 because this requires LTO and ld consumes a large amount of 
memory.
-- 
2.46.0




[PULL 19/22] tests/functional: Convert the m68k MCF5208EVB Avocado test

2024-09-10 Thread Thomas Huth
We've got to do_test_advcal_2018() here now that the test resides
in a separate file. Also switch back to the original URL (since
the site did not vanish as originally expected) and update the
hashsum to use SHA256.

Message-ID: <20240906180549.792832-14-th...@redhat.com>
Tested-by: Philippe Mathieu-Daudé 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Thomas Huth 
---
 tests/avocado/boot_linux_console.py  |  8 ---
 tests/functional/meson.build |  1 +
 tests/functional/test_m68k_mcf5208evb.py | 29 
 3 files changed, 30 insertions(+), 8 deletions(-)
 create mode 100755 tests/functional/test_m68k_mcf5208evb.py

diff --git a/tests/avocado/boot_linux_console.py 
b/tests/avocado/boot_linux_console.py
index 75aab90320..db72bd1b5e 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -927,14 +927,6 @@ def test_arm_ast2600_debian(self):
 self.wait_for_console_pattern("SMP: Total of 2 processors activated")
 self.wait_for_console_pattern("No filesystem could mount root")
 
-def test_m68k_mcf5208evb(self):
-"""
-:avocado: tags=arch:m68k
-:avocado: tags=machine:mcf5208evb
-"""
-tar_hash = 'ac688fd00561a2b6ce1359f9ff6aa2b98c9a570c'
-self.do_test_advcal_2018('07', tar_hash, 'sanity-clause.elf')
-
 def test_or1k_sim(self):
 """
 :avocado: tags=arch:or1k
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index e1903132a1..8f9694244f 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -64,6 +64,7 @@ tests_loongarch64_system_thorough = [
 ]
 
 tests_m68k_system_thorough = [
+  'm68k_mcf5208evb',
   'm68k_nextcube',
   'm68k_q800',
 ]
diff --git a/tests/functional/test_m68k_mcf5208evb.py 
b/tests/functional/test_m68k_mcf5208evb.py
new file mode 100755
index 00..869ccc88df
--- /dev/null
+++ b/tests/functional/test_m68k_mcf5208evb.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+#
+# Functional test that boots a Linux kernel on an MCF5208EVB machine
+# and checks the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+
+from qemu_test import LinuxKernelTest, Asset
+from qemu_test.utils import archive_extract
+
+class Mcf5208EvbTest(LinuxKernelTest):
+
+ASSET_DAY07 = Asset(
+'https://www.qemu-advent-calendar.org/2018/download/day07.tar.xz',
+'753c2f3837126b7c6ba92d0b1e0b156e8a2c5131d2d576bb0b9a763fae73c08a')
+
+def test_m68k_mcf5208evb(self):
+self.set_machine('mcf5208evb')
+file_path = self.ASSET_DAY07.fetch()
+archive_extract(file_path, self.workdir)
+self.vm.set_console()
+self.vm.add_args('-kernel', self.workdir + '/day07/sanity-clause.elf')
+self.vm.launch()
+self.wait_for_console_pattern('QEMU advent calendar')
+
+if __name__ == '__main__':
+LinuxKernelTest.main()
-- 
2.46.0




[PULL 01/22] meson: Split --enable-sanitizers to --enable-{asan, ubsan}

2024-09-10 Thread Thomas Huth
From: Richard Henderson 

We do not always want both address and undefined behavior
sanitizers running at the same time.

For the gitlab custom-runners, drop to only --enable-ubsan.
These jobs are not run by default, but as will be obvious in the
next patch, we don't run ASan on x86 either, and it seems wrong
to hold aarch64 and s390x to a different standard.

Signed-off-by: Richard Henderson 
Reviewed-by: Thomas Huth 
Message-ID: <20240813095216.306555-2-richard.hender...@linaro.org>
Signed-off-by: Thomas Huth 
---
 docs/devel/testing/fuzzing.rst|  4 ++--
 meson.build   | 15 +++
 tests/qtest/fdc-test.c|  2 +-
 .../custom-runners/ubuntu-22.04-aarch64.yml   |  2 +-
 .../custom-runners/ubuntu-22.04-s390x.yml |  2 +-
 meson_options.txt |  6 --
 scripts/meson-buildoptions.sh |  9 ++---
 tests/docker/test-debug   |  4 ++--
 8 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/docs/devel/testing/fuzzing.rst b/docs/devel/testing/fuzzing.rst
index 3bfcb33fc4..dfe1973cf8 100644
--- a/docs/devel/testing/fuzzing.rst
+++ b/docs/devel/testing/fuzzing.rst
@@ -24,8 +24,8 @@ Configure with (substitute the clang binaries with the 
version you installed).
 Here, enable-sanitizers, is optional but it allows us to reliably detect bugs
 such as out-of-bounds accesses, use-after-frees, double-frees etc.::
 
-CC=clang-8 CXX=clang++-8 /path/to/configure --enable-fuzzing \
---enable-sanitizers
+CC=clang-8 CXX=clang++-8 /path/to/configure \
+--enable-fuzzing --enable-asan --enable-ubsan
 
 Fuzz targets are built similarly to system targets::
 
diff --git a/meson.build b/meson.build
index fbda17c987..f6b8060b72 100644
--- a/meson.build
+++ b/meson.build
@@ -479,24 +479,31 @@ if get_option('safe_stack') and coroutine_backend != 
'ucontext'
   error('SafeStack is only supported with the ucontext coroutine backend')
 endif
 
-if get_option('sanitizers')
+if get_option('asan')
   if cc.has_argument('-fsanitize=address')
 qemu_cflags = ['-fsanitize=address'] + qemu_cflags
 qemu_ldflags = ['-fsanitize=address'] + qemu_ldflags
+  else
+error('Your compiler does not support -fsanitize=address')
   endif
+endif
 
-  # Detect static linking issue with ubsan - 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
+if get_option('ubsan')
+  # Detect static linking issue with ubsan:
+  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
   if cc.links('int main(int argc, char **argv) { return argc + 1; }',
   args: [qemu_ldflags, '-fsanitize=undefined'])
 qemu_cflags = ['-fsanitize=undefined'] + qemu_cflags
 qemu_ldflags = ['-fsanitize=undefined'] + qemu_ldflags
+  else
+error('Your compiler does not support -fsanitize=undefined')
   endif
 endif
 
 # Thread sanitizer is, for now, much noisier than the other sanitizers;
 # keep it separate until that is not the case.
 if get_option('tsan')
-  if get_option('sanitizers')
+  if get_option('asan') or get_option('ubsan')
 error('TSAN is not supported with other sanitizers')
   endif
   if not cc.has_function('__tsan_create_fiber',
@@ -2516,7 +2523,7 @@ if rdma.found()
 endif
 
 have_asan_fiber = false
-if get_option('sanitizers') and \
+if get_option('asan') and \
not cc.has_function('__sanitizer_start_switch_fiber',
  args: '-fsanitize=address',
  prefix: '#include ')
diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c
index 5e8fbda9df..8645b080f7 100644
--- a/tests/qtest/fdc-test.c
+++ b/tests/qtest/fdc-test.c
@@ -552,7 +552,7 @@ static bool qtest_check_clang_sanitizer(void)
 #ifdef QEMU_SANITIZE_ADDRESS
 return true;
 #else
-g_test_skip("QEMU not configured using --enable-sanitizers");
+g_test_skip("QEMU not configured using --enable-asan");
 return false;
 #endif
 }
diff --git a/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml 
b/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml
index 263a3c2140..ca2f140471 100644
--- a/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml
+++ b/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml
@@ -103,7 +103,7 @@ ubuntu-22.04-aarch64-clang:
  script:
  - mkdir build
  - cd build
- - ../configure --disable-libssh --cc=clang --cxx=clang++ --enable-sanitizers
+ - ../configure --disable-libssh --cc=clang --cxx=clang++ --enable-ubsan
|| { cat config.log meson-logs/meson-log.txt; exit 1; }
  - make --output-sync -j`nproc --ignore=40`
  - make --output-sync -j`nproc --ignore=40` check
diff --

Re: [PATCH 2/2] .gitlab-ci.d/crossbuilds.yml: Force 'make check' single threaded for cross-i686-tci

2024-09-10 Thread Thomas Huth

On 06/09/2024 20.07, Peter Maydell wrote:

The cross-i686-tci CI job is persistently flaky with various tests
hitting timeouts.  One theory for why this is happening is that we're
running too many tests in parallel and so sometimes a test gets
starved of CPU and isn't able to complete within the timeout.

Set the MESON_TESTTHREADS environment variable to 1 for this job;
this will cause 'meson test' to run only one test at a time.

(Note that this relies on the change to meson2make that makes it
honour MESON_TESTTHREADS; otherwise it will have no effect.)

Signed-off-by: Peter Maydell 
---
Seems worth a try -- if this doesn't have an effect then
we can revert it, but we'll at least have determined what
the problem isn't...
---
  .gitlab-ci.d/crossbuilds.yml | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index cb499e4ee0d..ca1db011b11 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -70,6 +70,9 @@ cross-i686-tci:
  ACCEL: tcg-interpreter
  EXTRA_CONFIGURE_OPTS: 
--target-list=i386-softmmu,i386-linux-user,aarch64-softmmu,aarch64-linux-user,ppc-softmmu,ppc-linux-user
 --disable-plugins --disable-kvm
  MAKE_CHECK_ARGS: check check-tcg
+# Force 'meson test' to run only one test at once, to
+# see whether this reduces the flakiness of this CI job.
+MESON_TESTTHREADS: 1


Can't we simply add "-j1" to the MAKE_CHECK_ARGS line?

According to the man-page of "make":

 "If there is more than one -j option, the last one is effective."

So adding a -j1 should override the previous setting, I think.

 Thomas





Re: [PATCH 5/5] license: Update deprecated SPDX tag GPL-2.0 to GPL-2.0-only

2024-09-10 Thread Thomas Huth

On 10/09/2024 14.04, Philippe Mathieu-Daudé wrote:

On 10/9/24 13:51, Philippe Mathieu-Daudé wrote:

The 'GPL-2.0' license identifier has been deprecated since license
list version 3.0 [1] and replaced by the 'GPL-2.0-only' tag [2].

[1] https://spdx.org/licenses/GPL-2.0.html
[2] https://spdx.org/licenses/GPL-2.0-only.html

Mechanical patch running:

   $ sed -i -e s/GPL-2.0/GPL-2.0-only/ \
 $(git grep -l 'SPDX-License-Identifier: GPL-2.0$')


This didn't catch the full list, this command does:

   $ sed -i -e s/GPL-2.0/GPL-2.0-only/ \
     $(git grep -lE 'SPDX-License-Identifier: GPL-2.0( \*|$)' \
     | egrep -v '^linux-headers|^include/standard-headers')

Thus squashing:

-- >8 --
diff --git a/hw/net/igb_regs.h b/hw/net/igb_regs.h
index e5a47eab64..4dc4c31da2 100644
--- a/hw/net/igb_regs.h
+++ b/hw/net/igb_regs.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
  /*
   * This is copied + edited from kernel header files in
   * drivers/net/ethernet/intel/igb
diff --git a/tests/tcg/loongarch64/system/regdef.h 
b/tests/tcg/loongarch64/system/regdef.h

index faa09b2377..b586b4e86d 100644
--- a/tests/tcg/loongarch64/system/regdef.h
+++ b/tests/tcg/loongarch64/system/regdef.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
  /*
   * Copyright (c) 2021 Loongson Technology Corporation Limited
   */


Looks good, you can keep:
Reviewed-by: Thomas Huth 





Re: [PATCH 5/5] license: Update deprecated SPDX tag GPL-2.0 to GPL-2.0-only

2024-09-10 Thread Thomas Huth

On 10/09/2024 13.51, Philippe Mathieu-Daudé wrote:

The 'GPL-2.0' license identifier has been deprecated since license
list version 3.0 [1] and replaced by the 'GPL-2.0-only' tag [2].

[1] https://spdx.org/licenses/GPL-2.0.html
[2] https://spdx.org/licenses/GPL-2.0-only.html

Mechanical patch running:

   $ sed -i -e s/GPL-2.0/GPL-2.0-only/ \
 $(git grep -l 'SPDX-License-Identifier: GPL-2.0$')

Signed-off-by: Philippe Mathieu-Daudé 
---


Reviewed-by: Thomas Huth 





Re: [PATCH 4/5] license: Update deprecated SPDX tag GPL-2.0+ to GPL-2.0-or-later

2024-09-10 Thread Thomas Huth

On 10/09/2024 13.51, Philippe Mathieu-Daudé wrote:

The 'GPL-2.0+' license identifier has been deprecated since license
list version 2.0rc2 [1] and replaced by the 'GPL-2.0-or-later' [2]
tag.

[1] https://spdx.org/licenses/GPL-2.0+.html
[2] https://spdx.org/licenses/GPL-2.0-or-later.html

Mechanical patch running:

   $ sed -i -e s/GPL-2.0+/GPL-2.0-or-later/ \
 $(git grep -l 'SPDX-License-Identifier: GPL-2.0+$')

Signed-off-by: Philippe Mathieu-Daudé 
---


Reviewed-by: Thomas Huth 





Re: [PATCH 3/5] license: Update deprecated SPDX tag LGPL-2.0+ to LGPL-2.0-or-later

2024-09-10 Thread Thomas Huth

On 10/09/2024 13.51, Philippe Mathieu-Daudé wrote:

The 'LGPL-2.0+' license identifier has been deprecated since license
list version 2.0rc2 [1] and replaced by the 'LGPL-2.0-or-later' [2]
tag.

[1] https://spdx.org/licenses/LGPL-2.0+.html
[2] https://spdx.org/licenses/LGPL-2.0-or-later.html

Mechanical patch running:

   $ sed -i -e s/LGPL-2.0+/LGPL-2.0-or-later/ \
 $(git grep -l 'SPDX-License-Identifier: LGPL-2.0+$')

Signed-off-by: Philippe Mathieu-Daudé 
---


Reviewed-by: Thomas Huth 





Re: [PATCH 1/5] NSIS: Simplify license description

2024-09-10 Thread Thomas Huth

On 10/09/2024 13.51, Philippe Mathieu-Daudé wrote:

Since the "2 | 3+" expression can be simplified as "2+",
it is pointless to mention the GPLv3 license.

Add the corresponding SPDX identifier to remove all doubt.

Signed-off-by: Philippe Mathieu-Daudé 
---
  qemu.nsi | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)


Reviewed-by: Thomas Huth 




Re: [PATCH 2/5] tests/functional: Correct typo in test_netdev_ethtool.py SPDX tag

2024-09-10 Thread Thomas Huth

On 10/09/2024 13.51, Philippe Mathieu-Daudé wrote:

Cc: Alex Bennée 
Fixes: 9f95111474 ("tests/avocado: re-factor igb test to avoid timeouts")
Signed-off-by: Philippe Mathieu-Daudé 
---
  tests/functional/test_netdev_ethtool.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/functional/test_netdev_ethtool.py 
b/tests/functional/test_netdev_ethtool.py
index d5b911c918..ee1a397bd2 100755
--- a/tests/functional/test_netdev_ethtool.py
+++ b/tests/functional/test_netdev_ethtool.py
@@ -5,7 +5,7 @@
  # This test leverages ethtool's --test sequence to validate network
  # device behaviour.
  #
-# SPDX-License-Identifier: GPL-2.0-or-late
+# SPDX-License-Identifier: GPL-2.0-or-later
  
  from unittest import skip

  from qemu_test import QemuSystemTest, Asset


Reviewed-by: Thomas Huth 




[PATCH] tests/functional: Fix bad usage of has_cmd

2024-09-10 Thread Thomas Huth
has_cmd returns a tuple, not a boolean value. This fixes a crash when
e.g. "tesseract" is not available in the test_m68k_nextcube test.

Reported-by: Richard Henderson 
Signed-off-by: Thomas Huth 
---
 tests/functional/qemu_test/cmd.py   | 6 +++---
 tests/functional/qemu_test/tesseract.py | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/functional/qemu_test/cmd.py 
b/tests/functional/qemu_test/cmd.py
index 3acd617324..cbabb1ceed 100644
--- a/tests/functional/qemu_test/cmd.py
+++ b/tests/functional/qemu_test/cmd.py
@@ -187,7 +187,7 @@ def get_qemu_img(test):
 qemu_img = os.path.join(BUILD_DIR, 'qemu-img')
 if os.path.exists(qemu_img):
 return qemu_img
-if has_cmd('qemu-img'):
+(has_system_qemu_img, errmsg) = has_cmd('qemu-img')
+if has_system_qemu_img:
 return 'qemu-img'
-test.skipTest('Could not find "qemu-img", which is required to '
-  'create temporary images')
+test.skipTest(errmsg)
diff --git a/tests/functional/qemu_test/tesseract.py 
b/tests/functional/qemu_test/tesseract.py
index c4087b7c11..db441027b9 100644
--- a/tests/functional/qemu_test/tesseract.py
+++ b/tests/functional/qemu_test/tesseract.py
@@ -11,7 +11,8 @@
 from . import has_cmd, run_cmd
 
 def tesseract_available(expected_version):
-if not has_cmd('tesseract'):
+(has_tesseract, _) = has_cmd('tesseract')
+if not has_tesseract:
 return False
 (stdout, stderr, ret) = run_cmd([ 'tesseract', '--version'])
 if ret:
-- 
2.46.0




Re: check-functional skipUnless failure

2024-09-10 Thread Thomas Huth

On 10/09/2024 08.41, Philippe Mathieu-Daudé wrote:

On 10/9/24 05:58, Richard Henderson wrote:

[rth@cfarm120 bld]$ make check-functional
[1/2] Generating tests/functional/func-precache-m68k-m68k_nextcube with a 
custom command (wrapped by meson to set env)

FAILED: tests/functional/m68k-m68k_nextcube.tstamp
env 
QEMU_TEST_PRECACHE=/home/rth/qemu/bld/tests/functional/m68k-m68k_nextcube.tstamp PYTHONPATH=/home/rth/qemu/src/python:/home/rth/qemu/src/tests/functional /home/rth/qemu/bld/pyvenv/bin/python3 /home/rth/qemu/src/tests/functional/test_m68k_nextcube.py

Traceback (most recent call last):
   File "/home/rth/qemu/src/tests/functional/test_m68k_nextcube.py", line 
25, in 

 class NextCubeMachine(QemuSystemTest):
   File "/home/rth/qemu/src/tests/functional/test_m68k_nextcube.py", line 
60, in NextCubeMachine

 @skipUnless(tesseract_available(4), 'tesseract OCR tool not available')
   File "/home/rth/qemu/src/tests/functional/qemu_test/tesseract.py", line 
16, in tesseract_available

 (stdout, stderr, ret) = run_cmd([ 'tesseract', '--version'])
   File "/home/rth/qemu/src/tests/functional/qemu_test/cmd.py", line 69, 
in run_cmd

 subp = subprocess.Popen(args,
   File "/usr/lib64/python3.9/subprocess.py", line 951, in __init__
 self._execute_child(args, executable, preexec_fn, close_fds,
   File "/usr/lib64/python3.9/subprocess.py", line 1837, in _execute_child
 raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'tesseract'


On this host, tesseract is not available.
But skipUnless is not skipping, but erroring out.


Ouch, it's a stupid mistake that I made while converting the test: has_cmd 
returns a list, not a boolean value. This should fix the bug:


diff --git a/tests/functional/qemu_test/tesseract.py 
b/tests/functional/qemu_test/tesseract.py

--- a/tests/functional/qemu_test/tesseract.py
+++ b/tests/functional/qemu_test/tesseract.py
@@ -11,7 +11,8 @@
 from . import has_cmd, run_cmd

 def tesseract_available(expected_version):
-if not has_cmd('tesseract'):
+(has_tesseract, errmsg) = has_cmd('tesseract')
+if not has_tesseract:
 return False
 (stdout, stderr, ret) = run_cmd([ 'tesseract', '--version'])
 if ret:

I'll send it out as a proper patch ASAP.


While looking at this, I'm surprised to notice has_cmd() actually
*runs* the command by calling run_cmd(). I'd have expected it solely
checks for binary presence and RX perms, avoiding unexpected side
effects.


It uses "which" to search for the binary ... that could be done better for 
sure (especially since "which" might not be available on all systems), but 
it already was done this way in the Avocado tests, so at least that's not a 
regression.


 Thomas




Re: [PATCH for-9.2? 0/2] meson: Rationalize sanitizer configuration

2024-09-08 Thread Thomas Huth

On 13/08/2024 11.52, Richard Henderson wrote:

In the CI that we actually run (x86) we don't want to use ASan,
only UBSan, we jump through --extra-cflags hoops to make that
happen, and we fail to disable function sanitizer during normal
configuration.

In the CI that we don't run, we enable ASan and fail to disable
function sanitizer.  So its a bit lucky that don't run it.

Split the --enable-santizers config option, and move stuff back
to meson.build from .gitlab-ci.d.



Reviewed-by: Thomas Huth 
and queued.




[PULL 3/3] hw/nubus/nubus-device: Range check 'slot' property

2024-09-08 Thread Thomas Huth
From: Peter Maydell 

The TYPE_NUBUS_DEVICE class lets the user specify the nubus slot
using an int32 "slot" QOM property.  Its realize method doesn't do
any range checking on this value, which Coverity notices by way of
the possibility that 'nd->slot * NUBUS_SUPER_SLOT_SIZE' might
overflow the 32-bit arithmetic it is using.

Constrain the slot value to be less than NUBUS_SLOT_NB (16).

Resolves: Coverity CID 1464070
Signed-off-by: Peter Maydell 
Message-ID: <20240830173452.2086140-4-peter.mayd...@linaro.org>
Reviewed-by: Thomas Huth 
Reviewed-by: Mark Cave-Ayland 
Signed-off-by: Thomas Huth 
---
 hw/nubus/nubus-device.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c
index be4cb24696..26fbcf29a2 100644
--- a/hw/nubus/nubus-device.c
+++ b/hw/nubus/nubus-device.c
@@ -35,6 +35,13 @@ static void nubus_device_realize(DeviceState *dev, Error 
**errp)
 uint8_t *rom_ptr;
 int ret;
 
+if (nd->slot < 0 || nd->slot >= NUBUS_SLOT_NB) {
+error_setg(errp,
+   "'slot' value %d out of range (must be between 0 and %d)",
+   nd->slot, NUBUS_SLOT_NB - 1);
+return;
+}
+
 /* Super */
 slot_offset = nd->slot * NUBUS_SUPER_SLOT_SIZE;
 
-- 
2.46.0




<    1   2   3   4   5   6   7   8   9   10   >