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)
119#define pcmk__assert_asserts(stmt) \
123 struct rlimit cores = { 0, 0 }; \
124 setrlimit(RLIMIT_CORE, &cores); \
128 } else if (p > 0) { \
130 if (waitpid(p, &wstatus, 0) == -1) { \
131 fail_msg("waitpid failed"); \
133 if (!(WIFSIGNALED(wstatus) && WTERMSIG(wstatus) == SIGABRT)) { \
134 fail_msg("statement terminated in child without asserting"); \
137 fail_msg("unable to fork for assert test"); \
148#define pcmk__assert_aborts(stmt) pcmk__assert_asserts(stmt)
165#define pcmk__assert_exits(rc, stmt) \
169 struct rlimit cores = { 0, 0 }; \
170 setrlimit(RLIMIT_CORE, &cores); \
173 _exit(CRM_EX_NONE); \
174 } else if (p > 0) { \
176 if (waitpid(p, &wstatus, 0) == -1) { \
177 fail_msg("waitpid failed"); \
179 if (!WIFEXITED(wstatus)) { \
180 fail_msg("statement terminated abnormally"); \
181 } else if (WEXITSTATUS(wstatus) != rc) { \
182 fail_msg("statement exited with %d, not expected %d", WEXITSTATUS(wstatus), rc); \
185 fail_msg("unable to fork for assert test"); \
194#define PCMK__UNIT_TEST(group_setup, group_teardown, ...) \
196main(int argc, char **argv) \
198 const struct CMUnitTest t[] = { \
201 cmocka_set_message_output(CM_OUTPUT_TAP); \
202 return cmocka_run_group_tests(t, group_setup, group_teardown); \
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.