tests/qtest: Skip PXE tests for missing devices
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/12 tests/qtest: Skip PXE tests for missing devices
Check if the devices we're trying to add are present in the QEMU binary. They could have been removed from the build via Kconfig or the --without-default-devices option.
--- tests/qtest/pxe-test.c | 4 ++++ 1 file changed, 4 insertions(+)
tests/qtest/pxe-test.c +4 -0
@@ -108,6 +108,10 @@ static void test_batch(const testdef_t *tests, bool ipv6)const testdef_t *test = &tests[i];char *testname; +if (!qtest_has_device (test->model)) { +continue ; + } + testname =g_strdup_printf ("pxe/ipv4/%s/%s" , test->machine, test->model);qtest_add_data_func (testname, test, test_pxe_ipv4);
Signature · 1 line
2.35.3
PATCH v2 2/12 tests/qtest: Do not run lsi53c895a test if device is not present
In reply to a message not in the archiveThe tests are built once for all the targets, so as long as one QEMU binary is built with CONFIG_LSI_SCSI_PCI=y, this test will run. However some binaries might not include the device. So check this again in runtime.
--- tests/qtest/fuzz-lsi53c895a-test.c | 4 ++++ 1 file changed, 4 insertions(+)
tests/qtest/fuzz-lsi53c895a-test.c +4 -0
@@ -112,6 +112,10 @@ static void test_lsi_do_dma_empty_queue(void)int main (int argc,char **argv) { +if (!qtest_has_device ("lsi53c895a" )) { +return 0 ; + } +g_test_init (&argc, &argv,NULL ); qtest_add_func("fuzz/lsi53c895a/lsi_do_dma_empty_queue",
Signature · 1 line
2.35.3
PATCH v2 8/12 tests/qtest: drive_del-test: Skip tests that require missing devices
In reply to a message not in the archive--- tests/qtest/drive_del-test.c | 65 ++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)
tests/qtest/drive_del-test.c +65 -0
@@ -16,6 +16,8 @@#include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" +static const char *qvirtio_get_dev_type (void ); +static bool look_for_drive0 (QTestState *qts,const char *command,const char *key) {QDict *response;
@@ -40,6 +42,19 @@ static bool look_for_drive0(QTestState *qts, const char *command, const char *kereturn found; } +/* +* This covers the possible absence of a device due to QEMU build +* options. +*/ +static bool has_device_builtin (const char *dev) +{ +gchar *device =g_strdup_printf ("%s-%s" , dev,qvirtio_get_dev_type ()); +bool rc =qtest_has_device (device); + +g_free (device); +return rc; +} +static bool has_drive (QTestState *qts) {return look_for_drive0 (qts,"query-block" ,"device" );
@@ -208,6 +223,11 @@ static void test_drive_del_device_del(void) {QTestState *qts; +if (!has_device_builtin ("virtio-scsi" )) { +g_test_skip ("Device virtio-scsi is not available" ); +return ; + } +/* Start with a drive used by a device that unplugs instantaneously */ qts =qtest_initf ("-drive if=none,id=drive0,file=null-co://," "file.read-zeroes=on,format=raw"
@@ -232,6 +252,11 @@ static void test_cli_device_del(void)const char *arch =qtest_get_arch ();const char *machine_addition ="" ; +if (!has_device_builtin ("virtio-blk" )) { +g_test_skip ("Device virtio-blk is not available" ); +return ; + } +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { machine_addition ="-machine pc" ; }
@@ -256,6 +281,11 @@ static void test_cli_device_del_q35(void) {QTestState *qts; +if (!has_device_builtin ("virtio-blk" )) { +g_test_skip ("Device virtio-blk is not available" ); +return ; + } +/* * -drive/-device and device_del. Start with a drive used by a * device that unplugs after reset.
@@ -277,6 +307,11 @@ static void test_empty_device_del(void) {QTestState *qts; +if (!has_device_builtin ("virtio-scsi" )) { +g_test_skip ("Device virtio-scsi is not available" ); +return ; + } +/* device_del with no drive plugged. */ qts =qtest_initf ("-device virtio-scsi-%s -device scsi-cd,id=dev0" ,qvirtio_get_dev_type ());
@@ -291,6 +326,11 @@ static void test_device_add_and_del(void)const char *arch =qtest_get_arch ();const char *machine_addition ="" ; +if (!has_device_builtin ("virtio-blk" )) { +g_test_skip ("Device virtio-blk is not available" ); +return ; + } +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { machine_addition ="-machine pc" ; }
@@ -330,6 +370,11 @@ static void test_device_add_and_del_q35(void) {QTestState *qts; +if (!has_device_builtin ("virtio-blk" )) { +g_test_skip ("Device virtio-blk is not available" ); +return ; + } +/* * -drive/device_add and device_del. Start with a drive used by a * device that unplugs after reset.
@@ -352,6 +397,11 @@ static void test_drive_add_device_add_and_del(void)const char *arch =qtest_get_arch ();const char *machine_addition ="" ; +if (!has_device_builtin ("virtio-blk" )) { +g_test_skip ("Device virtio-blk is not available" ); +return ; + } +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { machine_addition ="-machine pc" ; }
@@ -374,6 +424,11 @@ static void test_drive_add_device_add_and_del_q35(void) {QTestState *qts; +if (!has_device_builtin ("virtio-blk" )) { +g_test_skip ("Device virtio-blk is not available" ); +return ; + } + qts =qtest_init ("-machine q35 -device pcie-root-port,id=p1 " "-device pcie-pci-bridge,bus=p1,id=b1" );
@@ -395,6 +450,11 @@ static void test_blockdev_add_device_add_and_del(void)const char *arch =qtest_get_arch ();const char *machine_addition ="" ; +if (!has_device_builtin ("virtio-blk" )) { +g_test_skip ("Device virtio-blk is not available" ); +return ; + } +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { machine_addition ="-machine pc" ; }
@@ -417,6 +477,11 @@ static void test_blockdev_add_device_add_and_del_q35(void) {QTestState *qts; +if (!has_device_builtin ("virtio-blk" )) { +g_test_skip ("Device virtio-blk is not available" ); +return ; + } + qts =qtest_init ("-machine q35 -device pcie-root-port,id=p1 " "-device pcie-pci-bridge,bus=p1,id=b1" );
Signature · 1 line
2.35.3
Re: [PATCH v2 08/12] tests/qtest: drive_del-test: Skip tests that require missing devices
tests/qtest/drive_del-test.c line 17
Quoted 12 lines · Fabiano Rosas
Signed-off-by Fabiano Rosas <[email protected]>--- tests/qtest/drive_del-test.c | 65 ++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)tests/qtest/drive_del-test.c +0
-0@@ -16,6 +16,8 @@#include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h"
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thomas Huth
Reviewed-byRe: [PATCH v2 03/12] tests/qtest: Add dependence on PCIE_PORT for virtio-net-failover.c
Quoted 13 lines · Fabiano Rosas
This test depends on the presence of the pcie-root-port device. Add a build time dependency.
Signed-off-by Fabiano Rosas <[email protected]>--- tests/qtest/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tests/qtest/meson.build +0
-0
tests/qtest/meson.build qtests_i386 = \ · line 80
Quoted 9 lines
tests/qtest/meson.build +2
-1@@ -73,7 +73,8 @@ qtests_i386 = \ (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) + \ (config_host.has_key('CONFIG_POSIX') and \ config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) + \ - (config_all_devices.has_key('CONFIG_VIRTIO_NET') and \ + (config_all_devices.has_key('CONFIG_PCIE_PORT') and \ + config_all_devices.has_key('CONFIG_VIRTIO_NET') and \ config_all_devices.has_key('CONFIG_Q35') and \ config_all_devices.has_key('CONFIG_VIRTIO_PCI') and \ slirp.found() ? ['virtio-net-failover'] : []) + \
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 04/12] tests/qtest: Don't build virtio-serial-test.c if device not present
Quoted 14 lines · Fabiano Rosas
The virtconsole device might not be present in the QEMU build that is being tested.
Signed-off-by Fabiano Rosas <[email protected]>--- tests/qtest/meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tests/qtest/meson.build +0
-0@@ -255,10 +255,14 @@ qos_test_ss.add( 'virtio-net-test.c',
tests/qtest/meson.build qos_test_ss.add( · line 264
Quoted 10 lines
tests/qtest/meson.build +4
-1'virtio-rng-test.c', 'virtio-scsi-test.c', - 'virtio-serial-test.c', 'virtio-iommu-test.c', 'vmxnet3-test.c', ) + +qos_test_ss.add( + (config_all_devices.has_key('CONFIG_VIRTIO_SERIAL') ? ['virtio-serial-test.c'] : []) +)
The check below uses "if config ..." instead ... so for consistency, I think it would be nicer to do:
if config_all_devices.has_key('CONFIG_VIRTIO_SERIAL')
qos_test_ss.add(files('virtio-serial-test.c'))endif
Thomas
Quoted 3 lines
tests/qtest/meson.build +0
-0if config_host.has_key('CONFIG_POSIX') qos_test_ss.add(files('e1000e-test.c')) endif
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thomas Huth
Reviewed-byRe: [PATCH v2 06/12] test/qtest: Fix coding style in device-plug-test.c
Quoted 6 lines · Fabiano Rosas
We should not mix declarations and statements in QEMU code.
Signed-off-by Fabiano Rosas <[email protected]>--- tests/qtest/device-plug-test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thomas Huth
Reviewed-byRe: [PATCH v2 07/12] tests/qtest: Skip unplug tests that use missing devices
tests/qtest/device-plug-test.c static void test_pci_unplug_request(void) · line 69
Quoted 12 lines · Fabiano Rosas
Signed-off-by Fabiano Rosas <[email protected]>--- tests/qtest/device-plug-test.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-)tests/qtest/device-plug-test.c +0
-0@@ -68,6 +68,11 @@ static void test_pci_unplug_request(void)const char *arch =qtest_get_arch ();const char *machine_addition ="" ;
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thomas Huth
Reviewed-byRe: [PATCH v2 10/12] tests/qtest: Do not include hexloader-test if loader device is not present
Quoted 13 lines · Fabiano Rosas
Signed-off-by Fabiano Rosas <[email protected]>--- tests/qtest/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/qtest/meson.build +0
-0@@ -197,11 +197,11 @@ qtests_arm = \ (config_all_devices.has_key('CONFIG_PFLASH_CFI02') ? ['pflash-cfi02-test'] : []) + \ (config_all_devices.has_key('CONFIG_ASPEED_SOC') ? qtests_aspeed : []) + \ (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \
tests/qtest/meson.build qtests_arm = \ · line 207
Quoted 10 lines
tests/qtest/meson.build +2
-2+ (config_all_devices.has_key('CONFIG_GENERIC_LOADER') ? ['hexloader-test'] : []) + \ ['arm-cpu-features', 'microbit-test', 'test-arm-mptimer', - 'boot-serial-test', - 'hexloader-test'] + 'boot-serial-test'] # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional qtests_aarch64 = \