Files
libvirt/tests/seclabeltest.c
T

47 lines
1007 B
C
Raw Normal View History

#include <config.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
2009-09-15 19:06:37 +01:00
#include "security/security_driver.h"
2012-07-20 14:44:54 -06:00
#include "virrandom.h"
2016-02-25 17:13:00 +01:00
#include "testutils.h"
2016-02-25 17:13:00 +01:00
static int
mymain(void)
{
virSecurityManagerPtr mgr;
const char *doi, *model;
if (virThreadInitialize() < 0)
2013-02-22 15:42:39 -07:00
return EXIT_FAILURE;
2012-07-20 14:44:54 -06:00
mgr = virSecurityManagerNew(NULL, "QEMU", VIR_SECURITY_MANAGER_DEFAULT_CONFINED);
if (mgr == NULL) {
fprintf(stderr, "Failed to start security driver");
2013-02-22 15:42:39 -07:00
return EXIT_FAILURE;
}
model = virSecurityManagerGetModel(mgr);
2014-09-03 16:24:43 -06:00
if (!model) {
fprintf(stderr, "Failed to copy secModel model: %s",
strerror(errno));
2013-02-22 15:42:39 -07:00
return EXIT_FAILURE;
}
doi = virSecurityManagerGetDOI(mgr);
2014-09-03 16:24:43 -06:00
if (!doi) {
fprintf(stderr, "Failed to copy secModel DOI: %s",
strerror(errno));
2013-02-22 15:42:39 -07:00
return EXIT_FAILURE;
}
virObjectUnref(mgr);
return 0;
}
2016-02-25 17:13:00 +01:00
VIRT_TEST_MAIN(mymain)