]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virhostdevtest: Don't proceed to test cases if init failed
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 14 Jun 2019 08:39:24 +0000 (10:39 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 6 Aug 2019 09:20:39 +0000 (11:20 +0200)
The myInit() function is called before any of the test cases
because it prepares all internal structures for individual cases.
Well, if it fails there's no point in proceeding with testing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
tests/virhostdevtest.c

index 20eaca82e0ffa51d51fcf500240318aed37207d4..cf39c83c761b0074e501384ca246d7a0ae028a4b 100644 (file)
@@ -574,8 +574,11 @@ mymain(void)
             ret = -1; \
     } while (0)
 
-    if (myInit() < 0)
+    if (myInit() < 0) {
         fprintf(stderr, "Init data structures failed.");
+        virFileDeleteTree(fakerootdir);
+        return EXIT_FAILURE;
+    }
 
     DO_TEST(testVirHostdevRoundtripNoGuest);
     DO_TEST(testVirHostdevRoundtripUnmanaged);