13 #include <sys/types.h> 19 #include <corosync/cpg.h> 22 deliver_fn1(cpg_handle_t handle,
const struct cpg_name *group_name,
23 uint32_t nodeid, uint32_t
pid,
void *msg,
size_t msg_len)
29 deliver_fn2(cpg_handle_t handle,
const struct cpg_name *group_name,
30 uint32_t nodeid, uint32_t
pid,
void *msg,
size_t msg_len)
36 null_cluster(
void **state)
47 .cpg_deliver_fn = NULL,
52 assert_ptr_equal(cluster.cpg.cpg_deliver_fn, NULL);
54 cluster.cpg.cpg_deliver_fn = deliver_fn1;
56 assert_ptr_equal(cluster.cpg.cpg_deliver_fn, NULL);
60 previous_fn_null(
void **state)
64 .cpg_deliver_fn = NULL,
70 assert_ptr_equal(cluster.cpg.cpg_deliver_fn, deliver_fn1);
74 previous_fn_nonnull(
void **state)
78 .cpg_deliver_fn = deliver_fn2,
84 assert_ptr_equal(cluster.cpg.cpg_deliver_fn, deliver_fn1);
88 cmocka_unit_test(null_cluster),
89 cmocka_unit_test(null_fn),
90 cmocka_unit_test(previous_fn_null),
91 cmocka_unit_test(previous_fn_nonnull))
94 #endif // SUPPORT_COROSYNC #define PCMK__UNIT_TEST(group_setup, group_teardown,...)
int pcmk_cpg_set_deliver_fn(pcmk_cluster_t *cluster, cpg_deliver_fn_t fn)
Set the CPG deliver callback function for a cluster object.