qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 17/20] tests/qtest: move clock_steps to after checks


From: Alex Bennée
Subject: [PATCH 17/20] tests/qtest: move clock_steps to after checks
Date: Tue, 10 Dec 2024 20:43:46 +0000

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(-)

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);
     }
 }
-- 
2.39.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]