mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-05 04:41:20 +00:00
dce95297e3
testutils.c likes to print summaries after a test completes, including if it failed. But if the test outright exit()s, this summary is skipped. Enforce that we return instead of exit. * cfg.mk (sc_prohibit_exit_in_tests): New syntax check. * tests/commandhelper.c (main): Fix offenders. * tests/qemumonitorjsontest.c (mymain): Likewise. * tests/seclabeltest.c (main): Likewise. * tests/securityselinuxlabeltest.c (mymain): Likewise. * tests/securityselinuxtest.c (mymain): Likewise. * tests/testutils.h (VIRT_TEST_MAIN_PRELOAD): Likewise. * tests/testutils.c (virtTestMain): Likewise. (virtTestCaptureProgramOutput): Use symbolic name.
46 lines
991 B
C
46 lines
991 B
C
#include <config.h>
|
|
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include "security/security_driver.h"
|
|
#include "virrandom.h"
|
|
|
|
int
|
|
main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
|
{
|
|
virSecurityManagerPtr mgr;
|
|
const char *doi, *model;
|
|
|
|
if (virThreadInitialize() < 0)
|
|
return EXIT_FAILURE;
|
|
|
|
mgr = virSecurityManagerNew(NULL, "QEMU", false, true, false);
|
|
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",
|
|
strerror(errno));
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
doi = virSecurityManagerGetDOI(mgr);
|
|
if (!doi)
|
|
{
|
|
fprintf(stderr, "Failed to copy secModel DOI: %s",
|
|
strerror(errno));
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
virObjectUnref(mgr);
|
|
|
|
return 0;
|
|
}
|