qemuxml2argvtest: Append newline to tested error messages

'virTestCompareToFile' automatically fixes newline if it is not present
in the input string but is present in the file. In this case we need to
append the erorr messages with a newline so that
VIR_TEST_REGENERATE_OUTPUT produces files which will pass syntax-check.

Fixes: 9ec77eef2d
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-09-24 13:09:47 +02:00
parent 2fefbd03ab
commit 51d8c2f061

View File

@ -621,9 +621,11 @@ testCompareXMLToArgv(const void *data)
VIR_TEST_DEBUG("no error was reported for expected parse error");
goto cleanup;
}
if (flags & FLAG_EXPECT_PARSE_ERROR &&
virTestCompareToFile(err->message, info->errfile) >= 0)
goto ok;
if (flags & FLAG_EXPECT_PARSE_ERROR) {
g_autofree char *tmperr = g_strdup_printf("%s\n", NULLSTR(err->message));
if (virTestCompareToFile(tmperr, info->errfile) >= 0)
goto ok;
}
goto cleanup;
}
if (flags & FLAG_EXPECT_PARSE_ERROR) {
@ -663,9 +665,11 @@ testCompareXMLToArgv(const void *data)
VIR_TEST_DEBUG("no error was reported for expected failure");
goto cleanup;
}
if (flags & FLAG_EXPECT_FAILURE &&
virTestCompareToFile(err->message, info->errfile) >= 0)
goto ok;
if (flags & FLAG_EXPECT_FAILURE) {
g_autofree char *tmperr = g_strdup_printf("%s\n", NULLSTR(err->message));
if (virTestCompareToFile(tmperr, info->errfile) >= 0)
goto ok;
}
goto cleanup;
}
if (flags & FLAG_EXPECT_FAILURE) {