Message ID | 20241210204349.723590-18-alex.bennee@linaro.org |
---|---|
State | New |
Headers | show |
Series | testing/next: functional tests and qtest timers | expand |
On 10/12/2024 21.43, Alex Bennée wrote: > In the qtest environment time will not step forward if the system is > paused (timers disabled) or we have no timer events to fire. As a > result VirtIO events are responded to directly and we don't need to > step time forward. > > Potentially the clock_step calls could be removed all together but as > we may implement async behaviour later lets just move them to after > the principle check for now. > > Future qtest patches will assert that time actually changes with a s/with/when/ ? > step is requested. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > --- > tests/qtest/libqos/virtio.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) With the description fixed: Reviewed-by: Thomas Huth <thuth@redhat.com>
diff --git a/tests/qtest/libqos/virtio.c b/tests/qtest/libqos/virtio.c index a21b6eee9c..64682e66b8 100644 --- a/tests/qtest/libqos/virtio.c +++ b/tests/qtest/libqos/virtio.c @@ -170,10 +170,10 @@ void qvirtio_wait_queue_isr(QTestState *qts, QVirtioDevice *d, gint64 start_time = g_get_monotonic_time(); for (;;) { - qtest_clock_step(qts, 100); if (d->bus->get_queue_isr_status(d, vq)) { return; } + qtest_clock_step(qts, 100); g_assert(g_get_monotonic_time() - start_time <= timeout_us); } } @@ -192,8 +192,8 @@ uint8_t qvirtio_wait_status_byte_no_isr(QTestState *qts, QVirtioDevice *d, uint8_t val; while ((val = qtest_readb(qts, addr)) == 0xff) { - qtest_clock_step(qts, 100); g_assert(!d->bus->get_queue_isr_status(d, vq)); + qtest_clock_step(qts, 100); g_assert(g_get_monotonic_time() - start_time <= timeout_us); } return val; @@ -219,7 +219,6 @@ void qvirtio_wait_used_elem(QTestState *qts, QVirtioDevice *d, for (;;) { uint32_t got_desc_idx; - qtest_clock_step(qts, 100); if (d->bus->get_queue_isr_status(d, vq) && qvirtqueue_get_buf(qts, vq, &got_desc_idx, len)) { @@ -227,6 +226,7 @@ void qvirtio_wait_used_elem(QTestState *qts, QVirtioDevice *d, return; } + qtest_clock_step(qts, 100); g_assert(g_get_monotonic_time() - start_time <= timeout_us); } }
In the qtest environment time will not step forward if the system is paused (timers disabled) or we have no timer events to fire. As a result VirtIO events are responded to directly and we don't need to step time forward. Potentially the clock_step calls could be removed all together but as we may implement async behaviour later lets just move them to after the principle check for now. Future qtest patches will assert that time actually changes with a step is requested. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> --- tests/qtest/libqos/virtio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)