MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test4

Function test4

dpdk/app/test/test_lpm.c:203–235  ·  view source on GitHub ↗

* Check that rte_lpm_delete fails gracefully for incorrect user input * arguments */

Source from the content-addressed store, hash-verified

201 * arguments
202 */
203int32_t
204test4(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

Callers

nothing calls this directly

Calls 3

rte_lpm_deleteFunction · 0.50
rte_lpm_createFunction · 0.50
rte_lpm_freeFunction · 0.50

Tested by

no test coverage detected