From ea8389dd3db688a0364626b45882aad262cfc2d3 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Mon, 6 Dec 2010 13:03:26 +0100 Subject: [PATCH] tests: Fix commandtest in VPATH build --- tests/commandtest.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/commandtest.c b/tests/commandtest.c index 9b5a50f12f..5971c887e9 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -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; } /*