| 85 | #define INSTANCES 100 |
| 86 | |
| 87 | int 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 | } |
nothing calls this directly
no test coverage detected