]> xenbits.xensource.com Git - libvirt.git/commitdiff
nodeinfotest: Print libvirt error on failure
authorJiri Denemark <jdenemar@redhat.com>
Mon, 23 Aug 2010 14:48:33 +0000 (16:48 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 24 Aug 2010 08:10:16 +0000 (10:10 +0200)
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

index d3c500d98951bd3a7e310359d89f927b680bd703..d256c532339a9c0f42b8c33ccbaf3b98fad63d22 100644 (file)
@@ -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;
     }