[libvirt] [PATCHv2 3/2] tests: Fix commandtest in VPATH build

Eric Blake eblake at redhat.com
Mon Dec 6 22:05:03 UTC 2010


From: Jiri Denemark <jdenemar at redhat.com>

---
Resovling the rebase conflict wasn't as hard as I had first feared.

 tests/commandtest.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/commandtest.c b/tests/commandtest.c
index 2666d61..b7261e9 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -530,19 +530,26 @@ cleanup:
  */
 static int test15(const void *unused ATTRIBUTE_UNUSED) {
     virCommandPtr cmd = virCommandNew(abs_builddir "/commandhelper");
+    char *cwd = NULL;
+    int ret = -1;

-    virCommandSetWorkingDirectory(cmd, abs_builddir "/commanddata");
+    if (virAsprintf(&cwd, "%s/commanddata", abs_srcdir) < 0)
+        goto cleanup;
+    virCommandSetWorkingDirectory(cmd, cwd);

     if (virCommandRun(cmd, NULL) < 0) {
         virErrorPtr err = virGetLastError();
         printf("Cannot run child %s\n", err->message);
-        virCommandFree(cmd);
-        return -1;
+        goto cleanup;
     }

+    ret = checkoutput("test15");
+
+cleanup:
+    VIR_FREE(cwd);
     virCommandFree(cmd);

-    return checkoutput("test15");
+    return ret;
 }

 /*
-- 
1.7.3.2




More information about the libvir-list mailing list