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: 0046e0b1c26c8e0167de4a35be2902b9327b0c51
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
tests/qemuxml2argvtest.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index f9ec81eb8e..357098f819 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -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;
--
2.31.1