mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
5d99b157bc
When using VIR_TEST_MAIN() or VIR_TEST_MAIN_PRELOAD() macros, the retval of mymain() will become retval of main(). Hence, mymain() should use EXIT_FAILURE and EXIT_SUCCESS return values for greater portability. Another reason is that otherwise our summary printing of failed tests doesn't work (see following commit for more info). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
40 lines
876 B
C
40 lines
876 B
C
#include <config.h>
|
|
|
|
#include <unistd.h>
|
|
#include "security/security_driver.h"
|
|
#include "virrandom.h"
|
|
#include "testutils.h"
|
|
|
|
static int
|
|
mymain(void)
|
|
{
|
|
virSecurityManager *mgr;
|
|
const char *doi, *model;
|
|
|
|
mgr = virSecurityManagerNew(NULL, "QEMU", VIR_SECURITY_MANAGER_DEFAULT_CONFINED);
|
|
if (mgr == NULL) {
|
|
fprintf(stderr, "Failed to start security driver");
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
model = virSecurityManagerGetModel(mgr);
|
|
if (!model) {
|
|
fprintf(stderr, "Failed to copy secModel model: %s",
|
|
g_strerror(errno));
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
doi = virSecurityManagerGetDOI(mgr);
|
|
if (!doi) {
|
|
fprintf(stderr, "Failed to copy secModel DOI: %s",
|
|
g_strerror(errno));
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
virObjectUnref(mgr);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
VIR_TEST_MAIN(mymain)
|