Skip to contentSkip to conversation

More patches to disable stuff

RFC Superseded Juan Quintela 4 participants 25 messages Jul 17, 2018 – Jul 19, 2018

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover More patches to disable stuff

Hi

Notice that this is an RFC because they don't work. As said on my previous submmision, we need <foo>-softmmu/config-devices.h to make this work. This series just allow us to disable the devices, but not to enable it back O:-)

Notice:

- scsi stuff: we are testing they in cdrom-test.c, so we need to be able to config them out. Notice also that #ifdefs only go in tests/<...>

- virtio stuff: see how we need to also change hw/virtio/virtio-pci.c to disable it. The problem appears in the device-instropect-test.c. As they are defined in the binary, but not complied in. We can change for a registration appreach, but that is more work that what I intended for this series.

What do you think?

Later, Juan.

Based-on: [email protected]

Juan Quintela (14):
check: Only test ipmi when it is compiled in
check: Only test megasas when it is compiled in
check: Only test lsi when it is compiled in
check: Only test esp when it is compiled in
check: Only test sga when it is compiled in
check: Only test usb smartcard when it is compiled in
check: Only test usb storage when it is compiled in
check: Only test nvdim_acpi when it is compiled in
check: Only test virtio-balloon when it is compiled in
check: Only test virtio-serial when it is compiled in
check: Only test virtio-rng when it is compiled in
check: Only test virtio-gpu when it is compiled in
check: Only test virtio-input when it is compiled in
check: Only test virtio-scsi when it is compiled in

 hw/virtio/virtio-pci.c    | 15 ++++++++++++---
 tests/Makefile.include    | 36 ++++++++++++++++++------------------
 tests/bios-tables-test.c  |  8 ++++++++
 tests/boot-serial-test.c  |  2 ++
 tests/cdrom-test.c        | 10 ++++++++++
 tests/display-vga-test.c  |  4 ++++
 tests/drive_del-test.c    |  6 ++++++
 tests/usb-hcd-uhci-test.c |  5 ++++-
 tests/usb-hcd-xhci-test.c |  9 ++++++++-
 9 files changed, 72 insertions(+), 23 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/14 check: Only test ipmi when it is compiled in

---
 tests/Makefile.include   | 4 ++--
 tests/bios-tables-test.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
tests/Makefile.include +2 -2
index 0ac4b960bc..bb1080ecb5 100644
@@ -260,8 +260,8 @@ check-qtest-i386-y += tests/bios-tables-test$(EXESUF)
 check-qtest-i386-y += tests/boot-serial-test$(EXESUF)
 check-qtest-i386-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
 check-qtest-i386-y += tests/rtc-test$(EXESUF)
-check-qtest-i386-y += tests/ipmi-kcs-test$(EXESUF)
-check-qtest-i386-y += tests/ipmi-bt-test$(EXESUF)
+check-qtest-i386-$(CONFIG_ISA_IPMI_KCS) += tests/ipmi-kcs-test$(EXESUF)
+check-qtest-i386-$(CONFIG_ISA_IPMI_BT) += tests/ipmi-bt-test$(EXESUF)
 check-qtest-i386-y += tests/i440fx-test$(EXESUF)
 check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
 check-qtest-i386-y += tests/drive_del-test$(EXESUF)
tests/bios-tables-test.c +4 -0
index 4e24930c4b..fd59c7f9a2 100644
@@ -736,6 +736,7 @@ static void test_acpi_q35_tcg_cphp(void)
     free_test_data(&data);
 }
 
+#ifdef CONFIG_IPMI
 static uint8_t ipmi_required_struct_types[] = {
     0, 1, 3, 4, 16, 17, 19, 32, 38, 127
 };
@@ -772,6 +773,7 @@ static void test_acpi_piix4_tcg_ipmi(void)
                   &data);
     free_test_data(&data);
 }
+#endif
 
 static void test_acpi_q35_tcg_memhp(void)
 {
@@ -875,8 +877,10 @@ int main(int argc, char *argv[])
         qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
         qtest_add_func("acpi/q35", test_acpi_q35_tcg);
         qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
+#ifdef CONFIG_IPMI
         qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi);
         qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi);
+#endif
         qtest_add_func("acpi/piix4/cpuhp", test_acpi_piix4_tcg_cphp);
         qtest_add_func("acpi/q35/cpuhp", test_acpi_q35_tcg_cphp);
         qtest_add_func("acpi/piix4/memhp", test_acpi_piix4_tcg_memhp);
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/14 check: Only test megasas when it is compiled in

In reply to Juan Quintela
---
 tests/Makefile.include | 4 ++--
 tests/cdrom-test.c     | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
tests/Makefile.include +2 -2
index bb1080ecb5..6565206a78 100644
@@ -245,8 +245,8 @@ check-qtest-pci-$(CONFIG_HDA) += tests/intel-hda-test$(EXESUF)
 gcov-files-pci-$(CONFIG_HDA) += hw/audio/intel-hda.c hw/audio/hda-codec.c
 check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
 gcov-files-pci-$(CONFIG_IVSHMEM_DEVICE) += hw/misc/ivshmem.c
-check-qtest-pci-y += tests/megasas-test$(EXESUF)
-gcov-files-pci-y += hw/scsi/megasas.c
+check-qtest-pci-$(CONFIG_MEGASAS_SCSI_PCI) += tests/megasas-test$(EXESUF)
+gcov-files-pci-$(CONFIG_MEGASAS_SCSI_PCI) += hw/scsi/megasas.c
 
 check-qtest-i386-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
 check-qtest-i386-y += tests/fdc-test$(EXESUF)
tests/cdrom-test.c +2 -0
index 7a1fce5dfb..42c29524b8 100644
@@ -143,12 +143,14 @@ static void add_x86_tests(void)
     qtest_add_data_func("cdrom/boot/lsi53c895a",
                         "-device lsi53c895a -device scsi-cd,drive=cd1 "
                         "-blockdev file,node-name=cd1,filename=", test_cdboot);
+#ifdef CONFIG_MEGASAS_SCSI_PCI
     qtest_add_data_func("cdrom/boot/megasas", "-M q35 "
                         "-device megasas -device scsi-cd,drive=cd1 "
                         "-blockdev file,node-name=cd1,filename=", test_cdboot);
     qtest_add_data_func("cdrom/boot/megasas-gen2", "-M q35 "
                         "-device megasas-gen2 -device scsi-cd,drive=cd1 "
                         "-blockdev file,node-name=cd1,filename=", test_cdboot);
+#endif
 }
 
 static void add_s390x_tests(void)
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/14 check: Only test lsi when it is compiled in

In reply to Juan Quintela
---
 tests/cdrom-test.c | 2 ++
 1 file changed, 2 insertions(+)
tests/cdrom-test.c +2 -0
index 42c29524b8..bab2ecc306 100644
@@ -140,9 +140,11 @@ static void add_x86_tests(void)
     qtest_add_data_func("cdrom/boot/dc390",
                         "-device dc390 -device scsi-cd,drive=cd1 "
                         "-blockdev file,node-name=cd1,filename=", test_cdboot);
+#ifdef CONFIG_LSI_SCSI_PCI
     qtest_add_data_func("cdrom/boot/lsi53c895a",
                         "-device lsi53c895a -device scsi-cd,drive=cd1 "
                         "-blockdev file,node-name=cd1,filename=", test_cdboot);
+#endif
 #ifdef CONFIG_MEGASAS_SCSI_PCI
     qtest_add_data_func("cdrom/boot/megasas", "-M q35 "
                         "-device megasas -device scsi-cd,drive=cd1 "
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/14 check: Only test esp when it is compiled in

In reply to Juan Quintela
---
 tests/cdrom-test.c | 2 ++
 1 file changed, 2 insertions(+)
tests/cdrom-test.c +2 -0
index bab2ecc306..0d7dff6da5 100644
@@ -134,12 +134,14 @@ static void add_x86_tests(void)
                         "-blockdev file,node-name=cdr,filename=", test_cdboot);
     qtest_add_data_func("cdrom/boot/isapc", "-M isapc "
                         "-drive if=ide,media=cdrom,file=", test_cdboot);
+#ifdef CONFIG_ESP_PCI
     qtest_add_data_func("cdrom/boot/am53c974",
                         "-device am53c974 -device scsi-cd,drive=cd1 "
                         "-drive if=none,id=cd1,format=raw,file=", test_cdboot);
     qtest_add_data_func("cdrom/boot/dc390",
                         "-device dc390 -device scsi-cd,drive=cd1 "
                         "-blockdev file,node-name=cd1,filename=", test_cdboot);
+#endif
 #ifdef CONFIG_LSI_SCSI_PCI
     qtest_add_data_func("cdrom/boot/lsi53c895a",
                         "-device lsi53c895a -device scsi-cd,drive=cd1 "
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/14 check: Only test sga when it is compiled in

In reply to Juan Quintela
---
 tests/boot-serial-test.c | 2 ++
 1 file changed, 2 insertions(+)
tests/boot-serial-test.c +2 -0
index 952a2e7ead..3f7c46fdf7 100644
@@ -87,11 +87,13 @@ static testdef_t tests[] = {
     { "ppc64", "pseries", "", "Open Firmware" },
     { "ppc64", "powernv", "-cpu POWER8", "OPAL" },
     { "ppc64", "sam460ex", "-device e1000", "8086  100e" },
+#ifdef CONFIG_SGA
     { "i386", "isapc", "-cpu qemu32 -device sga", "SGABIOS" },
     { "i386", "pc", "-device sga", "SGABIOS" },
     { "i386", "q35", "-device sga", "SGABIOS" },
     { "x86_64", "isapc", "-cpu qemu32 -device sga", "SGABIOS" },
     { "x86_64", "q35", "-device sga", "SGABIOS" },
+#endif
     { "sparc", "LX", "", "TMS390S10" },
     { "sparc", "SS-4", "", "MB86904" },
     { "sparc", "SS-600MP", "", "TMS390Z55" },
Signature · 1 line
2.17.1
#6 lore raw

PATCH 6/14 check: Only test usb smartcard when it is compiled in

In reply to Juan Quintela
---
 tests/usb-hcd-xhci-test.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/usb-hcd-xhci-test.c +4 -1
index 5b1b681bf2..be80c5f032 100644
@@ -35,6 +35,7 @@ static void test_usb_uas_hotplug(void)
     qtest_qmp_device_del("uas");
 }
 
+#ifdef CONFIG_USB_SMARTCARD
 static void test_usb_ccid_hotplug(void)
 {
     qtest_qmp_device_add("usb-ccid", "ccid", NULL);
@@ -43,6 +44,7 @@ static void test_usb_ccid_hotplug(void)
     qtest_qmp_device_add("usb-ccid", "ccid", NULL);
     qtest_qmp_device_del("ccid");
 }
+#endif
 
 int main(int argc, char **argv)
 {
@@ -53,8 +55,9 @@ int main(int argc, char **argv)
     qtest_add_func("/xhci/pci/init", test_xhci_init);
     qtest_add_func("/xhci/pci/hotplug", test_xhci_hotplug);
     qtest_add_func("/xhci/pci/hotplug/usb-uas", test_usb_uas_hotplug);
+#ifdef CONFIG_USB_SMARTCARD
     qtest_add_func("/xhci/pci/hotplug/usb-ccid", test_usb_ccid_hotplug);
-
+#endif
     qtest_start("-device nec-usb-xhci,id=xhci"
                 " -drive id=drive0,if=none,file=null-co://,format=raw");
     ret = g_test_run();
Signature · 1 line
2.17.1
#7 lore raw

PATCH 7/14 check: Only test usb storage when it is compiled in

In reply to Juan Quintela
---
 tests/Makefile.include    | 2 +-
 tests/usb-hcd-uhci-test.c | 5 ++++-
 tests/usb-hcd-xhci-test.c | 4 ++++
 3 files changed, 9 insertions(+), 2 deletions(-)
tests/Makefile.include +1 -1
index 6565206a78..9193945c24 100644
@@ -284,7 +284,7 @@ check-qtest-i386-$(CONFIG_USB_OHCI) += tests/usb-hcd-ohci-test$(EXESUF)
 gcov-files-i386-$(CONFIG_USB_OHCI) += hw/usb/hcd-ohci.c
 check-qtest-i386-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
 gcov-files-i386-$(CONFIG_USB_UHCI) += hw/usb/hcd-uhci.c
-check-qtest-i386-$(CONFIG_USB_EHCI) += tests/usb-hcd-ehci-test$(EXESUF)
+check-qtest-i386-$(call land, $(CONFIG_USB_EHCI), $(CONFIG_USB_STORAGE_BOT)) += tests/usb-hcd-ehci-test$(EXESUF)
 gcov-files-i386-$(CONFIG_USB_EHCI) += hw/usb/hcd-ehci.c
 gcov-files-i386-y += hw/usb/dev-hid.c
 gcov-files-i386-y += hw/usb/dev-storage.c
tests/usb-hcd-uhci-test.c +4 -1
index 6a7e5a2fed..bf996af6c6 100644
@@ -46,12 +46,14 @@ static void test_uhci_hotplug(void)
     usb_test_hotplug("uhci", 2, test_port_2);
 }
 
+#ifdef CONFIG_USB_STORAGE_BOT
 static void test_usb_storage_hotplug(void)
 {
     qtest_qmp_device_add("usb-storage", "usbdev0", "'drive': 'drive0'");
 
     qtest_qmp_device_del("usbdev0");
 }
+#endif
 
 int main(int argc, char **argv)
 {
@@ -66,8 +68,9 @@ int main(int argc, char **argv)
     qtest_add_func("/uhci/pci/init", test_uhci_init);
     qtest_add_func("/uhci/pci/port1", test_port_1);
     qtest_add_func("/uhci/pci/hotplug", test_uhci_hotplug);
+#ifdef CONFIG_USB_STORAGE_BOT
     qtest_add_func("/uhci/pci/hotplug/usb-storage", test_usb_storage_hotplug);
-
+#endif
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
         qs = qtest_pc_boot(cmd);
     } else if (strcmp(arch, "ppc64") == 0) {
tests/usb-hcd-xhci-test.c +4 -0
index be80c5f032..a8996800b2 100644
@@ -21,6 +21,7 @@ static void test_xhci_hotplug(void)
     usb_test_hotplug("xhci", 1, NULL);
 }
 
+#ifdef CONFIG_USB_STORAGE_UAS
 static void test_usb_uas_hotplug(void)
 {
     qtest_qmp_device_add("usb-uas", "uas", NULL);
@@ -34,6 +35,7 @@ static void test_usb_uas_hotplug(void)
     qtest_qmp_device_del("scsihd");
     qtest_qmp_device_del("uas");
 }
+#endif
 
 #ifdef CONFIG_USB_SMARTCARD
 static void test_usb_ccid_hotplug(void)
@@ -54,7 +56,9 @@ int main(int argc, char **argv)
 
     qtest_add_func("/xhci/pci/init", test_xhci_init);
     qtest_add_func("/xhci/pci/hotplug", test_xhci_hotplug);
+#ifdef CONFIG_USB_STORAGE_UAS
     qtest_add_func("/xhci/pci/hotplug/usb-uas", test_usb_uas_hotplug);
+#endif
 #ifdef CONFIG_USB_SMARTCARD
     qtest_add_func("/xhci/pci/hotplug/usb-ccid", test_usb_ccid_hotplug);
 #endif
Signature · 1 line
2.17.1
#8 lore raw

PATCH 8/14 check: Only test nvdim_acpi when it is compiled in

In reply to Juan Quintela
---
 tests/bios-tables-test.c | 4 ++++
 1 file changed, 4 insertions(+)
tests/bios-tables-test.c +4 -0
index fd59c7f9a2..1de6e3d58c 100644
@@ -825,6 +825,7 @@ static void test_acpi_piix4_tcg_numamem(void)
     free_test_data(&data);
 }
 
+#ifdef CONFIG_NVDIM_ACPI
 static void test_acpi_tcg_dimm_pxm(const char *machine)
 {
     test_data data;
@@ -860,6 +861,7 @@ static void test_acpi_piix4_tcg_dimm_pxm(void)
 {
     test_acpi_tcg_dimm_pxm(MACHINE_PC);
 }
+#endif
 
 int main(int argc, char *argv[])
 {
@@ -887,8 +889,10 @@ int main(int argc, char *argv[])
         qtest_add_func("acpi/q35/memhp", test_acpi_q35_tcg_memhp);
         qtest_add_func("acpi/piix4/numamem", test_acpi_piix4_tcg_numamem);
         qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
+#ifdef CONFIG_NVDIM_ACPI
         qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
         qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
+#endif
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);
Signature · 1 line
2.17.1
#9 lore raw

PATCH 9/14 check: Only test virtio-balloon when it is compiled in

In reply to Juan Quintela
---
 hw/virtio/virtio-pci.c | 5 ++++-
 tests/Makefile.include | 6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)
hw/virtio/virtio-pci.c +4 -1
index 3a01fe90f0..bdbc7ab78d 100644
@@ -2287,7 +2287,7 @@ static const TypeInfo vhost_vsock_pci_info = {
 #endif
 
 /* virtio-balloon-pci */
-
+#ifdef CONFIG_VIRTIO_BALLOON
 static Property virtio_balloon_pci_properties[] = {
     DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0),
     DEFINE_PROP_END_OF_LIST(),
@@ -2341,6 +2341,7 @@ static const TypeInfo virtio_balloon_pci_info = {
     .instance_init = virtio_balloon_pci_instance_init,
     .class_init    = virtio_balloon_pci_class_init,
 };
+#endif
 
 /* virtio-serial-pci */
 
@@ -2711,7 +2712,9 @@ static void virtio_pci_register_types(void)
     type_register_static(&vhost_user_blk_pci_info);
 #endif
     type_register_static(&virtio_scsi_pci_info);
+#ifdef CONFIG_VIRTIO_BALLOON
     type_register_static(&virtio_balloon_pci_info);
+#endif
     type_register_static(&virtio_serial_pci_info);
     type_register_static(&virtio_net_pci_info);
 #ifdef CONFIG_VHOST_SCSI
tests/Makefile.include +3 -3
index 9193945c24..bb30c56795 100644
@@ -191,8 +191,8 @@ gcov-files-virtioserial-y += hw/char/virtio-console.c
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
 check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
-check-qtest-virtio-y += tests/virtio-balloon-test$(EXESUF)
-gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
+check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) += tests/virtio-balloon-test$(EXESUF)
+gcov-files-virtio-$(CONFIG_VIRTIO_BALLOON) += i386-softmmu/hw/virtio/virtio-balloon.c
 check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
 check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
@@ -397,7 +397,7 @@ check-qtest-s390x-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
 check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
 check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
 check-qtest-s390x-y += tests/drive_del-test$(EXESUF)
-check-qtest-s390x-y += tests/virtio-balloon-test$(EXESUF)
+check-qtest-s390x-$(CONFIG_VIRTIO_BALLOON) += tests/virtio-balloon-test$(EXESUF)
 check-qtest-s390x-y += tests/virtio-console-test$(EXESUF)
 check-qtest-s390x-y += tests/virtio-serial-test$(EXESUF)
 check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF)
Signature · 1 line
2.17.1
#10 lore raw

Re: [Qemu-devel] [PATCH 09/14] check: Only test virtio-balloon when it is compiled in

Quoted 28 lines · On Tue, 17 Jul 2018 14:04:09 +0200 Juan Quintela <[email protected]> wrote:
---
 hw/virtio/virtio-pci.c | 5 ++++-
 tests/Makefile.include | 6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)
hw/virtio/virtio-pci.c +2 -1
index 3a01fe90f0..bdbc7ab78d 100644
@@ -2287,7 +2287,7 @@ static const TypeInfo vhost_vsock_pci_info = {
 #endif
 
 /* virtio-balloon-pci */
-
+#ifdef CONFIG_VIRTIO_BALLOON
 static Property virtio_balloon_pci_properties[] = {
     DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0),
     DEFINE_PROP_END_OF_LIST(),
@@ -2341,6 +2341,7 @@ static const TypeInfo virtio_balloon_pci_info = {
     .instance_init = virtio_balloon_pci_instance_init,
     .class_init    = virtio_balloon_pci_class_init,
 };
+#endif
 
 /* virtio-serial-pci */
 

hw/virtio/virtio-pci.c static void virtio_pci_register_types(void) · line 2720

Quoted 9 lines
hw/virtio/virtio-pci.c +2 -0
@@ -2711,7 +2712,9 @@ static void virtio_pci_register_types(void)
     type_register_static(&vhost_user_blk_pci_info);
 #endif
     type_register_static(&virtio_scsi_pci_info);
+#ifdef CONFIG_VIRTIO_BALLOON
     type_register_static(&virtio_balloon_pci_info);
+#endif
     type_register_static(&virtio_serial_pci_info);
     type_register_static(&virtio_net_pci_info);
 #ifdef CONFIG_VHOST_SCSI

You only make virtio-balloon-pci conditional...

Quoted 16 lines
tests/Makefile.include +2 -2
index 9193945c24..bb30c56795 100644
@@ -191,8 +191,8 @@ gcov-files-virtioserial-y += hw/char/virtio-console.c
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
 check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
-check-qtest-virtio-y += tests/virtio-balloon-test$(EXESUF)
-gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
+check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) += tests/virtio-balloon-test$(EXESUF)
+gcov-files-virtio-$(CONFIG_VIRTIO_BALLOON) += i386-softmmu/hw/virtio/virtio-balloon.c
 check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
 check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)

tests/Makefile.include check-qtest-s390x-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF) · line 400

Quoted 5 lines
tests/Makefile.include +1 -1
@@ -397,7 +397,7 @@ check-qtest-s390x-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
 check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
 check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
 check-qtest-s390x-y += tests/drive_del-test$(EXESUF)
-check-qtest-s390x-y += tests/virtio-balloon-test$(EXESUF)
+check-qtest-s390x-$(CONFIG_VIRTIO_BALLOON) += tests/virtio-balloon-test$(EXESUF)

...but the test uses virtio-balloon-ccw on s390x.

tests/Makefile.include check-qtest-s390x-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF) · line 403

Quoted 3 lines
tests/Makefile.include +0 -0
 check-qtest-s390x-y += tests/virtio-console-test$(EXESUF)
 check-qtest-s390x-y += tests/virtio-serial-test$(EXESUF)
 check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF)

Same for the other virtio device types.

#11 lore raw

Re: [Qemu-devel] [PATCH 09/14] check: Only test virtio-balloon when it is compiled in

Quoted 61 lines · Cornelia Huck
Quoted 28 lines · On Tue, 17 Jul 2018 14:04:09 +0200 Juan Quintela <[email protected]> wrote:
---
 hw/virtio/virtio-pci.c | 5 ++++-
 tests/Makefile.include | 6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)
hw/virtio/virtio-pci.c +2 -1
index 3a01fe90f0..bdbc7ab78d 100644
@@ -2287,7 +2287,7 @@ static const TypeInfo vhost_vsock_pci_info = {
 #endif
 
 /* virtio-balloon-pci */
-
+#ifdef CONFIG_VIRTIO_BALLOON
 static Property virtio_balloon_pci_properties[] = {
     DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0),
     DEFINE_PROP_END_OF_LIST(),
@@ -2341,6 +2341,7 @@ static const TypeInfo virtio_balloon_pci_info = {
     .instance_init = virtio_balloon_pci_instance_init,
     .class_init    = virtio_balloon_pci_class_init,
 };
+#endif
 
 /* virtio-serial-pci */
 

hw/virtio/virtio-pci.c static void virtio_pci_register_types(void) · line 2720

Quoted 9 lines
hw/virtio/virtio-pci.c +2 -0
@@ -2711,7 +2712,9 @@ static void virtio_pci_register_types(void)
     type_register_static(&vhost_user_blk_pci_info);
 #endif
     type_register_static(&virtio_scsi_pci_info);
+#ifdef CONFIG_VIRTIO_BALLOON
     type_register_static(&virtio_balloon_pci_info);
+#endif
     type_register_static(&virtio_serial_pci_info);
     type_register_static(&virtio_net_pci_info);
 #ifdef CONFIG_VHOST_SCSI

You only make virtio-balloon-pci conditional...

Quoted 18 lines
tests/Makefile.include +2 -2
index 9193945c24..bb30c56795 100644
@@ -191,8 +191,8 @@ gcov-files-virtioserial-y += hw/char/virtio-console.c
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
 check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
-check-qtest-virtio-y += tests/virtio-balloon-test$(EXESUF)
-gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
+check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) +=
 tests/virtio-balloon-test$(EXESUF)
+gcov-files-virtio-$(CONFIG_VIRTIO_BALLOON) +=

i386-softmmu/hw/virtio/virtio-balloon.c
check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF) gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)

tests/Makefile.include +0 -0
@@ -397,7 +397,7 @@ check-qtest-s390x-$(CONFIG_SLIRP) +=
Quoted 8 lines

tests/Makefile.include check-qtest-s390x-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF) · line 400

Quoted 6 lines
tests/Makefile.include +1 -1
 tests/test-netfilter$(EXESUF)
 check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
 check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
 check-qtest-s390x-y += tests/drive_del-test$(EXESUF)
-check-qtest-s390x-y += tests/virtio-balloon-test$(EXESUF)
+check-qtest-s390x-$(CONFIG_VIRTIO_BALLOON) += tests/virtio-balloon-test$(EXESUF)

...but the test uses virtio-balloon-ccw on s390x.

I didn't compile check on s390x, you can guess.

Quoted 5 lines
Quoted 3 lines
tests/Makefile.include +0 -0
 check-qtest-s390x-y += tests/virtio-console-test$(EXESUF)
 check-qtest-s390x-y += tests/virtio-serial-test$(EXESUF)

check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF)

Same for the other virtio device types.

I put somewhere on the cover letter that usb & virtio are a mess. Virtio devices:
- are pci in everything
- except on s390 (kind of)
- and some old arm boards (kind of)

Add test stuff there, and it is a royal mess. I don't really know what is the best way to test this kind of thing without complicating (still more) the testing directory. This is an RFC to agree about how to go from here. Notice that Paolo said that there is GSOC student to do something on this area.

Thanks, Juan.

#12 lore raw

PATCH 10/14 check: Only test virtio-serial when it is compiled in

In reply to Juan Quintela
---
 tests/Makefile.include | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/Makefile.include +4 -4
index bb30c56795..7feda20577 100644
@@ -204,10 +204,10 @@ check-qtest-virtio-y += tests/virtio-9p-test$(EXESUF)
 gcov-files-virtio-y += hw/9pfs/virtio-9p.c
 gcov-files-virtio-y += i386-softmmu/hw/9pfs/virtio-9p-device.c
 endif
-check-qtest-virtio-y += tests/virtio-serial-test$(EXESUF)
-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-virtio-$(CONFIG_VIRTIO_SERIAL) += tests/virtio-serial-test$(EXESUF)
+gcov-files-virtio-$(CONFIG_VIRTIO_SERIAL) += i386-softmmu/hw/char/virtio-serial-bus.c
+check-qtest-virtio-$(CONFIG_VIRTIO_SERIAL) += $(check-qtest-virtioserial-y)
+gcov-files-virtio-$(CONFIG_VIRTIO_SERIAL) += $(gcov-files-virtioserial-y)
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
Signature · 1 line
2.17.1
#13 lore raw

PATCH 11/14 check: Only test virtio-rng when it is compiled in

In reply to Juan Quintela
---
 hw/virtio/virtio-pci.c | 6 ++++--
 tests/Makefile.include | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)
hw/virtio/virtio-pci.c +4 -2
index bdbc7ab78d..75c96990c0 100644
@@ -2472,7 +2472,7 @@ static const TypeInfo virtio_net_pci_info = {
 };
 
 /* virtio-rng-pci */
-
+#ifdef CONFIG_VIRTIO_RNG
 static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
 {
     VirtIORngPCI *vrng = VIRTIO_RNG_PCI(vpci_dev);
@@ -2521,7 +2521,7 @@ static const TypeInfo virtio_rng_pci_info = {
     .instance_init = virtio_rng_initfn,
     .class_init    = virtio_rng_pci_class_init,
 };
-
+#endif
 /* virtio-input-pci */
 
 static Property virtio_input_pci_properties[] = {
@@ -2693,7 +2693,9 @@ static const TypeInfo virtio_pci_bus_info = {
 
 static void virtio_pci_register_types(void)
 {
+#ifdef CONFIG_VIRTIO_RNG
     type_register_static(&virtio_rng_pci_info);
+#endif
     type_register_static(&virtio_input_pci_info);
     type_register_static(&virtio_input_hid_pci_info);
     type_register_static(&virtio_keyboard_pci_info);
tests/Makefile.include +2 -2
index 7feda20577..a9cb5e926b 100644
@@ -195,8 +195,8 @@ check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) += tests/virtio-balloon-test$(EXESUF
 gcov-files-virtio-$(CONFIG_VIRTIO_BALLOON) += i386-softmmu/hw/virtio/virtio-balloon.c
 check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
-check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
-gcov-files-virtio-y += hw/virtio/virtio-rng.c
+check-qtest-virtio-$(CONFIG_VIRTIO_RNG) += tests/virtio-rng-test$(EXESUF)
+gcov-files-virtio-$(CONFIG_VIRTIO_RNG) += hw/virtio/virtio-rng.c
 check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
 ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
Signature · 1 line
2.17.1
#14 lore raw

PATCH 12/14 check: Only test virtio-gpu when it is compiled in

In reply to Juan Quintela
---
 tests/Makefile.include   | 4 ++--
 tests/display-vga-test.c | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
tests/Makefile.include +2 -2
index a9cb5e926b..c4d68061e5 100644
@@ -238,8 +238,8 @@ check-qtest-pci-y += tests/display-vga-test$(EXESUF)
 gcov-files-pci-y += hw/display/vga.c
 gcov-files-pci-y += hw/display/cirrus_vga.c
 gcov-files-pci-y += hw/display/vga-pci.c
-gcov-files-pci-y += hw/display/virtio-gpu.c
-gcov-files-pci-y += hw/display/virtio-gpu-pci.c
+gcov-files-pci-$(CONFIG_VIRTIO_GPU) += hw/display/virtio-gpu.c
+gcov-files-pci-$(CONFIG_VIRTIO_GPU) += hw/display/virtio-gpu-pci.c
 gcov-files-pci-$(CONFIG_VIRTIO_VGA) += hw/display/virtio-vga.c
 check-qtest-pci-$(CONFIG_HDA) += tests/intel-hda-test$(EXESUF)
 gcov-files-pci-$(CONFIG_HDA) += hw/audio/intel-hda.c hw/audio/hda-codec.c
tests/display-vga-test.c +4 -0
index 2d7d24eee0..b716e70a4b 100644
@@ -34,11 +34,13 @@ static void pci_multihead(void)
     qtest_end();
 }
 
+#ifdef CONFIG_VIRTIO_GPU
 static void pci_virtio_gpu(void)
 {
     qtest_start("-vga none -device virtio-gpu-pci");
     qtest_end();
 }
+#endif
 
 #ifdef CONFIG_VIRTIO_VGA
 static void pci_virtio_vga(void)
@@ -61,7 +63,9 @@ int main(int argc, char **argv)
     qtest_add_func("/display/pci/stdvga", pci_stdvga);
     qtest_add_func("/display/pci/secondary", pci_secondary);
     qtest_add_func("/display/pci/multihead", pci_multihead);
+#ifdef CONFIG_VIRTIO_GPU
     qtest_add_func("/display/pci/virtio-gpu", pci_virtio_gpu);
+#endif
 #ifdef CONFIG_VIRTIO_VGA
     qtest_add_func("/display/pci/virtio-vga", pci_virtio_vga);
 #endif
Signature · 1 line
2.17.1
#15 lore raw

PATCH 13/14 check: Only test virtio-input when it is compiled in

In reply to Juan Quintela

The full of it. Introspection is able to search for drivers that you aren't there, so just disable it.

---
 hw/virtio/virtio-pci.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/virtio/virtio-pci.c +4 -0
index 75c96990c0..987d7c0a5a 100644
@@ -2524,6 +2524,7 @@ static const TypeInfo virtio_rng_pci_info = {
 #endif
 /* virtio-input-pci */
 
+#ifdef CONFIG_VIRTIO_INPUT
 static Property virtio_input_pci_properties[] = {
     DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
     DEFINE_PROP_END_OF_LIST(),
@@ -2645,6 +2646,7 @@ static const TypeInfo virtio_host_pci_info = {
     .instance_init = virtio_host_initfn,
 };
 #endif
+#endif
 
 /* virtio-pci-bus */
 
@@ -2696,6 +2698,7 @@ static void virtio_pci_register_types(void)
 #ifdef CONFIG_VIRTIO_RNG
     type_register_static(&virtio_rng_pci_info);
 #endif
+#ifdef CONFIG_VIRTIO_INPUT
     type_register_static(&virtio_input_pci_info);
     type_register_static(&virtio_input_hid_pci_info);
     type_register_static(&virtio_keyboard_pci_info);
@@ -2703,6 +2706,7 @@ static void virtio_pci_register_types(void)
     type_register_static(&virtio_tablet_pci_info);
 #ifdef CONFIG_LINUX
     type_register_static(&virtio_host_pci_info);
+#endif
 #endif
     type_register_static(&virtio_pci_bus_info);
     type_register_static(&virtio_pci_info);
Signature · 1 line
2.17.1
#16 lore raw

PATCH 14/14 check: Only test virtio-scsi when it is compiled in

In reply to Juan Quintela
---
 tests/Makefile.include | 4 ++--
 tests/cdrom-test.c     | 4 ++++
 tests/drive_del-test.c | 6 ++++++
 3 files changed, 12 insertions(+), 2 deletions(-)
tests/Makefile.include +2 -2
index c4d68061e5..74ee02348c 100644
@@ -197,8 +197,8 @@ check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
 check-qtest-virtio-$(CONFIG_VIRTIO_RNG) += tests/virtio-rng-test$(EXESUF)
 gcov-files-virtio-$(CONFIG_VIRTIO_RNG) += hw/virtio/virtio-rng.c
-check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
-gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
+check-qtest-virtio-$(CONFIG_VIRTIO_SCSI) += tests/virtio-scsi-test$(EXESUF)
+gcov-files-virtio-$(CONFIG_VIRTIO_SCSI) += i386-softmmu/hw/scsi/virtio-scsi.c
 ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
 check-qtest-virtio-y += tests/virtio-9p-test$(EXESUF)
 gcov-files-virtio-y += hw/9pfs/virtio-9p.c
tests/cdrom-test.c +4 -0
index 0d7dff6da5..46ec5d43e9 100644
@@ -129,9 +129,11 @@ static void test_cdboot(gconstpointer data)
 static void add_x86_tests(void)
 {
     qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot);
+#ifdef CONFIG_VIRTIO_SCSI
     qtest_add_data_func("cdrom/boot/virtio-scsi",
                         "-device virtio-scsi -device scsi-cd,drive=cdr "
                         "-blockdev file,node-name=cdr,filename=", test_cdboot);
+#endif
     qtest_add_data_func("cdrom/boot/isapc", "-M isapc "
                         "-drive if=ide,media=cdrom,file=", test_cdboot);
 #ifdef CONFIG_ESP_PCI
@@ -160,9 +162,11 @@ static void add_x86_tests(void)
 static void add_s390x_tests(void)
 {
     qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot);
+#ifdef CONFIG_VIRTIO_SCSI
     qtest_add_data_func("cdrom/boot/virtio-scsi",
                         "-device virtio-scsi -device scsi-cd,drive=cdr "
                         "-blockdev file,node-name=cdr,filename=", test_cdboot);
+#endif
 }
 
 int main(int argc, char **argv)
tests/drive_del-test.c +6 -0
index 852fefc8f3..d6f010269a 100644
@@ -31,6 +31,7 @@ static void drive_del(void)
     g_free(resp);
 }
 
+#ifdef CONFIG_VIRTIO_SCSI
 static void device_del(void)
 {
     QDict *response;
@@ -43,6 +44,7 @@ static void device_del(void)
     g_assert(qdict_haskey(response, "return"));
     qobject_unref(response);
 }
+#endif
 
 static void test_drive_without_dev(void)
 {
@@ -91,6 +93,7 @@ static void test_after_failed_device_add(void)
     qtest_end();
 }
 
+#ifdef CONFIG_VIRTIO_SCSI
 static void test_drive_del_device_del(void)
 {
     char *args;
@@ -112,6 +115,7 @@ static void test_drive_del_device_del(void)
     qtest_end();
     g_free(args);
 }
+#endif
 
 int main(int argc, char **argv)
 {
@@ -127,8 +131,10 @@ int main(int argc, char **argv)
         !strcmp(arch, "s390x")) {
         qtest_add_func("/drive_del/after_failed_device_add",
                        test_after_failed_device_add);
+#ifdef CONFIG_VIRTIO_SCSI
         qtest_add_func("/blockdev/drive_del_device_del",
                        test_drive_del_device_del);
+#endif
     }
 
     return g_test_run();
Signature · 1 line
2.17.1
#17 lore raw
In reply to Juan Quintela
Quoted 12 lines · Juan Quintela

Hi

Notice that this is an RFC because they don't work. As said on my previous submmision, we need <foo>-softmmu/config-devices.h to make this work. This series just allow us to disable the devices, but not to enable it back O:-)

Notice:

- scsi stuff: we are testing they in cdrom-test.c, so we need to be able to config them out. Notice also that #ifdefs only go in tests/<...>

Quoted 7 lines

- virtio stuff: see how we need to also change hw/virtio/virtio-pci.c to disable it. The problem appears in the device-instropect-test.c. As they are defined in the binary, but not complied in. We can change for a registration appreach, but that is more work that what I intended for this series.

What do you think?

I think this is the wrong way to go. If you add #ifdefs to the sources, you have to make the binaries target-specific. Currently each test binary can work for each target architecture. With #ifdefs, that's not possible anymore. So please don't do that.

If you want to make the tests more flexible for configuration, please use QOM instead to check whether the devices are available or not.

Thomas

#18 lore raw
Quoted 19 lines · Thomas Huth
Quoted 18 lines · Juan Quintela

Hi

Notice that this is an RFC because they don't work. As said on my previous submmision, we need <foo>-softmmu/config-devices.h to make this work. This series just allow us to disable the devices, but not to enable it back O:-)

Notice:

- scsi stuff: we are testing they in cdrom-test.c, so we need to be able to config them out. Notice also that #ifdefs only go in tests/<...>

- virtio stuff: see how we need to also change hw/virtio/virtio-pci.c to disable it. The problem appears in the device-instropect-test.c. As they are defined in the binary, but not complied in. We can change for a registration appreach, but that is more work that what I intended for this series.

Quoted 6 lines
Quoted 1 line

What do you think?

I think this is the wrong way to go. If you add #ifdefs to the sources, you have to make the binaries target-specific. Currently each test binary can work for each target architecture. With #ifdefs, that's not possible anymore. So please don't do that.

As the system goes now, you have something enabled if it is enabled for any _configuration_, that is what config-all-devices.mak is supposed to do.

Quoted 2 lines

If you want to make the tests more flexible for configuration, please use QOM instead to check whether the devices are available or not.

QOM is the problem, not the solution (TM). Uninteresting bits deleted.

tests/device-instrospect-test.c

static void test_device_intro_concrete(void)

{
    ...
    types = device_type_list(false);
    ...
}

static QList *device_type_list(bool abstract)

{
    return qom_list_types("device", abstract);
}

static QList *qom_list_types(const char *implements, bool abstract)

{
    QDict *resp;
    QList *ret;
    QDict *args = qdict_new();

    qdict_put_bool(args, "abstract", abstract);
    if (implements) {
        qdict_put_str(args, "implements", implements);
    }
    resp = qmp("{'execute': 'qom-list-types',"
               " 'arguments': %p }", args);
    g_assert(qdict_haskey(resp, "return"));
    ret = qdict_get_qlist(resp, "return");
    qobject_ref(ret);
    qobject_unref(resp);
    return ret;
}

If I disable CONFIG_VIRTIO_RNG, then I don't compile common-obj-$(CONFIG_VIRTIO_RNG) += virtio-rng.o

So far so good, but look at virtio-pci.c:

static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) {
...
}

static void virtio_rng_pci_class_init(ObjectClass *klass, void *data) {
....
}

static void virtio_rng_initfn(Object *obj)
{
...
}

static const TypeInfo virtio_rng_pci_info = {
.name = TYPE_VIRTIO_RNG_PCI,
.parent = TYPE_VIRTIO_PCI,
.instance_size = sizeof(VirtIORngPCI),
.instance_init = virtio_rng_initfn,
.class_init = virtio_rng_pci_class_init,
};

static void virtio_pci_register_types(void)

{
    type_register_static(&virtio_rng_pci_info);

...
}

See, we have defined the device "virtio-rng-pci", but there is no implementation. WHen I run device-intronspection-test on that qemu with CONFIG_VIRTIO_RNG, it fails to run. If we can agree that something is wrong, then we can search for a solution. I send this patches as an RFC to ask for what people think is the best solution, or if we should even bother in fix that.

Later, JUan.

#19 lore raw
Quoted 22 lines · Juan Quintela
Quoted 21 lines · Thomas Huth
Quoted 19 lines · Juan Quintela

Hi

Notice that this is an RFC because they don't work. As said on my previous submmision, we need <foo>-softmmu/config-devices.h to make this work. This series just allow us to disable the devices, but not to enable it back O:-)

Notice:

- scsi stuff: we are testing they in cdrom-test.c, so we need to be able to config them out. Notice also that #ifdefs only go in tests/<...>

- virtio stuff: see how we need to also change hw/virtio/virtio-pci.c to disable it. The problem appears in the device-instropect-test.c. As they are defined in the binary, but not complied in. We can change for a registration appreach, but that is more work that what I intended for this series.

What do you think?

Quoted 8 lines
Quoted 4 lines

I think this is the wrong way to go. If you add #ifdefs to the sources, you have to make the binaries target-specific. Currently each test binary can work for each target architecture. With #ifdefs, that's not possible anymore. So please don't do that.

As the system goes now, you have something enabled if it is enabled for any _configuration_, that is what config-all-devices.mak is supposed to do.

We certainly need this for common, target-independent code. Using #ifdefs for common code will only cause confusion for people who are not aware of the common vs. target-specific code compilation yet.

Quoted 69 lines
Quoted 2 lines

If you want to make the tests more flexible for configuration, please use QOM instead to check whether the devices are available or not.

QOM is the problem, not the solution (TM). Uninteresting bits deleted.

tests/device-instrospect-test.c

static void test_device_intro_concrete(void)

{
    ...
    types = device_type_list(false);
    ...
}

static QList *device_type_list(bool abstract)

{
    return qom_list_types("device", abstract);
}

static QList *qom_list_types(const char *implements, bool abstract)

{
    QDict *resp;
    QList *ret;
    QDict *args = qdict_new();

    qdict_put_bool(args, "abstract", abstract);
    if (implements) {
        qdict_put_str(args, "implements", implements);
    }
    resp = qmp("{'execute': 'qom-list-types',"
               " 'arguments': %p }", args);
    g_assert(qdict_haskey(resp, "return"));
    ret = qdict_get_qlist(resp, "return");
    qobject_ref(ret);
    qobject_unref(resp);
    return ret;
}

If I disable CONFIG_VIRTIO_RNG, then I don't compile common-obj-$(CONFIG_VIRTIO_RNG) += virtio-rng.o

So far so good, but look at virtio-pci.c:

static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)

{
   ...
}

static void virtio_rng_pci_class_init(ObjectClass *klass, void *data)

{
   ....
}

static void virtio_rng_initfn(Object *obj)

{
   ...
}

static const TypeInfo virtio_rng_pci_info = {
.name = TYPE_VIRTIO_RNG_PCI,
.parent = TYPE_VIRTIO_PCI,
.instance_size = sizeof(VirtIORngPCI),
.instance_init = virtio_rng_initfn,
.class_init = virtio_rng_pci_class_init,
};

static void virtio_pci_register_types(void)

{
    type_register_static(&virtio_rng_pci_info);
Quoted 7 lines

...
}

See, we have defined the device "virtio-rng-pci", but there is no implementation. WHen I run device-intronspection-test on that qemu with CONFIG_VIRTIO_RNG, it fails to run. If we can agree that something is wrong, then we can search for a solution.

I agree with you that the current situation with virtio-pci. c is bad. I think we should split it up into individual files instead (virtio-pci-rng.c etc.).

Thomas

#20 lore raw
Quoted 33 lines · On Thu, 19 Jul 2018 13:06:59 +0200 Thomas Huth <[email protected]> wrote:
Quoted 31 lines · Juan Quintela

So far so good, but look at virtio-pci.c:

static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)

{
   ...
}

static void virtio_rng_pci_class_init(ObjectClass *klass, void *data)

{
   ....
}

static void virtio_rng_initfn(Object *obj)

{
   ...
}

static const TypeInfo virtio_rng_pci_info = {
.name = TYPE_VIRTIO_RNG_PCI,
.parent = TYPE_VIRTIO_PCI,
.instance_size = sizeof(VirtIORngPCI),
.instance_init = virtio_rng_initfn,
.class_init = virtio_rng_pci_class_init,
};

static void virtio_pci_register_types(void)

{
    type_register_static(&virtio_rng_pci_info);

...
}

Quoted 8 lines
Quoted 4 lines

See, we have defined the device "virtio-rng-pci", but there is no implementation. WHen I run device-intronspection-test on that qemu with CONFIG_VIRTIO_RNG, it fails to run. If we can agree that something is wrong, then we can search for a solution.

I agree with you that the current situation with virtio-pci. c is bad. I think we should split it up into individual files instead (virtio-pci-rng.c etc.).

We should then do the same thing for virtio-ccw as well.

#21 lore raw
Quoted 41 lines · Cornelia Huck
Quoted 38 lines · On Thu, 19 Jul 2018 13:06:59 +0200 Thomas Huth <[email protected]> wrote:
Quoted 35 lines · Juan Quintela

So far so good, but look at virtio-pci.c:

static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)

{
   ...
}

static void virtio_rng_pci_class_init(ObjectClass *klass, void *data)

{
   ....
}

static void virtio_rng_initfn(Object *obj)

{
   ...
}

static const TypeInfo virtio_rng_pci_info = {
.name = TYPE_VIRTIO_RNG_PCI,
.parent = TYPE_VIRTIO_PCI,
.instance_size = sizeof(VirtIORngPCI),
.instance_init = virtio_rng_initfn,
.class_init = virtio_rng_pci_class_init,
};

static void virtio_pci_register_types(void)

{
    type_register_static(&virtio_rng_pci_info);

...
}

See, we have defined the device "virtio-rng-pci", but there is no implementation. WHen I run device-intronspection-test on that qemu with CONFIG_VIRTIO_RNG, it fails to run. If we can agree that something is wrong, then we can search for a solution.

Quoted 5 lines
Quoted 3 lines

I agree with you that the current situation with virtio-pci. c is bad. I think we should split it up into individual files instead (virtio-pci-rng.c etc.).

We should then do the same thing for virtio-ccw as well.

Yes. I can do that if you like.

Thomas

#22 lore raw
Quoted 11 lines · On Thu, 19 Jul 2018 13:58:02 +0200 Thomas Huth <[email protected]> wrote:
Quoted 8 lines · Cornelia Huck
Quoted 3 lines · On Thu, 19 Jul 2018 13:06:59 +0200 Thomas Huth <[email protected]> wrote:

I agree with you that the current situation with virtio-pci. c is bad. I think we should split it up into individual files instead (virtio-pci-rng.c etc.).

We should then do the same thing for virtio-ccw as well.

Yes. I can do that if you like.

Sure, feel free to go ahead.

#23 lore raw
In reply to Juan Quintela
Quoted 9 lines · Juan Quintela

Hi

Notice that this is an RFC because they don't work. As said on my previous submmision, we need <foo>-softmmu/config-devices.h to make this work. This series just allow us to disable the devices, but not to enable it back O:-)

Notice:

Quoted 8 lines

- scsi stuff: we are testing they in cdrom-test.c, so we need to be able to config them out. Notice also that #ifdefs only go in tests/<...>

- virtio stuff: see how we need to also change hw/virtio/virtio-pci.c to disable it. The problem appears in the device-instropect-test.c. As they are defined in the binary, but not complied in. We can change for a registration appreach, but that is more work that what I intended for this series.

Emanuele's GSoC project will be able to do this automatically; tests are defined to "consume" some devices, and are not enabled unless the device is present.

Thanks,

Paolo

#24 lore raw
Quoted 19 lines · Paolo Bonzini
Quoted 9 lines · Juan Quintela

Hi

Notice that this is an RFC because they don't work. As said on my previous submmision, we need <foo>-softmmu/config-devices.h to make this work. This series just allow us to disable the devices, but not to enable it back O:-)

Notice:

Quoted 8 lines

- scsi stuff: we are testing they in cdrom-test.c, so we need to be able to config them out. Notice also that #ifdefs only go in tests/<...>

- virtio stuff: see how we need to also change hw/virtio/virtio-pci.c to disable it. The problem appears in the device-instropect-test.c. As they are defined in the binary, but not complied in. We can change for a registration appreach, but that is more work that what I intended for this series.

Quoted 3 lines

Emanuele's GSoC project will be able to do this automatically; tests are defined to "consume" some devices, and are not enabled unless the device is present.

Nice. Thanks.

Quoted 4 lines

Thanks,

Paolo