* Check that rte_lpm_delete fails gracefully for incorrect user input * arguments */
| 201 | * arguments |
| 202 | */ |
| 203 | int32_t |
| 204 | test4(void) |
| 205 | { |
| 206 | struct rte_lpm *lpm = NULL; |
| 207 | struct rte_lpm_config config; |
| 208 | |
| 209 | config.max_rules = MAX_RULES; |
| 210 | config.number_tbl8s = NUMBER_TBL8S; |
| 211 | config.flags = 0; |
| 212 | uint32_t ip = RTE_IPV4(0, 0, 0, 0); |
| 213 | uint8_t depth = 24; |
| 214 | int32_t status = 0; |
| 215 | |
| 216 | /* rte_lpm_delete: lpm == NULL */ |
| 217 | status = rte_lpm_delete(NULL, ip, depth); |
| 218 | TEST_LPM_ASSERT(status < 0); |
| 219 | |
| 220 | /*Create valid lpm to use in rest of test. */ |
| 221 | lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); |
| 222 | TEST_LPM_ASSERT(lpm != NULL); |
| 223 | |
| 224 | /* rte_lpm_delete: depth < 1 */ |
| 225 | status = rte_lpm_delete(lpm, ip, 0); |
| 226 | TEST_LPM_ASSERT(status < 0); |
| 227 | |
| 228 | /* rte_lpm_delete: depth > MAX_DEPTH */ |
| 229 | status = rte_lpm_delete(lpm, ip, (MAX_DEPTH + 1)); |
| 230 | TEST_LPM_ASSERT(status < 0); |
| 231 | |
| 232 | rte_lpm_free(lpm); |
| 233 | |
| 234 | return PASS; |
| 235 | } |
| 236 | |
| 237 | /* |
| 238 | * Check that rte_lpm_lookup fails gracefully for incorrect user input |
nothing calls this directly
no test coverage detected