tests: Add newlines with VIR_TEST_REGENERATE_OUTPUT

Since test files are formatted predictably nowadays, we can make
VIR_TEST_REGENERATE_OUTPUT handle most cases for us with a simple
replacement. test-wrap-argv.pl is still canon, but this bit makes
it easier to confirm test output changes during active development.
This commit is contained in:
Cole Robinson 2016-01-04 14:31:58 -05:00
parent f988ecfb34
commit 825d357a46

View File

@ -469,10 +469,19 @@ virtTestDifferenceFullInternal(FILE *stream,
actualStart = actual; actualStart = actual;
actualEnd = actual + (strlen(actual)-1); actualEnd = actual + (strlen(actual)-1);
if (regenerate && virTestGetRegenerate() > 0) { if (regenerate && (virTestGetRegenerate() > 0) && expectName && actual) {
if (expectName && actual && char *regencontent;
virFileWriteStr(expectName, actual, 0666) < 0)
/* Try to properly indent qemu argv files */
if (!(regencontent = virStringReplace(actual, " -", " \\\n-")))
return -1; return -1;
if (expectName && actual &&
virFileWriteStr(expectName, regencontent, 0666) < 0) {
VIR_FREE(regencontent);
return -1;
}
VIR_FREE(regencontent);
} }
if (!virTestGetDebug()) if (!virTestGetDebug())