2 # SPDX-License-Identifier: BSD-3-Clause
4 # Usage: /bin/bash run_test.sh [-46miflscph] <ipsec_mode>
5 # Run all defined linux_test.sh test-cases one by one
6 # If <ipsec_mode> is specified, run only that test case
7 # User has to setup properly the following environment variables:
8 # SGW_PATH - path to the ipsec-secgw binary to test
9 # REMOTE_HOST - ip/hostname of the DUT
10 # REMOTE_IFACE - iface name for the test-port on DUT
11 # ETH_DEV - ethernet device to be used on SUT by DPDK ('-a <pci-id>')
12 # Also user can optionally setup:
13 # SGW_LCORE - lcore to run ipsec-secgw on (default value is 0)
14 # CRYPTO_DEV - crypto device to be used ('-a <pci-id>')
15 # if none specified appropriate vdevs will be created by the script
16 # SGW_MULTI_SEG - ipsec-secgw option to enable reassembly support and
17 # specify size of reassembly table (i.e. SGW_MULTI_SEG=128)
18 # Refer to linux_test.sh for more information
20 # All supported modes to test:
30 # 'tun/trs' refer to tunnel/transport mode respectively
35 echo -e "\t$0 -[46miflscph] <ipsec_mode>"
36 echo -e "\t\t-4 Perform Linux IPv4 network tests"
37 echo -e "\t\t-6 Perform Linux IPv6 network tests"
38 echo -e "\t\t-m Add mixed IP protocol tests to IPv4/IPv6 \
39 (only with option [-46])"
40 echo -e "\t\t-i Run inline tests (only with option [-46])"
41 echo -e "\t\t-f Run fallback tests (only with option [-46])"
42 echo -e "\t\t-l Run tests in legacy mode"
43 echo -e "\t\t-s Run all tests with reassembly support \
44 (on default only fallback tests use reassembly support)"
45 echo -e "\t\t-c Run tests with use of cpu-crypto \
46 (on default lookaside-none is used)"
47 echo -e "\t\t-p Perform packet validation tests"
48 echo -e "\t\t-h Display this help"
49 echo -e "\t\t<ipsec_mode> Run only specified test case i.e. tun_aesgcm"
52 LINUX_TEST="trs_3descbc_sha1 \
61 LINUX_TEST_INLINE_FALLBACK="trs_aesgcm \
66 PKT_TESTS="trs_ipv6opts \
67 tun_null_header_reconstruct"
82 while getopts ":46miflscph" opt
102 options="${options} -l"
106 options="${options} -s"
110 options="${options} -c"
120 echo "Invalid option"
130 # no test suite has been selected
131 if [[ ${run4} -eq 0 && ${run6} -eq 0 && ${runpkt} -eq 0 ]]; then
137 if [[ ${legacy} -eq 1 ]] && [[ ${multi_seg} -eq 1 || ${fallback} -eq 1 \
138 || ${cpu_crypto} -eq 1 ]]; then
139 echo "Fallback/reassembly/cpu-crypto cannot be used with legacy mode"
143 if [[ ${cpu_crypto} -eq 1 && ${inline} -eq 1 && ${fallback} -eq 0 ]]; then
144 echo "cpu-crypto cannot be used with inline mode"
148 # perform packet processing validation tests
150 if [ $runpkt -eq 1 ]; then
151 echo "Performing packet validation tests"
152 /bin/bash ${DIR}/pkttest.sh ${PKT_TESTS}
155 echo "pkttests finished with status ${st}"
156 if [[ ${st} -ne 0 ]]; then
157 echo "ERROR pkttests FAILED"
164 # set inline/fallback tests if needed
165 if [[ ${inline} -eq 1 || ${fallback} -eq 1 ]]; then
167 # add inline option if needed
168 if [[ ${inline} -eq 1 ]]; then
169 options="${options} -i"
172 # add fallback option if needed
173 if [[ ${fallback} -eq 1 ]]; then
174 options="${options} -f"
175 if [[ "${desc}" == "inline" ]]; then
176 desc="${desc} and fallback"
182 # select tests to run
183 if [[ -z "${LINUX_TEST_RUN}" ]]; then
184 LINUX_TEST_RUN="${LINUX_TEST_INLINE_FALLBACK}"
187 options="${options} -r"
190 # select tests to run
191 if [[ -z "${LINUX_TEST_RUN}" ]]; then
192 LINUX_TEST_RUN="${LINUX_TEST}"
195 # perform selected tests
196 if [[ ${run4} -eq 1 || ${run6} -eq 1 ]] ; then
198 for i in ${LINUX_TEST_RUN}; do
200 echo "starting ${desc} test ${i}"
204 if [[ ${run4} -ne 0 ]]; then
205 /bin/bash ${DIR}/load_env.sh ${options} ipv4-ipv4 ${i}
207 echo "${desc} test IPv4 ${i} finished with status \
209 if [[ ${mixed} -ne 0 ]] && [[ "${i}" == tun* ]]; then
210 /bin/bash ${DIR}/load_env.sh ${options} \
213 echo "${desc} test IPv4-IPv6 ${i} finished with\
220 if [[ ${run6} -ne 0 ]]; then
221 /bin/bash ${DIR}/load_env.sh ${options} ipv6-ipv6 ${i}
223 echo "${desc} test IPv6 ${i} finished with status \
225 if [[ ${mixed} -ne 0 ]] && [[ "${i}" == tun* ]]; then
226 /bin/bash ${DIR}/load_env.sh ${options} \
229 echo "${desc} test IPv6-IPv4 ${i} finished with\
234 let "st = st4 + st6 + st4m + st6m"
235 if [[ $st -ne 0 ]]; then
236 echo "ERROR ${desc} test ${i} FAILED"
242 echo "All tests have ended successfully"