[libvirt] [PATCH] nodeinfotest: Print libvirt error on failure

If linuxNodeInfoCPUPopulate() fails, the test would just print "FAILED" which is not very informative. It's better to print the real error. --- tests/nodeinfotest.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c index d3c500d..d256c53 100644 --- a/tests/nodeinfotest.c +++ b/tests/nodeinfotest.c @@ -43,6 +43,12 @@ static int linuxTestCompareFiles(const char *cpuinfofile, const char *outputfile memset(&nodeinfo, 0, sizeof(nodeinfo)); if (linuxNodeInfoCPUPopulate(cpuinfo, &nodeinfo) < 0) { + if (virTestGetDebug()) { + virErrorPtr error = virSaveLastError(); + if (error && error->code != VIR_ERR_OK) + fprintf(stderr, "\n%s\n", error->message); + virFreeError(error); + } fclose(cpuinfo); return -1; } -- 1.7.2

On 08/23/2010 09:03 AM, Jiri Denemark wrote:
If linuxNodeInfoCPUPopulate() fails, the test would just print "FAILED" which is not very informative. It's better to print the real error. --- tests/nodeinfotest.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

If linuxNodeInfoCPUPopulate() fails, the test would just print "FAILED" which is not very informative. It's better to print the real error. --- tests/nodeinfotest.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
ACK.
And I pushed this one too. Thanks. Jirka
participants (2)
-
Eric Blake
-
Jiri Denemark