diff --git a/tests/virbuftest.c b/tests/virbuftest.c index febe6e456c..a6dcae6f52 100644 --- a/tests/virbuftest.c +++ b/tests/virbuftest.c @@ -108,6 +108,10 @@ static int testBufAutoIndent(const void *data ATTRIBUTE_UNUSED) } virBufferAdjustIndent(buf, 2); virBufferAddLit(buf, "1"); + if (virBufferError(buf)) { + TEST_ERROR("Buffer had error"); + return -1; + } if (STRNEQ(virBufferCurrentContent(buf), " 1")) { TEST_ERROR("Wrong content"); ret = -1; @@ -134,6 +138,11 @@ static int testBufAutoIndent(const void *data ATTRIBUTE_UNUSED) virBufferEscapeShell(buf, " 11"); virBufferAddChar(buf, '\n'); + if (virBufferError(buf)) { + TEST_ERROR("Buffer had error"); + return -1; + } + result = virBufferContentAndReset(buf); if (!result || STRNEQ(result, expected)) { virtTestDifference(stderr, expected, result); @@ -166,6 +175,11 @@ static int testBufTrim(const void *data ATTRIBUTE_UNUSED) virBufferTrim(buf, "b,,", 1); virBufferTrim(buf, ",", -1); + if (virBufferError(buf)) { + TEST_ERROR("Buffer had error"); + return -1; + } + result = virBufferContentAndReset(buf); if (!result || STRNEQ(result, expected)) { virtTestDifference(stderr, expected, result);