qemuxml2arvtest: Ensure newline at the end of generated .args files

The switch to internal linebreaking of arguments caused a problem when
generating .args files with VIR_TEST_REGENERATE_OUTPUT as the last
argument isn't terminated with a newline.

Switch to using virCommandToStringBuf and append a newline.

Fixes: 0046e0b1c2
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-06-11 09:45:12 +02:00
parent 2d018bf769
commit 9a82146fcd

View File

@ -634,6 +634,7 @@ testCompareXMLToArgv(const void *data)
{
struct testQemuInfo *info = (void *) data;
g_autofree char *migrateURI = NULL;
g_auto(virBuffer) actualBuf = VIR_BUFFER_INITIALIZER;
g_autofree char *actualargv = NULL;
unsigned int flags = info->flags;
unsigned int parseFlags = info->parseFlags;
@ -788,9 +789,12 @@ testCompareXMLToArgv(const void *data)
if (testCompareXMLToArgvValidateSchema(&driver, migrateURI, info, flags) < 0)
goto cleanup;
if (!(actualargv = virCommandToString(cmd, true)))
if (virCommandToStringBuf(cmd, &actualBuf, true, false) < 0)
goto cleanup;
virBufferAddLit(&actualBuf, "\n");
actualargv = virBufferContentAndReset(&actualBuf);
if (virTestCompareToFileFull(actualargv, info->outfile, false) < 0)
goto cleanup;