* Check that rte_lpm6_add fails gracefully for incorrect user input arguments */
| 245 | * Check that rte_lpm6_add fails gracefully for incorrect user input arguments |
| 246 | */ |
| 247 | int32_t |
| 248 | test4(void) |
| 249 | { |
| 250 | struct rte_lpm6 *lpm = NULL; |
| 251 | struct rte_lpm6_config config; |
| 252 | |
| 253 | uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
| 254 | uint8_t depth = 24, next_hop = 100; |
| 255 | int32_t status = 0; |
| 256 | |
| 257 | config.max_rules = MAX_RULES; |
| 258 | config.number_tbl8s = NUMBER_TBL8S; |
| 259 | config.flags = 0; |
| 260 | |
| 261 | /* rte_lpm6_add: lpm == NULL */ |
| 262 | status = rte_lpm6_add(NULL, ip, depth, next_hop); |
| 263 | TEST_LPM_ASSERT(status < 0); |
| 264 | |
| 265 | /*Create valid lpm to use in rest of test. */ |
| 266 | lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config); |
| 267 | TEST_LPM_ASSERT(lpm != NULL); |
| 268 | |
| 269 | /* rte_lpm6_add: depth < 1 */ |
| 270 | status = rte_lpm6_add(lpm, ip, 0, next_hop); |
| 271 | TEST_LPM_ASSERT(status < 0); |
| 272 | |
| 273 | /* rte_lpm6_add: depth > MAX_DEPTH */ |
| 274 | status = rte_lpm6_add(lpm, ip, (MAX_DEPTH + 1), next_hop); |
| 275 | TEST_LPM_ASSERT(status < 0); |
| 276 | |
| 277 | rte_lpm6_free(lpm); |
| 278 | |
| 279 | return PASS; |
| 280 | } |
| 281 | |
| 282 | /* |
| 283 | * Check that rte_lpm6_delete fails gracefully for incorrect user input |
nothing calls this directly
no test coverage detected