22 const char *schema_dir = NULL;
33 fd = mkstemp(xmllint_input);
35 fail_msg(
"Could not create temp file: %s", strerror(errno));
40 unlink(xmllint_input);
41 fail_msg(
"Could not write temp file: %s",
pcmk_rc_str(rc));
47 schema_dir = getenv(
"PCMK_schema_directory");
48 if (schema_dir == NULL) {
49 unlink(xmllint_input);
50 fail_msg(
"PCMK_schema_directory is not set in test environment");
54 schema_dir, xmllint_input);
56 if (!g_spawn_command_line_sync(cmd, &out, &err, &status, &gerr)) {
57 unlink(xmllint_input);
58 fail_msg(
"Error occurred when performing validation: %s", gerr->message);
61 if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
62 unlink(xmllint_input);
63 fail_msg(
"XML validation failed: %s\n%s\n", out, err);
69 unlink(xmllint_input);
89 char *out_path = NULL;
90 char *contents = NULL;
96 fd = mkstemp(out_path);
116 setenv(
"CIB_file", out_path, 1);
125 unsetenv(
"CIB_file");
141 if (filename != NULL) {
void pcmk__assert_validates(xmlNode *xml)
void pcmk__cib_test_cleanup(char *out_path)
void pcmk__test_init_logging(const char *name, const char *filename)
void crm_xml_init(void)
Initialize the CRM XML subsystem.
char * pcmk__cib_test_copy_cib(const char *in_file)
int pcmk__add_logfile(const char *filename)
Add a file to be used as a Pacemaker detail log.
int pcmk__write_sync(int fd, const char *contents)
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code.
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
void pcmk__cli_init_logging(const char *name, unsigned int verbosity)
unsigned int set_crm_log_level(unsigned int level)
const char * pcmk__get_tmpdir(void)
int pcmk__file_contents(const char *filename, char **contents)
int pcmk__xml_test_setup_group(void **state)
int pcmk__xml2fd(int fd, xmlNode *cur)