public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
From: Eric Farman <farman@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
	qemu-devel@nongnu.org, Cornelia Huck <cohuck@redhat.com>,
	jrossi@linux.ibm.com
Cc: qemu-s390x@nongnu.org, Matthew Rosato <mjrosato@linux.ibm.com>
Subject: Re: [PATCH] tests/functional/s390x: Add test for booting from a disk with 4k sectors
Date: Mon, 23 Mar 2026 22:52:46 -0400	[thread overview]
Message-ID: <c238a5cbbb85a8a79588b70f6d83c0dd604c4a09.camel@linux.ibm.com> (raw)
In-Reply-To: <20260323171423.112205-1-thuth@redhat.com>

On Mon, 2026-03-23 at 18:14 +0100, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> The DASD disks on s390x have a different sector size (4k) and use
> a different layout of the boot loader data compared to the usual
> "SCSI"-style disks with 512 sectors that are used with most modern
> guests. To make sure that there are no regressions with 4k disk
> booting, add a test case that uses a disk image with these 4k sectors
> and check that we can successfully show the boot menu and and load the
> right kernel in all supported cases.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  tests/functional/s390x/meson.build     |   1 +
>  tests/functional/s390x/test_boot_4k.py | 138 +++++++++++++++++++++++++
>  2 files changed, 139 insertions(+)
>  create mode 100755 tests/functional/s390x/test_boot_4k.py

Thanks, Thomas!

Reviewed-by: Eric Farman <farman@linux.ibm.com>

> 
> diff --git a/tests/functional/s390x/meson.build b/tests/functional/s390x/meson.build
> index 0f03e1c9db8..b065b666bc2 100644
> --- a/tests/functional/s390x/meson.build
> +++ b/tests/functional/s390x/meson.build
> @@ -10,6 +10,7 @@ tests_s390x_system_quick = [
>  ]
>  
>  tests_s390x_system_thorough = [
> +  'boot_4k',
>    'ccw_virtio',
>    'pxelinux',
>    'replay',
> diff --git a/tests/functional/s390x/test_boot_4k.py b/tests/functional/s390x/test_boot_4k.py
> new file mode 100755
> index 00000000000..965123ebd31
> --- /dev/null
> +++ b/tests/functional/s390x/test_boot_4k.py
> @@ -0,0 +1,138 @@
> +#!/usr/bin/env python3
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +#
> +# Copyright 2026 Red Hat, Inc.
> +#
> +# Author:
> +#  Thomas Huth <thuth@redhat.com>
> +'''
> +Functional test that boots from a (incomplete) disk with 4k sectors
> +(DASD/ECKD geometry) and multiple kernels installed, so we can check
> +the boot menu and various LOADPARM options.
> +'''
> +
> +from qemu_test import QemuSystemTest, Asset, skipFlakyTest
> +from qemu_test import wait_for_console_pattern
> +
> +
> +class S390Boot4k(QemuSystemTest):
> +
> +    # This disk image has been taken from a DASD with 4k sectors.
> +    # Note: It's incomplete (to keep it small), it contains just enough
> +    # data for booting the kernels that are installed on the disk image
> +    ASSET_DISK = Asset(
> +        ('https://github.com/huth/qemu-paddock/raw/refs/heads/main/s390x/'
> +         'f32-4k-bootmenu.raw.xz'),
> +        'f4e2c91b4ec50a4756e8816b7a7c8ca01cc0d929f7a711cfd8124640c304ea41')
> +
> +    def wait_for_pattern(self, success_message, vm=None):
> +        wait_for_console_pattern(self, success_message, vm=vm,
> +                                 failure_message='panic')
> +
> +    def basic_machine_setup(self):
> +        self.set_machine('s390-ccw-virtio')
> +        disk_path = self.uncompress(self.ASSET_DISK, format="xz")
> +
> +        self.vm.set_console()
> +        self.vm.add_args("-nographic", "-no-shutdown", "-blockdev",
> +                         f"driver=file,filename={disk_path},node-name=d1")
> +
> +    def test_default(self):
> +        '''
> +        Check that the default kernel boots up correctly from a ccw device
> +        '''
> +        self.basic_machine_setup()
> +        self.vm.add_args("-device", "virtio-blk-ccw,drive=d1")
> +        self.vm.launch()
> +        self.wait_for_pattern("Linux version 5.8.15-301.fc33.s390x")
> +        self.wait_for_pattern("Trying to unpack rootfs image as initramfs")
> +
> +    def test_loadparm_machine(self):
> +        '''
> +        Check that we can select a kernel via "-machine loadparm=..."
> +        '''
> +        self.basic_machine_setup()
> +        self.vm.add_args("-device", "virtio-blk-ccw,drive=d1",
> +                         "-machine", "loadparm=2")
> +        self.vm.launch()
> +        self.wait_for_pattern("Linux version 5.6.6-300.fc32.s390x")
> +
> +    def test_loadparm_device(self):
> +        '''
> +        Check that we can select a kernel via  "-device ...,loadparm=..."
> +        '''
> +        self.basic_machine_setup()
> +        self.vm.add_args("-device",
> +                         "virtio-blk-ccw,drive=d1,bootindex=1,loadparm=3")
> +        self.vm.launch()
> +        self.wait_for_pattern("Linux version 5.6.6-300.fc32.s390x")
> +
> +    @skipFlakyTest("https://gitlab.com/qemu-project/qemu/-/work_items/3350")
> +    def test_loadparm_pci(self):
> +        '''
> +        Check that we can select a kernel via  "-device ...-pci,loadparm=..."
> +        '''
> +        self.require_device('virtio-blk-pci')
> +        self.basic_machine_setup()
> +        self.vm.add_args("-device",
> +                         "virtio-blk-pci,drive=d1,bootindex=1,loadparm=2")
> +        self.vm.launch()
> +        self.wait_for_pattern("Linux version 5.6.6-300.fc32.s390x")
> +
> +    def test_scsi_default(self):
> +        '''
> +        Check that we can boot via SCSI, too (need to set logical block size
> +        here to avoid that the auto-detection in the bios fails)
> +        '''
> +        self.basic_machine_setup()
> +        self.vm.add_args("-device", "virtio-scsi", "-device",
> +            "scsi-hd,drive=d1,physical_block_size=4096,logical_block_size=4096")
> +        self.vm.launch()
> +        self.wait_for_pattern("Linux version 5.8.15-301.fc33.s390x")
> +
> +    def test_scsi_loadparm(self):
> +        '''
> +        Check that we can boot via SCSI with loadparm
> +        '''
> +        self.basic_machine_setup()
> +        self.vm.add_args("-device", "virtio-scsi", "-device",
> +                         ("scsi-hd,drive=d1,bootindex=1,loadparm=3,"
> +                          "physical_block_size=4096,logical_block_size=4096"))
> +        self.vm.launch()
> +        self.wait_for_pattern("Linux version 5.6.6-300.fc32.s390x")
> +
> +    def test_menu(self):
> +        '''
> +        Check that boot menu shows up correctly
> +        '''
> +        self.basic_machine_setup()
> +        self.vm.add_args("-device", "virtio-blk-ccw,drive=d1,bootindex=1",
> +                         "-boot", "menu=on")
> +        self.vm.launch()
> +        self.wait_for_pattern("1. Fedora (5.8.15-301.fc33.s390x) 33")
> +        self.wait_for_pattern("2. Fedora (5.6.6-300.fc32.s390x) 32")
> +        self.wait_for_pattern("3. Fedora (0-rescue-b7218f0092704c5a9")
> +        self.wait_for_pattern("Please choose:")
> +        # For some unknown reason, sending a key to the bios does not work
> +        # in the testing framework yet:
> +        # exec_command_and_wait_for_pattern(self, '2',
> +        #                              "Linux version 5.6.6-300.fc32.s390x")
> +
> +    def test_menu_timeout(self):
> +        '''
> +        Check that boot menu shows up and boot continues automatically
> +        when a timeout has been specified
> +        '''
> +        self.basic_machine_setup()
> +        self.vm.add_args("-device", "virtio-blk-ccw,drive=d1,bootindex=1",
> +                         "-boot", "menu=on,splash-time=1")
> +        self.vm.launch()
> +        self.wait_for_pattern("s390-ccw zIPL Boot Menu")
> +        self.wait_for_pattern("0. default (Fedora (5.8.15-301.fc33.s390x)")
> +        self.wait_for_pattern("(default will boot in 0 seconds)")
> +        self.wait_for_pattern("Linux version 5.8.15-301.fc33.s390x")
> +
> +
> +if __name__ == '__main__':
> +    QemuSystemTest.main()


      reply	other threads:[~2026-03-24  2:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 17:14 [PATCH] tests/functional/s390x: Add test for booting from a disk with 4k sectors Thomas Huth
2026-03-24  2:52 ` Eric Farman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c238a5cbbb85a8a79588b70f6d83c0dd604c4a09.camel@linux.ibm.com \
    --to=farman@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=jrossi@linux.ibm.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox