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

Function test_insert_invalid

dpdk/app/test/test_rib.c:115–151  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

113 * Check that rte_rib_insert fails gracefully for incorrect user input arguments
114 */
115int32_t
116test_insert_invalid(void)
117{
118 struct rte_rib *rib = NULL;
119 struct rte_rib_node *node, *node1;
120 struct rte_rib_conf config;
121 uint32_t ip = RTE_IPV4(0, 0, 0, 0);
122 uint8_t depth = 24;
123
124 config.max_nodes = MAX_RULES;
125 config.ext_sz = 0;
126
127 /* rte_rib_insert: rib == NULL */
128 node = rte_rib_insert(NULL, ip, depth);
129 RTE_TEST_ASSERT(node == NULL,
130 "Call succeeded with invalid parameters\n");
131
132 /*Create valid rib to use in rest of test. */
133 rib = rte_rib_create(__func__, SOCKET_ID_ANY, &config);
134 RTE_TEST_ASSERT(rib != NULL, "Failed to create RIB\n");
135
136 /* rte_rib_insert: depth > MAX_DEPTH */
137 node = rte_rib_insert(rib, ip, MAX_DEPTH + 1);
138 RTE_TEST_ASSERT(node == NULL,
139 "Call succeeded with invalid parameters\n");
140
141 /* insert the same ip/depth twice*/
142 node = rte_rib_insert(rib, ip, depth);
143 RTE_TEST_ASSERT(node != NULL, "Failed to insert rule\n");
144 node1 = rte_rib_insert(rib, ip, depth);
145 RTE_TEST_ASSERT(node1 == NULL,
146 "Call succeeded with invalid parameters\n");
147
148 rte_rib_free(rib);
149
150 return TEST_SUCCESS;
151}
152
153/*
154 * Call rte_rib_node access functions with incorrect input.

Callers

nothing calls this directly

Calls 3

rte_rib_insertFunction · 0.85
rte_rib_createFunction · 0.85
rte_rib_freeFunction · 0.85

Tested by

no test coverage detected