]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: virstoragetest: Fix output when hitting errors
authorPeter Krempa <pkrempa@redhat.com>
Mon, 26 May 2014 14:39:38 +0000 (16:39 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 13 Jun 2014 08:57:43 +0000 (10:57 +0200)
When the test is failing but the debug output isn't enabled the
resulting line would look ugly like and would not contain the actual
difference.

TEST: virstoragetest
      .................chain member 1!chain member 1!chain member 1!

Store the member index in the actual checked string to hide this problem

tests/virstoragetest.c

index bd593b0e5815439684805ce21c04568d729564cb..cdd479428031a88dcc02f6d9f668980ecaba4245 100644 (file)
@@ -314,6 +314,7 @@ struct testChainData
 
 
 static const char testStorageChainFormat[] =
+    "chain member: %zu\n"
     "store: %s\n"
     "backingStoreRaw: %s\n"
     "capacity: %lld\n"
@@ -385,7 +386,7 @@ testStorageChain(const void *args)
         expRelDir = isAbs ? data->files[i]->relDirAbs
             : data->files[i]->relDirRel;
         if (virAsprintf(&expect,
-                        testStorageChainFormat,
+                        testStorageChainFormat, i,
                         NULLSTR(data->files[i]->expBackingStore),
                         NULLSTR(data->files[i]->expBackingStoreRaw),
                         data->files[i]->expCapacity,
@@ -396,7 +397,7 @@ testStorageChain(const void *args)
                         data->files[i]->type,
                         data->files[i]->format) < 0 ||
             virAsprintf(&actual,
-                        testStorageChainFormat,
+                        testStorageChainFormat, i,
                         NULLSTR(elt->backingStore ? elt->backingStore->path : NULL),
                         NULLSTR(elt->backingStoreRaw),
                         elt->capacity,
@@ -411,7 +412,6 @@ testStorageChain(const void *args)
             goto cleanup;
         }
         if (STRNEQ(expect, actual)) {
-            fprintf(stderr, "chain member %zu", i);
             virtTestDifference(stderr, expect, actual);
             VIR_FREE(expect);
             VIR_FREE(actual);