]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix command test wrt gnutls initialize & fix debugging
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 25 Aug 2011 11:05:54 +0000 (12:05 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 25 Aug 2011 11:05:54 +0000 (12:05 +0100)
The VIR_TEST_DEBUG and VIR_TEST_VERBOSE env vars did not work
because we replaced 'environ' with 'newenv'. Simply calling
virTestGetDebug/Verbose() before replacing the 'environ' ensures
we have processed the env variables.

The gnutls initialization code opens /dev/urandom and keeps that
FD around for later use. We have code which kills off FDs 3-5
to avoid interfereing with our test case. Move the virInitialize
call before this point, so it kills off the gnutls /dev/urandom
FD which is irrelevant for testing purposes

* tests/commandtest.c: Fix test debugging & make it robust against
  opened FDs

tests/commandtest.c

index 4a798fc91e0cbb3e67a20513f7a3385f05a0f6f2..dd6c24887d38cbee562a225c7e2de441f4f9536a 100644 (file)
@@ -773,6 +773,13 @@ mymain(void)
     setpgid(0, 0);
     setsid();
 
+
+    /* Prime the debug/verbose settings from the env vars,
+     * since we're about to reset 'environ' */
+    virTestGetDebug();
+    virTestGetVerbose();
+
+    virInitialize();
     /* Kill off any inherited fds that might interfere with our
      * testing.  */
     fd = 3;
@@ -782,8 +789,6 @@ mymain(void)
     fd = 5;
     VIR_FORCE_CLOSE(fd);
 
-    virInitialize();
-
     environ = (char **)newenv;
 
 # define DO_TEST(NAME)                                                \