[libvirt] [PATCH] build: distribute commandtest files

Eric Blake eblake at redhat.com
Fri Dec 10 15:55:12 UTC 2010


On 12/10/2010 08:10 AM, Eric Blake wrote:
> * tests/Makefile.am (SUBDIRS): Add commanddata.
> * tests/commanddata/Makefile.am: New file.
> * configure.ac (AC_OUTPUT): Build new makefile.
> Reported by Dominik Klein.
> ---
> 
> This should do the trick.  I'll push it under the build-breaker
> rule if it passes 'make distcheck' (still in progress as I type this).

Nope.  Failed because commanddata.{log,pid} were left around.  I'm
squashing this in (no need to unlink() the .log file before starting
testing, since each test re-opens it with O_CREAT|O_TRUNC):

diff --git a/tests/commandtest.c b/tests/commandtest.c
index e956205..a1bcf68 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -86,7 +86,7 @@ static int checkoutput(const char *testname)
     ret = 0;

 cleanup:
-    unlink(actuallog);
+    unlink(actualname);
     VIR_FREE(actuallog);
     VIR_FREE(actualname);
     VIR_FREE(expectlog);
@@ -248,6 +248,7 @@ static int test4(const void *unused ATTRIBUTE_UNUSED)

 cleanup:
     virCommandFree(cmd);
+    unlink(pidfile);
     VIR_FREE(pidfile);
     return ret;
 }
@@ -707,12 +708,6 @@ mymain(int argc, char **argv)
                     1, NAME, NULL) < 0)                               \
         ret = -1

-    char *actualname;
-    if (virAsprintf(&actualname, "%s/commandhelper.log", abs_builddir) < 0)
-        return EXIT_FAILURE;
-    unlink(actualname);
-    VIR_FREE(actualname);
-
     DO_TEST(test0);
     DO_TEST(test1);
     DO_TEST(test2);


I'm also posting a followup patch to clean up a memory leak in
virCommand as detected by valgrind.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101210/f423ea50/attachment-0001.sig>


More information about the libvir-list mailing list