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

Function test_insert_invalid

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

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

Source from the content-addressed store, hash-verified

113 * for incorrect user input arguments
114 */
115int32_t
116test_insert_invalid(void)
117{
118 struct rte_rib6 *rib = NULL;
119 struct rte_rib6_node *node, *node1;
120 struct rte_rib6_conf config;
121 uint8_t ip[RTE_RIB6_IPV6_ADDR_SIZE] = {0};
122 uint8_t depth = 24;
123
124 config.max_nodes = MAX_RULES;
125 config.ext_sz = 0;
126
127 /* rte_rib6_insert: rib == NULL */
128 node = rte_rib6_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_rib6_create(__func__, SOCKET_ID_ANY, &config);
134 RTE_TEST_ASSERT(rib != NULL, "Failed to create RIB\n");
135
136 /* rte_rib6_insert: depth > MAX_DEPTH */
137 node = rte_rib6_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_rib6_insert(rib, ip, depth);
143 RTE_TEST_ASSERT(node != NULL, "Failed to insert rule\n");
144 node1 = rte_rib6_insert(rib, ip, depth);
145 RTE_TEST_ASSERT(node1 == NULL,
146 "Call succeeded with invalid parameters\n");
147
148 rte_rib6_free(rib);
149
150 return TEST_SUCCESS;
151}
152
153/*
154 * Call rte_rib6_node access functions with incorrect input.

Callers

nothing calls this directly

Calls 3

rte_rib6_insertFunction · 0.85
rte_rib6_createFunction · 0.85
rte_rib6_freeFunction · 0.85

Tested by

no test coverage detected