15#include <sys/resource.h>
24#ifndef CRM_COMMON_UNITTEST_INTERNAL__H
25#define CRM_COMMON_UNITTEST_INTERNAL__H
29#if (PCMK__WITH_COVERAGE == 1)
121#define pcmk__assert_asserts(stmt) \
125 struct rlimit cores = { 0, 0 }; \
126 setrlimit(RLIMIT_CORE, &cores); \
130 } else if (p > 0) { \
132 if (waitpid(p, &wstatus, 0) == -1) { \
133 fail_msg("waitpid failed"); \
135 if (!(WIFSIGNALED(wstatus) && WTERMSIG(wstatus) == SIGABRT)) { \
136 fail_msg("statement terminated in child without asserting"); \
139 fail_msg("unable to fork for assert test"); \
150#define pcmk__assert_aborts(stmt) pcmk__assert_asserts(stmt)
167#define pcmk__assert_exits(rc, stmt) \
171 struct rlimit cores = { 0, 0 }; \
172 setrlimit(RLIMIT_CORE, &cores); \
175 _exit(CRM_EX_NONE); \
176 } else if (p > 0) { \
178 if (waitpid(p, &wstatus, 0) == -1) { \
179 fail_msg("waitpid failed"); \
181 if (!WIFEXITED(wstatus)) { \
182 fail_msg("statement terminated abnormally"); \
183 } else if (WEXITSTATUS(wstatus) != rc) { \
184 fail_msg("statement exited with %d, not expected %d", WEXITSTATUS(wstatus), rc); \
187 fail_msg("unable to fork for assert test"); \
196#define PCMK__UNIT_TEST(group_setup, group_teardown, ...) \
198main(int argc, char **argv) \
200 const struct CMUnitTest t[] = { \
203 cmocka_set_message_output(CM_OUTPUT_TAP); \
204 return cmocka_run_group_tests(t, group_setup, group_teardown); \
void pcmk__test_init_logging(const char *name, const char *filename)
void pcmk__cib_test_cleanup(char *out_path)
int pcmk__xml_test_setup_group(void **state)
void pcmk__assert_validates(xmlNode *xml)
char * pcmk__cib_test_copy_cib(const char *in_file)
Wrappers for and extensions to libxml2.