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

Function test_create_invalid

dpdk/app/test/test_ipsec_sad.c:50–87  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

48 * arguments
49 */
50int32_t
51test_create_invalid(void)
52{
53 struct rte_ipsec_sad *sad = NULL;
54 struct rte_ipsec_sad_conf config;
55
56 config.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = MAX_SA;
57 config.max_sa[RTE_IPSEC_SAD_SPI_DIP] = MAX_SA;
58 config.max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP] = MAX_SA;
59 config.socket_id = SOCKET_ID_ANY;
60 config.flags = 0;
61
62 /* name == NULL */
63 sad = rte_ipsec_sad_create(NULL, &config);
64 RTE_TEST_ASSERT(sad == NULL,
65 "Call succeeded with invalid parameters\n");
66
67 /* max_sa for every type = 0 */
68 config.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = 0;
69 config.max_sa[RTE_IPSEC_SAD_SPI_DIP] = 0;
70 config.max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP] = 0;
71 sad = rte_ipsec_sad_create(__func__, &config);
72 RTE_TEST_ASSERT(sad == NULL,
73 "Call succeeded with invalid parameters\n");
74 config.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = MAX_SA;
75 config.max_sa[RTE_IPSEC_SAD_SPI_DIP] = MAX_SA;
76 config.max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP] = MAX_SA;
77
78 /* socket_id < -1 is invalid */
79 config.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = MAX_SA;
80 config.socket_id = -2;
81 sad = rte_ipsec_sad_create(__func__, &config);
82 RTE_TEST_ASSERT(sad == NULL,
83 "Call succeeded with invalid parameters\n");
84 config.socket_id = SOCKET_ID_ANY;
85
86 return TEST_SUCCESS;
87}
88
89/*
90 * Test rte_ipsec_sad_find_existing()

Callers

nothing calls this directly

Calls 1

rte_ipsec_sad_createFunction · 0.85

Tested by

no test coverage detected