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

Re: [libvirt] [PATCH 1/4] tests: Better support for VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES



On 01/28/14 00:23, Jiri Denemark wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1049391
> 
> virConnectBaselineCPU test results are now stored in different files
> depending on VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES.
> 
> Signed-off-by: Jiri Denemark <jdenemar redhat com>
> ---
>  tests/cputest.c                                    | 22 +++++++++++++++++++---
>  ...ne-3-result.xml => x86-baseline-3-expanded.xml} |  0
>  2 files changed, 19 insertions(+), 3 deletions(-)
>  rename tests/cputestdata/{x86-baseline-3-result.xml => x86-baseline-3-expanded.xml} (100%)
> 
> diff --git a/tests/cputest.c b/tests/cputest.c
> index 20bc544..247fd10 100644
> --- a/tests/cputest.c
> +++ b/tests/cputest.c
> @@ -326,6 +326,7 @@ cpuTestBaseline(const void *arg)
>      virCPUDefPtr baseline = NULL;
>      unsigned int ncpus = 0;
>      char *result = NULL;
> +    const char *suffix;
>      size_t i;
>  
>      if (!(cpus = cpuTestLoadMultiXML(data->arch, data->name, &ncpus)))
> @@ -345,7 +346,11 @@ cpuTestBaseline(const void *arg)
>      if (!baseline)
>          goto cleanup;
>  
> -    if (virAsprintf(&result, "%s-result", data->name) < 0)
> +    if (data->flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES)
> +        suffix = "expanded";
> +    else
> +        suffix = "result";
> +    if (virAsprintf(&result, "%s-%s", data->name, suffix) < 0)
>          goto cleanup;
>  
>      if (cpuTestCompareXML(data->arch, baseline, result, 0) < 0)
> @@ -537,8 +542,19 @@ mymain(void)
>      } while (0)
>  
>  #define DO_TEST_BASELINE(arch, name, flags, result)                     \
> -    DO_TEST(arch, API_BASELINE, name, NULL, "baseline-" name,           \
> -            NULL, 0, NULL, flags, result)
> +    do {                                                                \
> +        const char *suffix = "";                                        \
> +        char *label;                                                    \
> +        if ((flags) & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES)         \
> +            suffix = " (expanded)";                                     \
> +        if (virAsprintf(&label, "%s%s", name, suffix) < 0) {            \
> +            ret = -1;                                                   \

This will make the one single test that fails allocation here fail
silently - without even printing the test header - but I don't think
this is worth working around in the test suite. Mainly because OOM is
really unlikely.

> +        } else {                                                        \
> +            DO_TEST(arch, API_BASELINE, label, NULL, "baseline-" name,  \
> +                    NULL, 0, NULL, flags, result);                      \
> +        }                                                               \
> +        VIR_FREE(label);                                                \
> +    } while (0)
>  
>  #define DO_TEST_HASFEATURE(arch, host, feature, result)                 \
>      DO_TEST(arch, API_HAS_FEATURE,                                      \
> diff --git a/tests/cputestdata/x86-baseline-3-result.xml b/tests/cputestdata/x86-baseline-3-expanded.xml
> similarity index 100%
> rename from tests/cputestdata/x86-baseline-3-result.xml
> rename to tests/cputestdata/x86-baseline-3-expanded.xml
> 

ACK.

Attachment: signature.asc
Description: OpenPGP digital signature


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