* This function is run in the secondary instance to test that creation of * objects fails in a secondary */
| 128 | * objects fails in a secondary |
| 129 | */ |
| 130 | static int |
| 131 | run_object_creation_tests(void) |
| 132 | { |
| 133 | const unsigned flags = 0; |
| 134 | const unsigned size = 1024; |
| 135 | const unsigned elt_size = 64; |
| 136 | const unsigned cache_size = 64; |
| 137 | const unsigned priv_data_size = 32; |
| 138 | |
| 139 | printf("### Testing object creation - expect lots of mz reserve errors!\n"); |
| 140 | |
| 141 | rte_errno = 0; |
| 142 | if ((rte_memzone_reserve("test_mz", size, rte_socket_id(), |
| 143 | flags) == NULL) && |
| 144 | (rte_memzone_lookup("test_mz") == NULL)) { |
| 145 | printf("Error: unexpected return value from rte_memzone_reserve\n"); |
| 146 | return -1; |
| 147 | } |
| 148 | printf("# Checked rte_memzone_reserve() OK\n"); |
| 149 | |
| 150 | rte_errno = 0; |
| 151 | if ((rte_ring_create( |
| 152 | "test_ring", size, rte_socket_id(), flags) == NULL) && |
| 153 | (rte_ring_lookup("test_ring") == NULL)){ |
| 154 | printf("Error: unexpected return value from rte_ring_create()\n"); |
| 155 | return -1; |
| 156 | } |
| 157 | printf("# Checked rte_ring_create() OK\n"); |
| 158 | |
| 159 | rte_errno = 0; |
| 160 | if ((rte_mempool_create("test_mp", size, elt_size, cache_size, |
| 161 | priv_data_size, NULL, NULL, NULL, NULL, |
| 162 | rte_socket_id(), flags) == NULL) && |
| 163 | (rte_mempool_lookup("test_mp") == NULL)){ |
| 164 | printf("Error: unexpected return value from rte_mempool_create()\n"); |
| 165 | return -1; |
| 166 | } |
| 167 | printf("# Checked rte_mempool_create() OK\n"); |
| 168 | |
| 169 | #ifdef RTE_LIB_HASH |
| 170 | const struct rte_hash_parameters hash_params = { .name = "test_mp_hash" }; |
| 171 | rte_errno=0; |
| 172 | if ((rte_hash_create(&hash_params) != NULL) && |
| 173 | (rte_hash_find_existing(hash_params.name) == NULL)){ |
| 174 | printf("Error: unexpected return value from rte_hash_create()\n"); |
| 175 | return -1; |
| 176 | } |
| 177 | printf("# Checked rte_hash_create() OK\n"); |
| 178 | |
| 179 | const struct rte_fbk_hash_params fbk_params = { .name = "test_fbk_mp_hash" }; |
| 180 | rte_errno=0; |
| 181 | if ((rte_fbk_hash_create(&fbk_params) != NULL) && |
| 182 | (rte_fbk_hash_find_existing(fbk_params.name) == NULL)){ |
| 183 | printf("Error: unexpected return value from rte_fbk_hash_create()\n"); |
| 184 | return -1; |
| 185 | } |
| 186 | printf("# Checked rte_fbk_hash_create() OK\n"); |
| 187 | #endif |
no test coverage detected