* Check that rte_lpm_lookup fails gracefully for incorrect user input * arguments */
| 239 | * arguments |
| 240 | */ |
| 241 | int32_t |
| 242 | test5(void) |
| 243 | { |
| 244 | #if defined(RTE_LIBRTE_LPM_DEBUG) |
| 245 | struct rte_lpm *lpm = NULL; |
| 246 | struct rte_lpm_config config; |
| 247 | |
| 248 | config.max_rules = MAX_RULES; |
| 249 | config.number_tbl8s = NUMBER_TBL8S; |
| 250 | config.flags = 0; |
| 251 | uint32_t ip = RTE_IPV4(0, 0, 0, 0), next_hop_return = 0; |
| 252 | int32_t status = 0; |
| 253 | |
| 254 | /* rte_lpm_lookup: lpm == NULL */ |
| 255 | status = rte_lpm_lookup(NULL, ip, &next_hop_return); |
| 256 | TEST_LPM_ASSERT(status < 0); |
| 257 | |
| 258 | /*Create valid lpm to use in rest of test. */ |
| 259 | lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); |
| 260 | TEST_LPM_ASSERT(lpm != NULL); |
| 261 | |
| 262 | /* rte_lpm_lookup: depth < 1 */ |
| 263 | status = rte_lpm_lookup(lpm, ip, NULL); |
| 264 | TEST_LPM_ASSERT(status < 0); |
| 265 | |
| 266 | rte_lpm_free(lpm); |
| 267 | #endif |
| 268 | return PASS; |
| 269 | } |
| 270 | |
| 271 | |
| 272 |
nothing calls this directly
no test coverage detected