MCPcopy Create free account
hub / github.com/corosync/corosync / main

Function main

test/stress_cpgcontext.c:87–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85#define INSTANCES 100
86
87int main (void)
88{
89 cpg_handle_t handle[INSTANCES];
90 cs_error_t res;
91 void *context[INSTANCES];
92 int i, j;
93 void *ctx;
94
95 signal (SIGINT, sigintr_handler);
96 for (i = 0; i < INSTANCES; i++) {
97 res = cpg_initialize (&handle[i], &callbacks);
98 if (res != CS_OK) {
99 printf ("FAIL %d\n", res);
100 exit (-1);
101 }
102 }
103
104 for (j = 0; j < ITERATIONS; j++) {
105 for (i = 0; i < INSTANCES; i++) {
106 context[i] = malloc (20);
107 res = cpg_context_set (handle[i], context[i]);
108 if (res != CS_OK) {
109 printf ("FAIL %d\n", res);
110 exit (-1);
111 }
112 }
113
114 for (i = 0; i < INSTANCES; i++) {
115 res = cpg_context_get (handle[i], &ctx);
116 if (res != CS_OK) {
117 printf ("FAIL %d\n", res);
118 exit (-1);
119 }
120 if (ctx != context[i]) {
121 printf ("FAIL\n");
122 exit (-1);
123 }
124 free (ctx);
125 }
126 }
127
128 for (i = 0; i < INSTANCES; i++) {
129 cpg_finalize (handle[i]);
130 }
131
132 printf ("PASS\n");
133 return (0);
134}

Callers

nothing calls this directly

Calls 4

cpg_initializeFunction · 0.85
cpg_context_setFunction · 0.85
cpg_context_getFunction · 0.85
cpg_finalizeFunction · 0.85

Tested by

no test coverage detected