examples/ipsec-secgw: add multi-segment test cases
[dpdk.git] / examples / ipsec-secgw / test / run_test.sh
1 #! /bin/bash
2
3 # usage: /bin/bash run_test.sh [-46]
4 # Run all defined linux_test[4,6].sh test-cases one by one
5 # user has to setup properly the following environment variables:
6 #  SGW_PATH - path to the ipsec-secgw binary to test
7 #  REMOTE_HOST - ip/hostname of the DUT
8 #  REMOTE_IFACE - iface name for the test-port on DUT
9 #  ETH_DEV - ethernet device to be used on SUT by DPDK ('-w <pci-id>')
10 # Also user can optonally setup:
11 #  SGW_LCORE - lcore to run ipsec-secgw on (default value is 0)
12 #  CRYPTO_DEV - crypto device to be used ('-w <pci-id>')
13 #  if none specified appropriate vdevs will be created by the scrit
14 #  MULTI_SEG_TEST - ipsec-secgw option to enable reassembly support and
15 #  specify size of reassembly table (i.e. MULTI_SEG_TEST="--reassemble 128")
16 # refer to linux_test[4,6].sh for more information
17
18
19 # All supported modes to test.
20 # naming convention:
21 # 'old' means that ipsec-secgw will run in legacy (non-librte_ipsec mode)
22 # 'tun/trs' refer to tunnel/transport mode respectively
23
24 usage()
25 {
26         echo "Usage:"
27         echo -e "\t$0 -[46p]"
28         echo -e "\t\t-4 Perform Linux IPv4 network tests"
29         echo -e "\t\t-6 Perform Linux IPv6 network tests"
30         echo -e "\t\t-p Perform packet validation tests"
31         echo -e "\t\t-h Display this help"
32 }
33
34 LINUX_TEST="tun_aescbc_sha1 \
35 tun_aescbc_sha1_esn \
36 tun_aescbc_sha1_esn_atom \
37 tun_aesgcm \
38 tun_aesgcm_esn \
39 tun_aesgcm_esn_atom \
40 trs_aescbc_sha1 \
41 trs_aescbc_sha1_esn \
42 trs_aescbc_sha1_esn_atom \
43 trs_aesgcm \
44 trs_aesgcm_esn \
45 trs_aesgcm_esn_atom \
46 tun_aescbc_sha1_old \
47 tun_aesgcm_old \
48 trs_aescbc_sha1_old \
49 trs_aesgcm_old \
50 tun_aesctr_sha1 \
51 tun_aesctr_sha1_old \
52 tun_aesctr_sha1_esn \
53 tun_aesctr_sha1_esn_atom \
54 trs_aesctr_sha1 \
55 trs_aesctr_sha1_old \
56 trs_aesctr_sha1_esn \
57 trs_aesctr_sha1_esn_atom \
58 tun_3descbc_sha1 \
59 tun_3descbc_sha1_old \
60 tun_3descbc_sha1_esn \
61 tun_3descbc_sha1_esn_atom \
62 trs_3descbc_sha1 \
63 trs_3descbc_sha1_old \
64 trs_3descbc_sha1_esn \
65 trs_3descbc_sha1_esn_atom"
66
67 PKT_TESTS="trs_ipv6opts"
68
69 DIR=$(dirname $0)
70
71 # get input options
72 run4=0
73 run6=0
74 runpkt=0
75 while getopts ":46ph" opt
76 do
77         case $opt in
78                 4)
79                         run4=1
80                         ;;
81                 6)
82                         run6=1
83                         ;;
84                 p)
85                         runpkt=1
86                         ;;
87                 h)
88                         usage
89                         exit 0
90                         ;;
91                 ?)
92                         echo "Invalid option"
93                         usage
94                         exit 127
95                         ;;
96         esac
97 done
98
99 # no test suite has been selected
100 if [[ ${run4} -eq 0 && ${run6} -eq 0 && ${runpkt} -eq 0 ]]; then
101         usage
102         exit 127
103 fi
104
105 # perform packet processing validation tests
106 st=0
107 if [ $runpkt -eq 1 ]; then
108         echo "Performing packet validation tests"
109         /bin/bash ${DIR}/pkttest.sh ${PKT_TESTS}
110         st=$?
111
112         echo "pkttests finished with status ${st}"
113         if [[ ${st} -ne 0 ]]; then
114                 echo "ERROR pkttests FAILED"
115                 exit ${st}
116         fi
117 fi
118
119 # perform network tests
120 if [[ ${run4} -eq 1 || ${run6} -eq 1 ]]; then
121         for i in ${LINUX_TEST}; do
122
123                 echo "starting test ${i}"
124
125                 st4=0
126                 if [[ ${run4} -ne 0 ]]; then
127                         /bin/bash ${DIR}/linux_test4.sh ${i}
128                         st4=$?
129                         echo "test4 ${i} finished with status ${st4}"
130                 fi
131
132                 st6=0
133                 if [[ ${run6} -ne 0 ]]; then
134                         /bin/bash ${DIR}/linux_test6.sh ${i}
135                         st6=$?
136                         echo "test6 ${i} finished with status ${st6}"
137                 fi
138
139                 let "st = st4 + st6"
140                 if [[ $st -ne 0 ]]; then
141                         echo "ERROR test ${i} FAILED"
142                         exit $st
143                 fi
144         done
145 fi