Message ID | 20250120210212.3890255-3-alex.bennee@linaro.org |
---|---|
State | New |
Headers | show |
Series | testing/next (qtest timer stuff) | expand |
On 20/01/2025 22.02, Alex Bennée wrote: > This replicates the changes from 92cb8f8bf6 (tests/qtest: remove > clock_steps from virtio tests) as there are no timers in the virtio > code. We still busy wait and timeout though. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > --- > tests/qtest/libqos/virtio-pci-modern.c | 6 ++---- > tests/qtest/libqos/virtio-pci.c | 6 ++---- > 2 files changed, 4 insertions(+), 8 deletions(-) > > diff --git a/tests/qtest/libqos/virtio-pci-modern.c b/tests/qtest/libqos/virtio-pci-modern.c > index 18d118866f..f6e3e32891 100644 > --- a/tests/qtest/libqos/virtio-pci-modern.c > +++ b/tests/qtest/libqos/virtio-pci-modern.c > @@ -173,13 +173,11 @@ static bool get_config_isr_status(QVirtioDevice *d) > > static void wait_config_isr_status(QVirtioDevice *d, gint64 timeout_us) > { > - QVirtioPCIDevice *dev = container_of(d, QVirtioPCIDevice, vdev); > gint64 start_time = g_get_monotonic_time(); > > - do { > + while (!get_config_isr_status(d)) { > g_assert(g_get_monotonic_time() - start_time <= timeout_us); > - qtest_clock_step(dev->pdev->bus->qts, 100); > - } while (!get_config_isr_status(d)); > + } Trailing white space in above line? Apart from that nit: Reviewed-by: Thomas Huth <thuth@redhat.com>
diff --git a/tests/qtest/libqos/virtio-pci-modern.c b/tests/qtest/libqos/virtio-pci-modern.c index 18d118866f..f6e3e32891 100644 --- a/tests/qtest/libqos/virtio-pci-modern.c +++ b/tests/qtest/libqos/virtio-pci-modern.c @@ -173,13 +173,11 @@ static bool get_config_isr_status(QVirtioDevice *d) static void wait_config_isr_status(QVirtioDevice *d, gint64 timeout_us) { - QVirtioPCIDevice *dev = container_of(d, QVirtioPCIDevice, vdev); gint64 start_time = g_get_monotonic_time(); - do { + while (!get_config_isr_status(d)) { g_assert(g_get_monotonic_time() - start_time <= timeout_us); - qtest_clock_step(dev->pdev->bus->qts, 100); - } while (!get_config_isr_status(d)); + } } static void queue_select(QVirtioDevice *d, uint16_t index) diff --git a/tests/qtest/libqos/virtio-pci.c b/tests/qtest/libqos/virtio-pci.c index 485b8f6b7e..002bf8b8c2 100644 --- a/tests/qtest/libqos/virtio-pci.c +++ b/tests/qtest/libqos/virtio-pci.c @@ -171,13 +171,11 @@ static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d) static void qvirtio_pci_wait_config_isr_status(QVirtioDevice *d, gint64 timeout_us) { - QVirtioPCIDevice *dev = container_of(d, QVirtioPCIDevice, vdev); gint64 start_time = g_get_monotonic_time(); - do { + while (!qvirtio_pci_get_config_isr_status(d)) { g_assert(g_get_monotonic_time() - start_time <= timeout_us); - qtest_clock_step(dev->pdev->bus->qts, 100); - } while (!qvirtio_pci_get_config_isr_status(d)); + } } static void qvirtio_pci_queue_select(QVirtioDevice *d, uint16_t index)
This replicates the changes from 92cb8f8bf6 (tests/qtest: remove clock_steps from virtio tests) as there are no timers in the virtio code. We still busy wait and timeout though. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> --- tests/qtest/libqos/virtio-pci-modern.c | 6 ++---- tests/qtest/libqos/virtio-pci.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-)