From: Peter Xu <peterx@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>
Subject: Re: [PATCH v2 4/4] tests/functional/test_vmstate: Test whether the checker script works as expected
Date: Thu, 22 May 2025 10:40:01 -0400 [thread overview]
Message-ID: <aC83QUmY6B255lTb@x1.local> (raw)
In-Reply-To: <20250522133756.259194-5-thuth@redhat.com>
On Thu, May 22, 2025 at 03:37:56PM +0200, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> We've got two vmstate dump files in the repository which are meant
> for verifying whether the vmstate-static-checker.py works as expected.
> Since running this manually is a cumbersome job, let's add an automated
> test for this instead that runs the script with the two dump files
> and checks for the expected output.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/functional/test_vmstate.py | 37 ++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
> diff --git a/tests/functional/test_vmstate.py b/tests/functional/test_vmstate.py
> index cc988987481..19a62e8a17e 100755
> --- a/tests/functional/test_vmstate.py
> +++ b/tests/functional/test_vmstate.py
> @@ -9,6 +9,22 @@
> from qemu_test import QemuSystemTest
>
>
> +expected_output='''Warning: checking incompatible machine types: "pc-i440fx-2.1", "pc-i440fx-2.2"
> +Section "fw_cfg" does not exist in dest
> +Section "fusbh200-ehci-usb" version error: 2 > 1
> +Section "fusbh200-ehci-usb", Description "ehci-core": expected field "usbsts", got "usbsts_pending"; skipping rest
> +Section "pci-serial-4x" Description "pci-serial-multi": Entry "Fields" missing
> +Section "intel-hda-generic", Description "intel-hda", Field "pci": missing description
> +Section "cfi.pflash01": Entry "Description" missing
> +Section "megasas", Description "PCIDevice": expected field "irq_state", while dest has no further fields
> +Section "PIIX3-xen" Description "PIIX3": minimum version error: 1 < 2
> +Section "PIIX3-xen" Description "PIIX3": Entry "Subsections" missing
> +Section "tpci200": Description "tpci200" missing, got "tpci2002" instead; skipping
> +Section "sun-fdtwo" Description "fdc": version error: 2 > 1
> +Section "sun-fdtwo", Description "fdrive": Subsection "fdrive/media_rate" not found
> +Section "usb-kbd" Description "usb-kbd" Field "kbd.keycodes" size mismatch: 4 , 2
> +'''
> +
> class VmStateTest(QemuSystemTest):
>
> def run_vmstate_checker(self, src_json, dst_json):
> @@ -19,6 +35,27 @@ def run_vmstate_checker(self, src_json, dst_json):
> stderr=subprocess.STDOUT,
> text=True)
>
> + def test_checker(self):
> + """
> + Test whether the checker script correctly detects the changes
> + between dump1.json and dump2.json.
> + """
> + if self.arch != 'x86_64':
> + self.skipTest('for x86 only')
> + src_json = self.data_file('..', 'data', 'vmstate-static-checker',
> + 'dump1.json')
> + dst_json = self.data_file('..', 'data', 'vmstate-static-checker',
> + 'dump2.json')
> + self.log.info(f'Comparing {src_json} with {dst_json}')
> + cp = self.run_vmstate_checker(src_json, dst_json)
> + if cp.returncode != 13:
> + self.fail('Unexpected return code of vmstate-static-checker: ' +
> + cp.returncode)
> + if cp.stdout != expected_output:
> + self.log.info('vmstate-static-checker output:\n' + cp.stdout)
> + self.log.info('expected output:\n' + expected_output)
> + self.fail('Unexpected vmstate-static-checker output!')
> +
Would this run for every make check and every CI run?
Since the script almost never change, I wonder whether this test should be
triggered only if manually. But maybe I totally missed how the functional
framework works..
> def test_vmstate(self):
> target_machine = {
> 'aarch64': 'virt-7.2',
> --
> 2.49.0
>
--
Peter Xu
next prev parent reply other threads:[~2025-05-22 14:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-22 13:37 [PATCH v2 0/4] tests/functional: Test with scripts/vmstate-static-checker.py Thomas Huth
2025-05-22 13:37 ` [PATCH v2 1/4] tests: Move the old vmstate-static-checker files to tests/data/ Thomas Huth
2025-05-22 14:35 ` Peter Xu
2025-05-22 13:37 ` [PATCH v2 2/4] tests/data/vmstate-static-checker: Add dump files from QEMU 7.2.17 Thomas Huth
2025-05-22 14:35 ` Peter Xu
2025-05-22 13:37 ` [PATCH v2 3/4] tests/functional: Test with scripts/vmstate-static-checker.py Thomas Huth
2025-05-22 14:38 ` Peter Xu
2025-05-22 18:08 ` Thomas Huth
2025-05-26 13:52 ` Peter Xu
2025-05-22 13:37 ` [PATCH v2 4/4] tests/functional/test_vmstate: Test whether the checker script works as expected Thomas Huth
2025-05-22 14:40 ` Peter Xu [this message]
2025-05-22 18:12 ` Thomas Huth
2025-05-26 13:47 ` Peter Xu
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=aC83QUmY6B255lTb@x1.local \
--to=peterx@redhat.com \
--cc=farosas@suse.de \
--cc=qemu-devel@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;
as well as URLs for NNTP newsgroup(s).