17 static bool init_succeeds =
true;
31 mk_fake_text_output(
char **argv) {
39 retval->
init = fake_text_init;
55 teardown(
void **state) {
61 empty_formatters(
void **state) {
68 invalid_params(
void **state) {
74 no_such_format(
void **state) {
81 create_fails(
void **state) {
94 fopen_fails(
void **state) {
108 init_fails(
void **state) {
111 init_succeeds =
false;
113 init_succeeds =
true;
117 everything_succeeds(
void **state) {
121 assert_string_equal(out->
fmt_name,
"text");
122 assert_ptr_equal(out->
dest, stdout);
123 assert_false(out->
quiet);
125 assert_string_equal(getenv(
"OCF_OUTPUT_FORMAT"),
"text");
131 no_fmt_name_given(
void **state) {
135 assert_string_equal(out->
fmt_name,
"text");
141 cmocka_unit_test(empty_formatters),
142 cmocka_unit_test_setup_teardown(invalid_params, setup, teardown),
143 cmocka_unit_test_setup_teardown(no_such_format, setup, teardown),
144 cmocka_unit_test_setup_teardown(create_fails, setup, teardown),
145 cmocka_unit_test_setup_teardown(init_fails, setup, teardown),
146 cmocka_unit_test_setup_teardown(fopen_fails, setup, teardown),
147 cmocka_unit_test_setup_teardown(everything_succeeds, setup, teardown),
148 cmocka_unit_test_setup_teardown(no_fmt_name_given, setup, teardown))
int(* message)(pcmk__output_t *out, const char *message_id,...)
const char * fmt_name
The name of this output formatter.
void pcmk__register_message(pcmk__output_t *out, const char *message_id, pcmk__message_fn_t fn)
PCMK__UNIT_TEST(NULL, NULL, cmocka_unit_test(bad_input), cmocka_unit_test(not_found), cmocka_unit_test(find_attrB), cmocka_unit_test(find_attrA_matching))
int pcmk__call_message(pcmk__output_t *out, const char *message_id,...)
GHashTable * messages
Custom messages that are currently registered on this formatter.
Formatted output for pacemaker tools.
void(* register_message)(pcmk__output_t *out, const char *message_id, pcmk__message_fn_t fn)
bool quiet
Should this formatter supress most output?
void(* free_priv)(pcmk__output_t *out)
bool(* init)(pcmk__output_t *out)
#define pcmk__assert_asserts(stmt)
int pcmk__register_format(GOptionGroup *group, const char *name, pcmk__output_factory_t create, const GOptionEntry *options)
FILE * dest
Where output should be written.
void pcmk__output_free(pcmk__output_t *out)
void pcmk__unregister_formats(void)
FILE * __wrap_fopen(const char *pathname, const char *mode)
This structure contains everything that makes up a single output formatter.
int pcmk__output_new(pcmk__output_t **out, const char *fmt_name, const char *filename, char **argv)
void * __wrap_calloc(size_t nmemb, size_t size)