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

Function test_get_fn

dpdk/app/test/test_rib.c:158–233  ·  view source on GitHub ↗

* Call rte_rib_node access functions with incorrect input. * After call rte_rib_node access functions with correct args * and check the return values for correctness */

Source from the content-addressed store, hash-verified

156 * and check the return values for correctness
157 */
158int32_t
159test_get_fn(void)
160{
161 struct rte_rib *rib = NULL;
162 struct rte_rib_node *node;
163 struct rte_rib_conf config;
164 void *ext;
165 uint32_t ip = RTE_IPV4(192, 0, 2, 0);
166 uint32_t ip_ret;
167 uint64_t nh_set = 10;
168 uint64_t nh_ret;
169 uint8_t depth = 24;
170 uint8_t depth_ret;
171 int ret;
172
173 config.max_nodes = MAX_RULES;
174 config.ext_sz = 0;
175
176 rib = rte_rib_create(__func__, SOCKET_ID_ANY, &config);
177 RTE_TEST_ASSERT(rib != NULL, "Failed to create RIB\n");
178
179 node = rte_rib_insert(rib, ip, depth);
180 RTE_TEST_ASSERT(node != NULL, "Failed to insert rule\n");
181
182 /* test rte_rib_get_ip() with incorrect args */
183 ret = rte_rib_get_ip(NULL, &ip_ret);
184 RTE_TEST_ASSERT(ret < 0,
185 "Call succeeded with invalid parameters\n");
186 ret = rte_rib_get_ip(node, NULL);
187 RTE_TEST_ASSERT(ret < 0,
188 "Call succeeded with invalid parameters\n");
189
190 /* test rte_rib_get_depth() with incorrect args */
191 ret = rte_rib_get_depth(NULL, &depth_ret);
192 RTE_TEST_ASSERT(ret < 0,
193 "Call succeeded with invalid parameters\n");
194 ret = rte_rib_get_depth(node, NULL);
195 RTE_TEST_ASSERT(ret < 0,
196 "Call succeeded with invalid parameters\n");
197
198 /* test rte_rib_set_nh() with incorrect args */
199 ret = rte_rib_set_nh(NULL, nh_set);
200 RTE_TEST_ASSERT(ret < 0,
201 "Call succeeded with invalid parameters\n");
202
203 /* test rte_rib_get_nh() with incorrect args */
204 ret = rte_rib_get_nh(NULL, &nh_ret);
205 RTE_TEST_ASSERT(ret < 0,
206 "Call succeeded with invalid parameters\n");
207 ret = rte_rib_get_nh(node, NULL);
208 RTE_TEST_ASSERT(ret < 0,
209 "Call succeeded with invalid parameters\n");
210
211 /* test rte_rib_get_ext() with incorrect args */
212 ext = rte_rib_get_ext(NULL);
213 RTE_TEST_ASSERT(ext == NULL,
214 "Call succeeded with invalid parameters\n");
215

Callers

nothing calls this directly

Calls 8

rte_rib_createFunction · 0.85
rte_rib_insertFunction · 0.85
rte_rib_get_ipFunction · 0.85
rte_rib_get_depthFunction · 0.85
rte_rib_set_nhFunction · 0.85
rte_rib_get_nhFunction · 0.85
rte_rib_get_extFunction · 0.85
rte_rib_freeFunction · 0.85

Tested by

no test coverage detected