]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Fix commandtest in VPATH build
authorJiri Denemark <jdenemar@redhat.com>
Mon, 6 Dec 2010 12:03:26 +0000 (13:03 +0100)
committerEric Blake <eblake@redhat.com>
Tue, 7 Dec 2010 16:34:09 +0000 (09:34 -0700)
tests/commandtest.c

index 9b5a50f12f4facb5abd32b54152a4d715ef01687..5971c887e9b09ac9c1161d0ca705baa5708fdf51 100644 (file)
@@ -544,19 +544,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;
 }
 
 /*