Re: [PATCH 2/3] Use mockup cache

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

 



On Thu, Sep 03, 2015 at 03:49:47PM +0300, Pavel Fedin wrote:
> 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>
> ---
>  tests/qemuagenttest.c    | 18 +++++++++++++-----
>  tests/qemuargv2xmltest.c | 19 +++++++++----------
>  tests/qemuhotplugtest.c  | 32 +++++++++++++++++---------------
>  tests/qemuxml2argvtest.c | 17 ++++++++---------
>  tests/qemuxml2xmltest.c  | 16 +++++++++++-----
>  tests/qemuxmlnstest.c    | 17 +++++++++--------
>  6 files changed, 67 insertions(+), 52 deletions(-)
>  mode change 100644 => 100755 tests/qemuagenttest.c
>  mode change 100644 => 100755 tests/qemuargv2xmltest.c
>  mode change 100644 => 100755 tests/qemuhotplugtest.c
>  mode change 100644 => 100755 tests/qemuxml2argvtest.c
>  mode change 100644 => 100755 tests/qemuxml2xmltest.c
>  mode change 100644 => 100755 tests/qemuxmlnstest.c

Looks good to me, but domainsnapshotxml2xmltest crashes with this series
applied.

> diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
> old mode 100644
> new mode 100755
> index ea85913..bc20431
> --- a/tests/qemuargv2xmltest.c
> +++ b/tests/qemuargv2xmltest.c
> @@ -145,15 +145,15 @@ mymain(void)
>  {
>      int ret = 0;
>  
> -    driver.config = virQEMUDriverConfigNew(false);
> -    if (driver.config == NULL)
> +    if (qemuTestDriverInit(&driver) < 0)
>          return EXIT_FAILURE;
>  
> -    if ((driver.caps = testQemuCapsInit()) == NULL)
> -        return EXIT_FAILURE;
> -
> -    if (!(driver.xmlopt = virQEMUDriverCreateXMLConf(&driver)))
> -        return EXIT_FAILURE;

qemuTestDriverInit could be introduced in a separate patch before
qemuTestCapsCacheInsert, only moving the existing initializations from
all the separate tests. This patch would then focus only on adding the
cache-related code.

> +    /* We use a single empty capability set for all tests here */
> +    qemuTestCapsName = "empty";
> +    ret = qemuTestCapsCacheInsert(driver.qemuCapsCache, "empty",
> +                                  NULL);

Can this be done in qemuTestDriverInit instead? It seems most of the
test need the cache to be initialized, but only a few need to create
their custom capabilities.

> +    if (ret < 0)
> +        goto cleanup;
>  
>  # define DO_TEST_FULL(name, flags)                                      \
>      do {                                                                \

> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> old mode 100644
> new mode 100755
> index d4432df..1fc767e
> --- 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;
> +

This cache is tied to the test name, so it will only be used once.
We should probably remove it afterwards, there's no need to keep >500
entries in a hash table of size 10.

>      result = testCompareXMLToArgvFiles(xml, args, info->extraFlags,
>                                         info->migrateFrom, info->migrateFd,
>                                         flags);

Jan

Attachment: signature.asc
Description: Digital signature

--
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]