Skip to contentSkip to conversation

qtest: Generic PCI device test

RFC PATCH In review Markus Armbruster 3 participants 5 messages Jan 29, 2015 – Feb 12, 2015

lore
Share & tools
lore
#0 lore raw

cover qtest: Generic PCI device test

The test uses QMP introspection to find PCI devices, then tries to cold-plug each of them. Could be extended to hot-plug and unplug.

The tests' QMP introspection part is patterned after Andreas's qom-test, which uses QMP to find machine types.

The following devices pass the test:

    AC97                ich9-ahci           pcnet             
    ES1370              ich9-intel-hda      piix3-ide         
    VGA                 ich9-usb-ehci1      piix3-ide-xen     
    am53c974            ich9-usb-ehci2      piix3-usb-uhci    
    cirrus-vga          ich9-usb-uhci1      piix4-ide         
    dc390               ich9-usb-uhci2      piix4-usb-uhci    
    e1000               ich9-usb-uhci3      pvscsi            
    e1000-82540em       ich9-usb-uhci4      qxl-vga           
    e1000-82544gc       ich9-usb-uhci5      rtl8139           
    e1000-82545em       ich9-usb-uhci6      sdhci-pci         
    edu                 intel-hda           secondary-vga     
    i6300esb            ioh3420             tpci200           
    i82550              lsi53c810           usb-ehci          
    i82551              lsi53c895a          virtio-balloon-pci
    i82557a             megasas             virtio-blk-pci    
    i82557b             megasas-gen2        virtio-net-pci    
    i82557c             ne2k_pci            virtio-rng-pci    
    i82558a             nec-usb-xhci        virtio-scsi-pci   
    i82558b             nvme                virtio-serial-pci 
    i82559a             pci-bridge          vmware-svga       
    i82559b             pci-ohci            vmxnet3           
    i82559c             pci-serial          vt82c686b-usb-uhci
    i82559er            pci-serial-2x       x3130-upstream    
    i82562              pci-serial-4x       xen-pvdevice      
    i82801              pci-testdev         xio3130-downstream
    i82801b11-bridge

Many of them are not currently tested at all.

This test does everything a number of existing tests currently do:

    ac97-test.c e1000-test.c es1370-test.c eepro100-test.c
    ne2000-test.c nvme-test.c pcnet-test.c rtl8139-test.c
    tpci200-test.c virtio-balloon-test.c virtio-rng-test.c
    vmxnet3-test.c

They are all marked "TODO: Replace with functional tests". Options

* Delete them now, undelete when we add functional tests

* Keep them, blacklist the devices in pci-devs-test.c

* Live with the duplicated testing

Andreas, I guess you got an opinion here.

There's overlap with a few others:

i82801b11-test.c usb-hcd-ehci-test.c usb-hcd-ohci-test.c usb-hcd-xhci-test.c virtio-blk-test.c virtio-net-test.c virtio-scsi-test.c virtio-serial-test.c

Options:

* Blacklist the devices in pci-devs-test.c

* Live with the duplicated testing

Andreas?

I manually blacklisted devices unavailable with -device, because QMP introspection can't tell (pity).

I further blacklisted devices that require a suitable host device to pass through:

kvm-pci-assign vhost-scsi-pci xen-pci-passthrough
vfio-pci

I blacklisted virtio-9p-pci and ivshmem for now, because they require funky backends.

I blacklisted qxl and xen-platform, because they fail the test.

The test runs only for the x86 targets, just like all of $(check-qtest-pci-y). It could run on other targets, as long as we can find a machine type with a PCI bus.

Markus Armbruster (1):
qtest: Add generic PCI device test

 tests/Makefile        |   2 +
 tests/pci-devs-test.c | 299 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 301 insertions(+)
 create mode 100644 tests/pci-devs-test.c
Signature · 1 line
1.9.3
#1 lore raw

RFC PATCH 1/1 qtest: Add generic PCI device test

Covers only cold plug with -device so far.

---
 tests/Makefile        |   2 +
 tests/pci-devs-test.c | 299 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 301 insertions(+)
 create mode 100644 tests/pci-devs-test.c
tests/Makefile +2 -0
index c2e2e52..230238d 100644
@@ -100,6 +100,7 @@ gcov-files-virtio-y += i386-softmmu/hw/char/virtio-serial-bus.c
 check-qtest-virtio-y += $(check-qtest-virtioserial-y)
 gcov-files-virtio-y += $(gcov-files-virtioserial-y)
 
+check-qtest-pci-y += tests/pci-devs-test$(EXESUF)
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
 check-qtest-pci-y += tests/rtl8139-test$(EXESUF)
@@ -319,6 +320,7 @@ tests/bios-tables-test$(EXESUF): tests/bios-tables-test.o $(libqos-obj-y)
 tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
 tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
 tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
+tests/pci-devs-test$(EXESUF): tests/pci-devs-test.o
 tests/e1000-test$(EXESUF): tests/e1000-test.o
 tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o
 tests/pcnet-test$(EXESUF): tests/pcnet-test.o
tests/pci-devs-test.c new file +299 -0

299 lines not on this page · raw message

Signature · 1 line
1.9.3
#2 lore raw
In reply to Markus Armbruster

Hi Markus,

Again thanks for digging into this.

Am 29.01.2015 um 15:58 schrieb Markus Armbruster:

Quoted 9 lines

This test does everything a number of existing tests currently do:

    ac97-test.c e1000-test.c es1370-test.c eepro100-test.c
    ne2000-test.c nvme-test.c pcnet-test.c rtl8139-test.c
    tpci200-test.c virtio-balloon-test.c virtio-rng-test.c
    vmxnet3-test.c

They are all marked "TODO: Replace with functional tests". Options

Quoted 7 lines

* Delete them now, undelete when we add functional tests

* Keep them, blacklist the devices in pci-devs-test.c

* Live with the duplicated testing

Andreas, I guess you got an opinion here.

My preference would be to not remove device files. "Functional tests" refers to doing real device-specific MMIO or PIO, and the intent of contributing such stubs, beyond the basic -device init/realize testing, was lowering the hurdle so that maintainers can require bugfixers to contribute a matching test case where applicable.

Quoted 6 lines

There's overlap with a few others:

i82801b11-test.c usb-hcd-ehci-test.c usb-hcd-ohci-test.c usb-hcd-xhci-test.c virtio-blk-test.c virtio-net-test.c virtio-scsi-test.c virtio-serial-test.c

Quoted 7 lines

Options:

* Blacklist the devices in pci-devs-test.c

* Live with the duplicated testing

Andreas?

Not having reviewed the respective test code yet, I would suggest to keep generic tests in pci-devs-test.c and to rather drop generic tests from device-specific files (de-duplication).

While I haven't benchmarked it, I assume that the bigger contributor to qtest runtime is the overhead of spawning qemu-system-* processes rather than running multiple tests per process. So living with duplication may be a convenience option.

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
#3 lore raw
Quoted 20 lines · Andreas Färber

Hi Markus,

Again thanks for digging into this.

Am 29.01.2015 um 15:58 schrieb Markus Armbruster:

Quoted 15 lines

This test does everything a number of existing tests currently do:

    ac97-test.c e1000-test.c es1370-test.c eepro100-test.c
    ne2000-test.c nvme-test.c pcnet-test.c rtl8139-test.c
    tpci200-test.c virtio-balloon-test.c virtio-rng-test.c
    vmxnet3-test.c

They are all marked "TODO: Replace with functional tests". Options

* Delete them now, undelete when we add functional tests

* Keep them, blacklist the devices in pci-devs-test.c

* Live with the duplicated testing

Quoted 7 lines
Quoted 1 line

Andreas, I guess you got an opinion here.

My preference would be to not remove device files. "Functional tests" refers to doing real device-specific MMIO or PIO, and the intent of contributing such stubs, beyond the basic -device init/realize testing, was lowering the hurdle so that maintainers can require bugfixers to contribute a matching test case where applicable.

Yes, asking people who aren't familiar with device tests to create one from scratch is asking a lot. Asking them to copy a skeleton and flesh it out is much more practical. Almost as good as fleshing out one of your stubs, I think.

A non-skeleton test for a really simple PCI device could serve as skeleton. wdt_i6300esb.c is a possible candidate.

Quoted 10 lines
Quoted 10 lines

There's overlap with a few others:

i82801b11-test.c usb-hcd-ehci-test.c usb-hcd-ohci-test.c usb-hcd-xhci-test.c virtio-blk-test.c virtio-net-test.c virtio-scsi-test.c virtio-serial-test.c

Options:

* Blacklist the devices in pci-devs-test.c

Quoted 7 lines
Quoted 3 lines

* Live with the duplicated testing

Andreas?

Not having reviewed the respective test code yet, I would suggest to keep generic tests in pci-devs-test.c and to rather drop generic tests from device-specific files (de-duplication).

Makes sense to me. However, some existing device-specific files won't have any tests left then. What do you want me to do with them?

Quoted 4 lines

While I haven't benchmarked it, I assume that the bigger contributor to qtest runtime is the overhead of spawning qemu-system-* processes rather than running multiple tests per process. So living with duplication may be a convenience option.

My new test is a pig in that regard: it runs qemu-system-FOO once per non-blacklisted PCI device.

I could pack tests into fewer runs by using more than just a single PCI slot. i440FX can do 30 without a pci-bridge (would probably a bad idea for this test) and multifunction (certainly a bad idea). However, when a test fails, the culprit isn't as obvious then. Do you want me to try that?

#4 lore raw
In reply to Markus Armbruster
Quoted 44 lines · Markus Armbruster

The test uses QMP introspection to find PCI devices, then tries to cold-plug each of them. Could be extended to hot-plug and unplug.

The tests' QMP introspection part is patterned after Andreas's qom-test, which uses QMP to find machine types.

The following devices pass the test:

     AC97                ich9-ahci           pcnet
     ES1370              ich9-intel-hda      piix3-ide
     VGA                 ich9-usb-ehci1      piix3-ide-xen
     am53c974            ich9-usb-ehci2      piix3-usb-uhci
     cirrus-vga          ich9-usb-uhci1      piix4-ide
     dc390               ich9-usb-uhci2      piix4-usb-uhci
     e1000               ich9-usb-uhci3      pvscsi
     e1000-82540em       ich9-usb-uhci4      qxl-vga
     e1000-82544gc       ich9-usb-uhci5      rtl8139
     e1000-82545em       ich9-usb-uhci6      sdhci-pci
     edu                 intel-hda           secondary-vga
     i6300esb            ioh3420             tpci200
     i82550              lsi53c810           usb-ehci
     i82551              lsi53c895a          virtio-balloon-pci
     i82557a             megasas             virtio-blk-pci
     i82557b             megasas-gen2        virtio-net-pci
     i82557c             ne2k_pci            virtio-rng-pci
     i82558a             nec-usb-xhci        virtio-scsi-pci
     i82558b             nvme                virtio-serial-pci
     i82559a             pci-bridge          vmware-svga
     i82559b             pci-ohci            vmxnet3
     i82559c             pci-serial          vt82c686b-usb-uhci
     i82559er            pci-serial-2x       x3130-upstream
     i82562              pci-serial-4x       xen-pvdevice
     i82801              pci-testdev         xio3130-downstream
     i82801b11-bridge

Many of them are not currently tested at all.

This test does everything a number of existing tests currently do:

     ac97-test.c e1000-test.c es1370-test.c eepro100-test.c
     ne2000-test.c nvme-test.c pcnet-test.c rtl8139-test.c
     tpci200-test.c virtio-balloon-test.c virtio-rng-test.c
     vmxnet3-test.c
Quoted 8 lines

They are all marked "TODO: Replace with functional tests". Options

* Delete them now, undelete when we add functional tests

* Keep them, blacklist the devices in pci-devs-test.c

* Live with the duplicated testing

I'd be happy with stubbing out some of those tests, so we at least have some record and starting place for beginning tests again in the future.

So... Delete the test interface, keep the tests?

Or: Remove these devices from the generic test, but factor the generic test code such that these device tests can just invoke the generic routines from their own tests.

That way there's no duplication, everybody gets to use the shared code, and we keep the record that we'd like to enhance testing of these devices.

Quoted 8 lines

Andreas, I guess you got an opinion here.

There's overlap with a few others:

i82801b11-test.c usb-hcd-ehci-test.c usb-hcd-ohci-test.c usb-hcd-xhci-test.c virtio-blk-test.c virtio-net-test.c virtio-scsi-test.c virtio-serial-test.c

Quoted 6 lines

Options:

* Blacklist the devices in pci-devs-test.c

* Live with the duplicated testing

If you factor out the core generic PCI testing as above, you can just cull the common parts out of these tests and let them do their own functional tests on top, then blacklist them from the generic dispatcher.

Quoted 28 lines

Andreas?

I manually blacklisted devices unavailable with -device, because QMP introspection can't tell (pity).

I further blacklisted devices that require a suitable host device to pass through:

kvm-pci-assign vhost-scsi-pci xen-pci-passthrough
vfio-pci

I blacklisted virtio-9p-pci and ivshmem for now, because they require funky backends.

I blacklisted qxl and xen-platform, because they fail the test.

The test runs only for the x86 targets, just like all of $(check-qtest-pci-y). It could run on other targets, as long as we can find a machine type with a PCI bus.

Markus Armbruster (1):
qtest: Add generic PCI device test

  tests/Makefile        |   2 +
  tests/pci-devs-test.c | 299 ++++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 301 insertions(+)

create mode 100644 tests/pci-devs-test.c