qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-3.2 3/7] ahci-test: Drop dependence on globa


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH for-3.2 3/7] ahci-test: Drop dependence on global_qtest
Date: Tue, 27 Nov 2018 08:55:02 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0

On 11/12/18 1:08 PM, Thomas Huth wrote:
From: Eric Blake <address@hidden>

Managing parallel connections to two different monitors via
the implicit global_qtest makes it hard to copy-and-paste code
to tests that are not aware of the implicit state; the
management of global_qtest is even harder to follow because
it was masked behind set_context().

Instead, explicitly pass QTestState* around (generally, by
reusing the member already present in ahci->parent QOSState),
and call explicit qtest_* functions on all places that
interact with a monitor.

We can assert that the conversion is correct by checking that
global_qtest remains NULL throughout the test (a later patch
that changes global_qtest to not be a public global variable
will drop the assertions).

Bonus: there was one spots that was creating a needless temporary
variable to execute the 'cont' command, rather than just directly
passing the literal command through qtest_qmp().  Fixing that
gets us one step closer to enabling -Wformat checking on
constructed JSON.

This paragraph is now stale, and can be deleted, thanks to commit 62fff696d.


Signed-off-by: Eric Blake <address@hidden>
[thuth: rebased patch to current master branch]
Signed-off-by: Thomas Huth <address@hidden>
---
  tests/ahci-test.c     | 81 +++++++++++++++++++++++++--------------------------
  tests/libqos/libqos.c |  9 ------
  tests/libqos/libqos.h |  1 -
  3 files changed, 39 insertions(+), 52 deletions(-)

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

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