[libvirt] [PATCH 08/10] tests: qemucapabilities: Test commands used to query capabilities
John Ferlan
jferlan at redhat.com
Fri Jun 8 02:02:06 UTC 2018
On 06/04/2018 09:58 AM, Peter Krempa wrote:
> Use qemuMonitorTestNewFromFileFull which allows to test commands used
> along with providing replies. This has two advantages:
>
> 1) It's easier to see which command was used when looking at the files
> 2) We check that the used commands are actually in the correct order
>
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
> tests/qemucapabilitiestest.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
With top of tree this one fails make check, but I assume that has to do
with changes in files since you posted... perhaps it's a combo of this
and the previous patch.
So I'll stop here and wait to see how things work themselves out.
John
> diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
> index 6981e973a6..633389f263 100644
> --- a/tests/qemucapabilitiestest.c
> +++ b/tests/qemucapabilitiestest.c
> @@ -32,7 +32,7 @@
> typedef struct _testQemuData testQemuData;
> typedef testQemuData *testQemuDataPtr;
> struct _testQemuData {
> - virDomainXMLOptionPtr xmlopt;
> + virQEMUDriver driver;
> const char *archName;
> const char *base;
> };
> @@ -42,7 +42,7 @@ static int
> testQemuCaps(const void *opaque)
> {
> int ret = -1;
> - const testQemuData *data = opaque;
> + testQemuData *data = (void *) opaque;
> char *repliesFile = NULL;
> char *capsFile = NULL;
> qemuMonitorTestPtr mon = NULL;
> @@ -55,7 +55,7 @@ testQemuCaps(const void *opaque)
> abs_srcdir, data->base, data->archName) < 0)
> goto cleanup;
>
> - if (!(mon = qemuMonitorTestNewFromFile(repliesFile, data->xmlopt, false)))
> + if (!(mon = qemuMonitorTestNewFromFileFull(repliesFile, &data->driver, NULL)))
> goto cleanup;
>
> if (!(capsActual = virQEMUCapsNew()) ||
> @@ -139,7 +139,6 @@ static int
> mymain(void)
> {
> int ret = 0;
> - virQEMUDriver driver;
> testQemuData data;
>
> #if !WITH_YAJL
> @@ -148,13 +147,11 @@ mymain(void)
> #endif
>
> if (virThreadInitialize() < 0 ||
> - qemuTestDriverInit(&driver) < 0)
> + qemuTestDriverInit(&data.driver) < 0)
> return EXIT_FAILURE;
>
> virEventRegisterDefaultImpl();
>
> - data.xmlopt = driver.xmlopt;
> -
> #define DO_TEST(arch, name) \
> do { \
> data.archName = arch; \
> @@ -200,7 +197,7 @@ mymain(void)
> * "tests/qemucapsfixreplies foo.replies" to fix the replies ids.
> */
>
> - qemuTestDriverFree(&driver);
> + qemuTestDriverFree(&data.driver);
>
> return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
> }
>
More information about the libvir-list
mailing list