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

Function test4

dpdk/app/test/test_lpm6.c:247–280  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

245 * Check that rte_lpm6_add fails gracefully for incorrect user input arguments
246 */
247int32_t
248test4(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

Callers

nothing calls this directly

Calls 3

rte_lpm6_addFunction · 0.50
rte_lpm6_createFunction · 0.50
rte_lpm6_freeFunction · 0.50

Tested by

no test coverage detected