summaryrefslogtreecommitdiffstats
path: root/tests/libqos/virtio.c
diff options
context:
space:
mode:
authorPeter Maydell2019-09-05 18:09:13 +0200
committerPeter Maydell2019-09-05 18:09:13 +0200
commit90b1e3afd33226b6078fec6d77a18373712a975c (patch)
tree30ef7417309fe5241eaa547562d50b11f80df76c /tests/libqos/virtio.c
parentMerge remote-tracking branch 'remotes/berrange/tags/docs-pull-request' into s... (diff)
parentgitlab-ci.yml: Install libattr-devel and libcap-devel to test virtio-9p (diff)
downloadqemu-90b1e3afd33226b6078fec6d77a18373712a975c.tar.gz
qemu-90b1e3afd33226b6078fec6d77a18373712a975c.tar.xz
qemu-90b1e3afd33226b6078fec6d77a18373712a975c.zip
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-09-05-v2' into staging
- Make the core libqtest library independent from global_qtest - Clean up docs from hard-coded qemu-system-* names - Install libattr-dev and libcap-dev in gitlab-ci to test virtio-9p # gpg: Signature made Thu 05 Sep 2019 15:52:30 BST # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * remotes/huth-gitlab/tags/pull-request-2019-09-05-v2: gitlab-ci.yml: Install libattr-devel and libcap-devel to test virtio-9p qemu-doc: Do not hard-code the name of the QEMU binary tests/vm: Take the J=x setting into account for the vm-boot-ssh targets, too tests/libqtest: Use libqtest-single.h in tests that require global_qtest tests/libqtest: Move global_test wrapper function into a separate header tests: Remove unnecessary global_qtest references tests/libqos: Replace clock_step with qtest_clock_step in virtio code tests/libqos/e1000e: Make e1000e libqos functions independent from global_qtest tests/migration: Do not use functions anymore that rely on global_qtest Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/libqos/virtio.c')
-rw-r--r--tests/libqos/virtio.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
index 91ce06954b..0ae9956fc8 100644
--- a/tests/libqos/virtio.c
+++ b/tests/libqos/virtio.c
@@ -82,13 +82,13 @@ void qvirtio_set_driver_ok(QVirtioDevice *d)
VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_ACKNOWLEDGE);
}
-void qvirtio_wait_queue_isr(QVirtioDevice *d,
+void qvirtio_wait_queue_isr(QTestState *qts, QVirtioDevice *d,
QVirtQueue *vq, gint64 timeout_us)
{
gint64 start_time = g_get_monotonic_time();
for (;;) {
- clock_step(100);
+ qtest_clock_step(qts, 100);
if (d->bus->get_queue_isr_status(d, vq)) {
return;
}
@@ -109,8 +109,8 @@ uint8_t qvirtio_wait_status_byte_no_isr(QTestState *qts, QVirtioDevice *d,
gint64 start_time = g_get_monotonic_time();
uint8_t val;
- while ((val = readb(addr)) == 0xff) {
- clock_step(100);
+ while ((val = qtest_readb(qts, addr)) == 0xff) {
+ qtest_clock_step(qts, 100);
g_assert(!d->bus->get_queue_isr_status(d, vq));
g_assert(g_get_monotonic_time() - start_time <= timeout_us);
}
@@ -137,7 +137,7 @@ void qvirtio_wait_used_elem(QTestState *qts, QVirtioDevice *d,
for (;;) {
uint32_t got_desc_idx;
- clock_step(100);
+ qtest_clock_step(qts, 100);
if (d->bus->get_queue_isr_status(d, vq) &&
qvirtqueue_get_buf(qts, vq, &got_desc_idx, len)) {
@@ -151,15 +151,7 @@ void qvirtio_wait_used_elem(QTestState *qts, QVirtioDevice *d,
void qvirtio_wait_config_isr(QVirtioDevice *d, gint64 timeout_us)
{
- gint64 start_time = g_get_monotonic_time();
-
- for (;;) {
- clock_step(100);
- if (d->bus->get_config_isr_status(d)) {
- return;
- }
- g_assert(g_get_monotonic_time() - start_time <= timeout_us);
- }
+ d->bus->wait_config_isr_status(d, timeout_us);
}
void qvring_init(QTestState *qts, const QGuestAllocator *alloc, QVirtQueue *vq,