On 01.09.2017 20:03, Eric Blake wrote: > 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 were several spots that were constructing a JSON > string, then passing that through qmp() as the format, rather > than directly using qmp() to construct the JSON. Fixing that > gets us one step closer to enabling -Wformat checking on > constructed JSON. > > Signed-off-by: Eric Blake <ebl...@redhat.com> > --- > tests/libqos/libqos.h | 1 - > tests/ahci-test.c | 83 > +++++++++++++++++++++++------------------------- > tests/libqos/ahci.c | 45 +++++++++++++------------- > tests/libqos/libqos-pc.c | 2 +- > tests/libqos/libqos.c | 37 ++++++--------------- > 5 files changed, 73 insertions(+), 95 deletions(-)
Might be easier to review if you'd split the changes to libqos.c into a separate patch. But anyway: Reviewed-by: Thomas Huth <th...@redhat.com>