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

Function __test_delete_invalid

dpdk/app/test/test_ipsec_sad.c:227–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225}
226
227static int32_t
228__test_delete_invalid(int ipv6, union rte_ipsec_sad_key *tuple)
229{
230 int status;
231 struct rte_ipsec_sad *sad = NULL;
232 struct rte_ipsec_sad_conf config;
233
234 /* sad == NULL*/
235 status = rte_ipsec_sad_del(NULL, tuple, RTE_IPSEC_SAD_SPI_DIP_SIP);
236 RTE_TEST_ASSERT(status < 0,
237 "Call succeeded with invalid parameters\n");
238
239 config.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = MAX_SA;
240 config.max_sa[RTE_IPSEC_SAD_SPI_DIP] = MAX_SA;
241 config.max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP] = MAX_SA;
242 config.socket_id = SOCKET_ID_ANY;
243 config.flags = 0;
244 if (ipv6)
245 config.flags = RTE_IPSEC_SAD_FLAG_IPV6;
246
247 sad = rte_ipsec_sad_create(__func__, &config);
248 RTE_TEST_ASSERT_NOT_NULL(sad, "Failed to create SAD\n");
249
250 /* key == NULL*/
251 status = rte_ipsec_sad_del(sad, NULL, RTE_IPSEC_SAD_SPI_DIP_SIP);
252 RTE_TEST_ASSERT(status < 0,
253 "Call succeeded with invalid parameters\n");
254
255 /* len is incorrect */
256 status = rte_ipsec_sad_del(sad, tuple, RTE_IPSEC_SAD_SPI_DIP_SIP + 1);
257 RTE_TEST_ASSERT(status < 0,
258 "Call succeeded with invalid parameters\n");
259
260 rte_ipsec_sad_destroy(sad);
261
262 return TEST_SUCCESS;
263}
264
265/*
266 * Check that rte_ipsec_sad_delete fails gracefully for incorrect user input

Callers 1

test_delete_invalidFunction · 0.85

Calls 3

rte_ipsec_sad_delFunction · 0.85
rte_ipsec_sad_createFunction · 0.85
rte_ipsec_sad_destroyFunction · 0.85

Tested by

no test coverage detected