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

Function test_add_del_invalid

dpdk/app/test/test_fib6.c:144–186  ·  view source on GitHub ↗

* Check that rte_fib6_add and rte_fib6_delete fails gracefully * for incorrect user input arguments */

Source from the content-addressed store, hash-verified

142 * for incorrect user input arguments
143 */
144int32_t
145test_add_del_invalid(void)
146{
147 struct rte_fib6 *fib = NULL;
148 struct rte_fib6_conf config;
149 uint64_t nh = 100;
150 uint8_t ip[RTE_FIB6_IPV6_ADDR_SIZE] = {0};
151 int ret;
152 uint8_t depth = 24;
153
154 config.max_routes = MAX_ROUTES;
155 config.rib_ext_sz = 0;
156 config.default_nh = 0;
157 config.type = RTE_FIB6_DUMMY;
158
159 /* rte_fib6_add: fib == NULL */
160 ret = rte_fib6_add(NULL, ip, depth, nh);
161 RTE_TEST_ASSERT(ret < 0,
162 "Call succeeded with invalid parameters\n");
163
164 /* rte_fib6_delete: fib == NULL */
165 ret = rte_fib6_delete(NULL, ip, depth);
166 RTE_TEST_ASSERT(ret < 0,
167 "Call succeeded with invalid parameters\n");
168
169 /*Create valid fib to use in rest of test. */
170 fib = rte_fib6_create(__func__, SOCKET_ID_ANY, &config);
171 RTE_TEST_ASSERT(fib != NULL, "Failed to create FIB\n");
172
173 /* rte_fib6_add: depth > RTE_FIB6_MAXDEPTH */
174 ret = rte_fib6_add(fib, ip, RTE_FIB6_MAXDEPTH + 1, nh);
175 RTE_TEST_ASSERT(ret < 0,
176 "Call succeeded with invalid parameters\n");
177
178 /* rte_fib6_delete: depth > RTE_FIB6_MAXDEPTH */
179 ret = rte_fib6_delete(fib, ip, RTE_FIB6_MAXDEPTH + 1);
180 RTE_TEST_ASSERT(ret < 0,
181 "Call succeeded with invalid parameters\n");
182
183 rte_fib6_free(fib);
184
185 return TEST_SUCCESS;
186}
187
188/*
189 * Check that rte_fib6_get_dp and rte_fib6_get_rib fails gracefully

Callers

nothing calls this directly

Calls 4

rte_fib6_addFunction · 0.85
rte_fib6_deleteFunction · 0.85
rte_fib6_createFunction · 0.85
rte_fib6_freeFunction · 0.85

Tested by

no test coverage detected