[libvirt] [PATCH 1/4] storagevolxml2argvtest: Report better error messages on test failure
Peter Krempa
pkrempa at redhat.com
Wed Jun 5 08:59:21 UTC 2013
If the creation of the commandline failed, libvirt always reported "out
of memory" from the virCommandToString function rather than the proper
error that happened in virStorageBackendCreateQemuImgCmd. Error out
earlier.
---
tests/storagevolxml2argvtest.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index e1507b4..92ab2f2 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -60,9 +60,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
cmd = virStorageBackendCreateQemuImgCmd(conn, &poolobj, vol, inputvol,
flags, create_tool, imgformat);
-
- actualCmdline = virCommandToString(cmd);
- if (!actualCmdline) {
+ if (!cmd) {
if (shouldFail) {
virResetLastError();
ret = 0;
@@ -70,6 +68,9 @@ testCompareXMLToArgvFiles(bool shouldFail,
goto cleanup;
}
+ if (!(actualCmdline = virCommandToString(cmd)))
+ goto cleanup;
+
len = virtTestLoadFile(cmdline, &expectedCmdline);
if (len < 0)
goto cleanup;
--
1.8.2.1
More information about the libvir-list
mailing list