[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH v6 17/29] ahci-test: Drop dependenc
From: |
Thomas Huth |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH v6 17/29] ahci-test: Drop dependence on global_qtest |
Date: |
Tue, 5 Sep 2017 12:32:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
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 <address@hidden>
> ---
> 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 <address@hidden>