halt="Don't use semicolon at eol in python files" \
$(_sc_search_regexp)
+# mymain() in test files should use return, not exit, for nicer output
+sc_prohibit_exit_in_tests:
+ @prohibit='\<exit *\(' \
+ in_vc_files='^tests/' \
+ halt='use return, not exit(), in tests' \
+ $(_sc_search_regexp)
+
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
/*
* commandhelper.c: Auxiliary program for commandtest
*
- * Copyright (C) 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2010-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
origenv++;
}
- if (VIR_ALLOC_N(newenv, n) < 0) {
- exit(EXIT_FAILURE);
- }
+ if (VIR_ALLOC_N(newenv, n) < 0)
+ return EXIT_FAILURE;
origenv = environ;
n = i = 0;
return EXIT_AM_SKIP;
#endif
- if (virThreadInitialize() < 0)
- exit(EXIT_FAILURE);
-
- if (!(caps = testQemuCapsInit()))
- exit(EXIT_FAILURE);
+ if (virThreadInitialize() < 0 ||
+ !(caps = testQemuCapsInit()))
+ return EXIT_FAILURE;
virEventRegisterDefaultImpl();
const char *doi, *model;
if (virThreadInitialize() < 0)
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
mgr = virSecurityManagerNew(NULL, "QEMU", false, true, false);
if (mgr == NULL) {
fprintf(stderr, "Failed to start security driver");
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
model = virSecurityManagerGetModel(mgr);
{
fprintf(stderr, "Failed to copy secModel model: %s",
strerror(errno));
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
doi = virSecurityManagerGetDOI(mgr);
{
fprintf(stderr, "Failed to copy secModel DOI: %s",
strerror(errno));
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
virObjectUnref(mgr);
if (!(mgr = virSecurityManagerNew("selinux", "QEMU", false, true, false))) {
virErrorPtr err = virGetLastError();
if (err->code == VIR_ERR_CONFIG_UNSUPPORTED)
- exit(EXIT_AM_SKIP);
+ return EXIT_AM_SKIP;
fprintf(stderr, "Unable to initialize security driver: %s\n",
err->message);
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
if ((caps = testQemuCapsInit()) == NULL)
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
#define DO_TEST_LABELING(name) \
if (virtTestRun("Labelling " # name, 1, testSELinuxLabeling, name) < 0) \
/*
- * Copyright (C) 2011-2012 Red Hat, Inc.
+ * Copyright (C) 2011-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
if (!(mgr = virSecurityManagerNew("selinux", "QEMU", false, true, false))) {
virErrorPtr err = virGetLastError();
if (err->code == VIR_ERR_CONFIG_UNSUPPORTED)
- exit(EXIT_AM_SKIP);
+ return EXIT_AM_SKIP;
fprintf(stderr, "Unable to initialize security driver: %s\n",
err->message);
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
#define DO_TEST_GEN_LABEL(desc, pidcon, \
virtTestCaptureProgramExecChild(argv, pipefd[1]);
VIR_FORCE_CLOSE(pipefd[1]);
- _exit(1);
+ _exit(EXIT_FAILURE);
case -1:
return -1;
abs_srcdir_cleanup = true;
}
if (!abs_srcdir)
- exit(EXIT_AM_HARDFAIL);
+ return EXIT_AM_HARDFAIL;
progname = last_component(argv[0]);
if (STRPREFIX(progname, "lt-"))
if (virThreadInitialize() < 0 ||
virErrorInitialize() < 0)
- return 1;
+ return EXIT_FAILURE;
virLogSetFromEnv();
if (!getenv("LIBVIRT_DEBUG") && !virLogGetNbOutputs()) {
if (virLogDefineOutput(virtTestLogOutput, virtTestLogClose, &testLog,
VIR_LOG_DEBUG, VIR_LOG_TO_STDERR, NULL, 0) < 0)
- return 1;
+ return EXIT_FAILURE;
}
#if TEST_OOM
/*
* utils.c: test utils
*
- * Copyright (C) 2005, 2008-2012 Red Hat, Inc.
+ * Copyright (C) 2005, 2008-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
if (virAsprintf(&newenv, "%s%s%s", preload ? preload : "", \
preload ? ":" : "", lib) < 0) { \
perror("virAsprintf"); \
- exit(EXIT_FAILURE); \
+ return EXIT_FAILURE; \
} \
setenv("LD_PRELOAD", newenv, 1); \
execv(argv[0], argv); \