[libvirt] [PATCH v3 1/3] tests: nodeinfotest: Convert to virGetLastErrorMessage()

Cole Robinson crobinso at redhat.com
Thu May 19 19:22:58 UTC 2016


I pushed patches #2 and #3. Thanks!

On 05/19/2016 03:10 PM, Jovanka Gulicoska wrote:
> Remove unnecessary virSaveLastError() usage and convert to
> virGetLastErrorMessage()
> ---
>  tests/nodeinfotest.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
> index d8eace5..7eeb297 100644
> --- a/tests/nodeinfotest.c
> +++ b/tests/nodeinfotest.c
> @@ -44,10 +44,10 @@ linuxTestCompareFiles(char *sysfs_prefix,
>      memset(&nodeinfo, 0, sizeof(nodeinfo));
>      if (linuxNodeInfoCPUPopulate(sysfs_prefix, cpuinfo, arch, &nodeinfo) < 0) {
>          if (virTestGetDebug()) {
> -            virErrorPtr error = virSaveLastError();
> -            if (error && error->code != VIR_ERR_OK)
> -                VIR_TEST_DEBUG("\n%s\n", error->message);
> -            virFreeError(error);
> +            const char *msg = virGetLastErrorMessage();
> +
> +            if (msg)
> +                VIR_TEST_DEBUG("\n%s\n", msg);
>          }
>          VIR_FORCE_FCLOSE(cpuinfo);
>          goto fail;
> 

doh, I screwed this up when I gave you the recommendation for using
virGetLastErrorMessage() here, since it basically never returns NULL, so that
check will always trigger. I'll send a patch to fix this case properly

Thanks,
Cole




More information about the libvir-list mailing list