Re: [PATCH 3/4] Use mockup cache

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

 



On 15.09.2015 10:05, Ján Tomko wrote:
> From: Pavel Fedin <p.fedin@xxxxxxxxxxx>
> 
> Use the new API in order to correctly add capability sets to the cache
> before parsing XML files
> 
> Signed-off-by: Pavel Fedin <p.fedin@xxxxxxxxxxx>

s/^/tests: / in $SUBJ.

> ---
>  tests/qemuhotplugtest.c  | 23 +++++++++++++++--------
>  tests/qemuxml2argvtest.c |  6 ++++++
>  tests/qemuxmlnstest.c    |  6 ++++++
>  3 files changed, 27 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
> index 3cf7f36..109d820 100644
> --- a/tests/qemuhotplugtest.c
> +++ b/tests/qemuhotplugtest.c
> @@ -57,7 +57,7 @@ static int
>  qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
>                           virDomainObjPtr *vm,
>                           const char *domxml,
> -                         bool event)
> +                         bool event, const char *testname)
>  {
>      int ret = -1;
>      qemuDomainObjPrivatePtr priv = NULL;
> @@ -65,12 +65,6 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
>      if (!(*vm = virDomainObjNew(xmlopt)))
>          goto cleanup;
>  
> -    if (!((*vm)->def = virDomainDefParseString(domxml,
> -                                               driver.caps,
> -                                               driver.xmlopt,
> -                                               VIR_DOMAIN_DEF_PARSE_INACTIVE)))
> -        goto cleanup;
> -
>      priv = (*vm)->privateData;
>  
>      if (!(priv->qemuCaps = virQEMUCapsNew()))
> @@ -85,6 +79,18 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
>      if (event)
>          virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_DEL_EVENT);
>  
> +    qemuTestCapsName = testname;
> +    ret = qemuTestCapsCacheInsert(driver.qemuCapsCache, testname,
> +                                  priv->qemuCaps);


I think that @qemuTestCapsName should be set in
qemuTestCapsCacheInsert(). On its successful return.

> +    if (ret < 0)
> +        goto cleanup;
> +
> +    if (!((*vm)->def = virDomainDefParseString(domxml,
> +                                               driver.caps,
> +                                               driver.xmlopt,
> +                                               VIR_DOMAIN_DEF_PARSE_INACTIVE)))
> +        goto cleanup;
> +
>      if (qemuDomainAssignAddresses((*vm)->def, priv->qemuCaps, *vm) < 0)
>          goto cleanup;
>  
> @@ -243,7 +249,8 @@ testQemuHotplug(const void *data)
>          vm = test->vm;
>      } else {
>          if (qemuHotplugCreateObjects(driver.xmlopt, &vm, domain_xml,
> -                                     test->deviceDeletedEvent) < 0)
> +                                     test->deviceDeletedEvent,
> +                                     test->domain_filename) < 0)
>              goto cleanup;
>      }
>  
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index cd12356..1fc767e 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -423,6 +423,12 @@ testCompareXMLToArgvHelper(const void *data)
>      if (virQEMUCapsGet(info->extraFlags, QEMU_CAPS_ENABLE_FIPS))
>          flags |= FLAG_FIPS;
>  
> +    qemuTestCapsName = info->name;
> +    result = qemuTestCapsCacheInsert(driver.qemuCapsCache, info->name,
> +                                     info->extraFlags);
> +    if (result < 0)
> +        goto cleanup;
> +
>      result = testCompareXMLToArgvFiles(xml, args, info->extraFlags,
>                                         info->migrateFrom, info->migrateFd,
>                                         flags);
> diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
> index 40e32dc..65bf1d3 100644
> --- a/tests/qemuxmlnstest.c
> +++ b/tests/qemuxmlnstest.c
> @@ -179,6 +179,12 @@ testCompareXMLToArgvHelper(const void *data)
>                      abs_srcdir, info->name) < 0)
>          goto cleanup;
>  
> +    qemuTestCapsName = info->name;
> +    result = qemuTestCapsCacheInsert(driver.qemuCapsCache, info->name,
> +                                     info->extraFlags);
> +    if (result < 0)
> +        goto cleanup;
> +
>      result = testCompareXMLToArgvFiles(xml, args, info->extraFlags,
>                                         info->migrateFrom, info->migrateFd,
>                                         info->json, info->expectError);
> 

Otherwise looking good.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]