On 30/04/2025 00.13, Peter Xu wrote:
On Tue, Apr 29, 2025 at 05:21:38PM +0200, Thomas Huth wrote:
From: Thomas Huth <th...@redhat.com>

These files reference QEMU machine types that have already been
removed and thus are of no use anymore.

Signed-off-by: Thomas Huth <th...@redhat.com>

I never noticed these files, but when looking it seems to me these two
dumps are tailored to be used to test the script itself..

See:

$ git ls tests/vmstate-static-checker-data/
e178113ff6 hw: Replace anti-social QOM type names
38ef86b5a6 tests: vmstate static checker: add size mismatch inside substructure
af3713f6b9 tests: vmstate static checker: add substructure for usb-kbd for hid 
section
c7173a9c18 tests: vmstate static checker: remove Subsections
aa2a12bb82 tests: vmstate static checker: remove a subsection
b5968f0ab3 tests: vmstate static checker: remove Description inside Fields
ff29b8573f tests: vmstate static checker: remove Description
083bac3484 tests: vmstate static checker: remove Fields
1d681c712a tests: vmstate static checker: change description name
fd52ffb9bf tests: vmstate static checker: remove last field in a struct
55e8e0e19c tests: vmstate static checker: remove a field
ab99bdbe33 tests: vmstate static checker: remove a section
7daa3d76df tests: vmstate static checker: minimum_version_id check
4efa6e1d64 tests: vmstate static checker: version mismatch inside a Description
a81d3fad87 tests: vmstate static checker: add version error in main section
bc178dc563 tests: vmstate static checker: incompat machine types
a10413e4fc tests: vmstate static checker: add dump1 and dump2 files

So dump2.json was deliberately modified to trigger all kinds of error that
the python script can detect.

Oh, good point, I should have looked at the history, too! ... the files clearly lacked an explanation / script that is using them!

Maybe we can still keep it there, but at least make it clearer that it's
testing the script?  For example, we could create a bash under the same dir
running the script over the two dumps and comparing the results to be the
expected one?

Currently the output:

$ scripts/vmstate-static-checker.py -s 
./tests/vmstate-static-checker-data/dump1.json -d 
./tests/vmstate-static-checker-data/dump2.json
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

So the bash can make sure the result is exactly that.  If we want, we could
even route that to CI, but I'd say optional.

I can include such a test in the functional python test, no need for a separate bash script here, I think. I'll try to include that in v2.

 Thomas


Reply via email to