On 9/14/2026 3:34 PM, Zhuoying Cai wrote:
The pxe test for a net device does not fail gracefully when the
s390-ccw.img in use was built without support for booting that device.

Add a boot_dev_support check that searches for a known string in the
bios image to confirm boot support. If absent, the test is skipped
gracefully instead of failing.

Also re-enable pxe-test in qtests_s390x, which was accidentally
removed by commit 973d97feca93.

Signed-off-by: Zhuoying Cai <[email protected]>
---
  tests/qtest/meson.build |  1 +
  tests/qtest/pxe-test.c  | 84 ++++++++++++++++++++++++++++++++++++++++-
  2 files changed, 84 insertions(+), 1 deletion(-)


...snip...
diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c
index e85dec5a4e..8b6015b6cd 100644
--- a/tests/qtest/pxe-test.c
+++ b/tests/qtest/pxe-test.c

...snip...

+static bool s390_bios_has_string(const char *needle)
+{
+    const char *contents;
+    gsize len;
+    bool found;
+
+    contents = s390_bios_load(&len);
+    found = memmem(contents, len, needle, strlen(needle)) != NULL;
+
+    g_test_message("%s %s", needle, found ? "found" : "not found");
+    return found;
+}
How about:
g_test_message("\"%s\" %s in bios", needle, found ? "found" : "not found");

then

# Setup failed for virtio-net-pci not found

becomes

# "Setup failed for virtio-net-pci" not found in bios

--------------------------------------------------------------------------

Tested-by: Joshua Daley <[email protected]>

make check-qtest-s390x MTESTARGS="--setup=thorough qtest-s390x/pxe-test"

Bios with the string:

# Loaded /root/repos/qemu/build/qemu-bundle/usr/local/share/qemu/s390-ccw.img
# Network boot starting... found
# starting QEMU: exec ./qemu-system-s390x -qtest unix:/tmp/qtest-56871.sock 
-qtest-log /dev/null -chardev socket,path=/tmp/qtest-56871.qmp,id=char0 -object 
monitor-qmp,id=qmp0,chardev=char0 -display none -audio none -run-with 
exit-with-parent=on -accel kvm -accel tcg -machine s390-ccw-virtio -nodefaults 
-boot order=n -netdev 
user,id=net0,tftp=./,bootfile=tests/pxe-test-disk-KBoif7,ipv4=on,ipv6=off 
-device virtio-net-ccw,bootindex=1,netdev=net0   -accel qtest
ok 1 /s390x/pxe/ipv4/s390-ccw-virtio/virtio-net-ccw
...
# Using cached bios contents
# Network boot starting... found
# starting QEMU: exec ./qemu-system-s390x -qtest unix:/tmp/qtest-56871.sock 
-qtest-log /dev/null -chardev socket,path=/tmp/qtest-56871.qmp,id=char0 -object 
monitor-qmp,id=qmp0,chardev=char0 -display none -audio none -run-with 
exit-with-parent=on -accel kvm -accel tcg -machine s390-ccw-virtio -nodefaults 
-boot order=n -netdev 
user,id=net0,tftp=./,bootfile=tests/pxe-test-disk-KBoif7,ipv4=off,ipv6=on 
-device virtio-net-ccw,bootindex=1,netdev=net0   -accel qtest
ok 2 /s390x/pxe/ipv6/s390-ccw-virtio/virtio-net-ccw

Bios without the string:

# Loaded /root/repos/qemu/build/qemu-bundle/usr/local/share/qemu/s390-ccw.img
# Network boot starting... not found
ok 1 /s390x/pxe/ipv4/s390-ccw-virtio/virtio-net-ccw # SKIP The bios does not 
support booting this device
...
# Using cached bios contents
# Network boot starting... not found
ok 2 /s390x/pxe/ipv6/s390-ccw-virtio/virtio-net-ccw # SKIP The bios does not 
support booting this device


Reply via email to