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

Function test_add_del_invalid

dpdk/app/test/test_fib.c:141–183  ·  view source on GitHub ↗

* Check that rte_fib_add and rte_fib_delete fails gracefully * for incorrect user input arguments */

Source from the content-addressed store, hash-verified

139 * for incorrect user input arguments
140 */
141int32_t
142test_add_del_invalid(void)
143{
144 struct rte_fib *fib = NULL;
145 struct rte_fib_conf config;
146 uint64_t nh = 100;
147 uint32_t ip = RTE_IPV4(0, 0, 0, 0);
148 int ret;
149 uint8_t depth = 24;
150
151 config.max_routes = MAX_ROUTES;
152 config.rib_ext_sz = 0;
153 config.default_nh = 0;
154 config.type = RTE_FIB_DUMMY;
155
156 /* rte_fib_add: fib == NULL */
157 ret = rte_fib_add(NULL, ip, depth, nh);
158 RTE_TEST_ASSERT(ret < 0,
159 "Call succeeded with invalid parameters\n");
160
161 /* rte_fib_delete: fib == NULL */
162 ret = rte_fib_delete(NULL, ip, depth);
163 RTE_TEST_ASSERT(ret < 0,
164 "Call succeeded with invalid parameters\n");
165
166 /*Create valid fib to use in rest of test. */
167 fib = rte_fib_create(__func__, SOCKET_ID_ANY, &config);
168 RTE_TEST_ASSERT(fib != NULL, "Failed to create FIB\n");
169
170 /* rte_fib_add: depth > RTE_FIB_MAXDEPTH */
171 ret = rte_fib_add(fib, ip, RTE_FIB_MAXDEPTH + 1, nh);
172 RTE_TEST_ASSERT(ret < 0,
173 "Call succeeded with invalid parameters\n");
174
175 /* rte_fib_delete: depth > RTE_FIB_MAXDEPTH */
176 ret = rte_fib_delete(fib, ip, RTE_FIB_MAXDEPTH + 1);
177 RTE_TEST_ASSERT(ret < 0,
178 "Call succeeded with invalid parameters\n");
179
180 rte_fib_free(fib);
181
182 return TEST_SUCCESS;
183}
184
185/*
186 * Check that rte_fib_get_dp and rte_fib_get_rib fails gracefully

Callers

nothing calls this directly

Calls 4

rte_fib_addFunction · 0.85
rte_fib_deleteFunction · 0.85
rte_fib_createFunction · 0.85
rte_fib_freeFunction · 0.85

Tested by

no test coverage detected