a6e363125e6aea96f04b59d3262b1c4156cfc4a6
[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 # refer to linux_test1.sh for more information
15
16 # All supported modes to test.
17 # naming convention:
18 # 'old' means that ipsec-secgw will run in legacy (non-librte_ipsec mode)
19 # 'tun/trs' refer to tunnel/transport mode respectively
20 LINUX_TEST="tun_aescbc_sha1 \
21 tun_aescbc_sha1_esn \
22 tun_aescbc_sha1_esn_atom \
23 tun_aesgcm \
24 tun_aesgcm_esn \
25 tun_aesgcm_esn_atom \
26 trs_aescbc_sha1 \
27 trs_aescbc_sha1_esn \
28 trs_aescbc_sha1_esn_atom \
29 trs_aesgcm \
30 trs_aesgcm_esn \
31 trs_aesgcm_esn_atom \
32 tun_aescbc_sha1_old \
33 tun_aesgcm_old \
34 trs_aescbc_sha1_old \
35 trs_aesgcm_old \
36 tun_aesctr_sha1 \
37 tun_aesctr_sha1_old \
38 tun_aesctr_sha1_esn \
39 tun_aesctr_sha1_esn_atom \
40 trs_aesctr_sha1 \
41 trs_aesctr_sha1_old \
42 trs_aesctr_sha1_esn \
43 trs_aesctr_sha1_esn_atom"
44
45 DIR=`dirname $0`
46
47 # get input options
48 st=0
49 run4=0
50 run6=0
51 while [[ ${st} -eq 0 ]]; do
52         getopts ":46" opt
53         st=$?
54         if [[ "${opt}" == "4" ]]; then
55                 run4=1
56         elif [[ "${opt}" == "6" ]]; then
57                 run6=1
58         fi
59 done
60
61 if [[ ${run4} -eq 0 && {run6} -eq 0 ]]; then
62         exit 127
63 fi
64
65 for i in ${LINUX_TEST}; do
66
67         echo "starting test ${i}"
68
69         st4=0
70         if [[ ${run4} -ne 0 ]]; then
71                 /bin/bash ${DIR}/linux_test4.sh ${i}
72                 st4=$?
73                 echo "test4 ${i} finished with status ${st4}"
74         fi
75
76         st6=0
77         if [[ ${run6} -ne 0 ]]; then
78                 /bin/bash ${DIR}/linux_test6.sh ${i}
79                 st6=$?
80                 echo "test6 ${i} finished with status ${st6}"
81         fi
82
83         let "st = st4 + st6"
84         if [[ $st -ne 0 ]]; then
85                 echo "ERROR test ${i} FAILED"
86                 exit $st
87         fi
88 done