[libvirt] [PATCH 3/3] virGetLastErrorMessage in nodeinfotest

Cole Robinson crobinso at redhat.com
Thu May 19 18:12:39 UTC 2016


I suggest:

  tests: nodeinfotest: Convert to virGetLastErrorMessage()

Also, make this patch #1. So patch one adjusts this specific case, then patch
#2 adjusts the rest of tests/, then patch #3 adjusts the rest of the code. It
cascades nicely :)

On 05/19/2016 01:07 PM, Jovanka Gulicoska wrote:
> Use virGetLastErrorMessage in nodeinfotest.c to preserve the behavior
> in previous patches

No need to mention the file in the commit body, it's in the subject and the
diff. I suggest

  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..cc74ab5 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);
> +            char const *msg = virGetLastErrorMessage();
> +

We use 'const char *' in the code much more often than this format... they are
functionally identical but better to stick with conventions

Thanks,
Cole




More information about the libvir-list mailing list