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

Function test_find_existing

dpdk/app/test/test_ipsec_sad.c:93–126  ·  view source on GitHub ↗

* Test rte_ipsec_sad_find_existing() * Create SAD and try to find it by it's name */

Source from the content-addressed store, hash-verified

91 * Create SAD and try to find it by it's name
92 */
93int32_t
94test_find_existing(void)
95{
96 const char *name1 = "sad_one";
97 const char *name2 = "sad_two";
98 struct rte_ipsec_sad *one, *two, *tmp;
99 struct rte_ipsec_sad_conf config;
100
101 config.socket_id = SOCKET_ID_ANY;
102 config.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = MAX_SA;
103 config.max_sa[RTE_IPSEC_SAD_SPI_DIP] = 0;
104 config.max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP] = 0;
105 one = rte_ipsec_sad_create(name1, &config);
106 RTE_TEST_ASSERT_NOT_NULL(one, "Failed to create SAD\n");
107 two = rte_ipsec_sad_create(name2, &config);
108 RTE_TEST_ASSERT_NOT_NULL(two, "Failed to create SAD\n");
109
110 /* Find non existing */
111 tmp = rte_ipsec_sad_find_existing("sad_three");
112 RTE_TEST_ASSERT(tmp == NULL,
113 "rte_ipsec_sad_find_existing returns invalid SAD\n");
114
115 tmp = rte_ipsec_sad_find_existing(name1);
116 RTE_TEST_ASSERT(tmp == one,
117 "rte_ipsec_sad_find_existing returns invalid SAD\n");
118
119 tmp = rte_ipsec_sad_find_existing(name2);
120 RTE_TEST_ASSERT(tmp == two,
121 "rte_ipsec_sad_find_existing returns invalid SAD\n");
122
123 rte_ipsec_sad_destroy(one);
124 rte_ipsec_sad_destroy(two);
125 return TEST_SUCCESS;
126}
127
128/*
129 * Create ipsec sad then delete it 10 times

Callers

nothing calls this directly

Calls 3

rte_ipsec_sad_createFunction · 0.85
rte_ipsec_sad_destroyFunction · 0.85

Tested by

no test coverage detected