[PATCH v1 14/31] virhostdevtest: Don't proceed to test cases if init failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 tests/virhostdevtest.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index 20eaca82e0..cf39c83c76 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -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);
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux