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 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index b7383c0..6068612 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -313,6 +313,7 @@ struct testChainData
static const char testStorageChainFormat[] =
+ "chain member: %zu\n"
"path:%s\n"
"backingStoreRaw: %s\n"
"capacity: %lld\n"
@@ -383,7 +384,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]->path),
NULLSTR(data->files[i]->expBackingStoreRaw),
data->files[i]->expCapacity,
@@ -393,7 +394,7 @@ testStorageChain(const void *args)
data->files[i]->type,
data->files[i]->format) < 0 ||
virAsprintf(&actual,
- testStorageChainFormat,
+ testStorageChainFormat, i,
NULLSTR(elt->path),
NULLSTR(elt->backingStoreRaw),
elt->capacity,
@@ -407,7 +408,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);
--
1.9.3