[PATCH 1/4] seclabeltest: Update to use VIRT_TEST_MAIN

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

 



Our tests should use either VIRT_TEST_MAIN() or
VIRT_TEST_MAIN_PRELOAD() macros which create main() function and
call the passed callback subsequently. This is important because
the wrapper which calls the callback eventually does important
stuff like setting logging based on env variables and such.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/Makefile.am    | 2 +-
 tests/seclabeltest.c | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index db4f88b..67f597a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1182,7 +1182,7 @@ virauthconfigtest_SOURCES = \
 virauthconfigtest_LDADD = $(LDADDS)
 
 seclabeltest_SOURCES = \
-	seclabeltest.c
+	seclabeltest.c testutils.h testutils.c
 seclabeltest_LDADD = $(LDADDS)
 
 if WITH_SECDRIVER_SELINUX
diff --git a/tests/seclabeltest.c b/tests/seclabeltest.c
index 6b1e789..be6e79f 100644
--- a/tests/seclabeltest.c
+++ b/tests/seclabeltest.c
@@ -7,9 +7,10 @@
 #include <errno.h>
 #include "security/security_driver.h"
 #include "virrandom.h"
+#include "testutils.h"
 
-int
-main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
+static int
+mymain(void)
 {
     virSecurityManagerPtr mgr;
     const char *doi, *model;
@@ -41,3 +42,5 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
 
     return 0;
 }
+
+VIRT_TEST_MAIN(mymain)
-- 
2.7.3

--
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]