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 24usage() 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 34LINUX_TEST="tun_aescbc_sha1 \ 35tun_aescbc_sha1_esn \ 36tun_aescbc_sha1_esn_atom \ 37tun_aesgcm \ 38tun_aesgcm_esn \ 39tun_aesgcm_esn_atom \ 40trs_aescbc_sha1 \ 41trs_aescbc_sha1_esn \ 42trs_aescbc_sha1_esn_atom \ 43trs_aesgcm \ 44trs_aesgcm_esn \ 45trs_aesgcm_esn_atom \ 46tun_aescbc_sha1_old \ 47tun_aesgcm_old \ 48trs_aescbc_sha1_old \ 49trs_aesgcm_old \ 50tun_aesctr_sha1 \ 51tun_aesctr_sha1_old \ 52tun_aesctr_sha1_esn \ 53tun_aesctr_sha1_esn_atom \ 54trs_aesctr_sha1 \ 55trs_aesctr_sha1_old \ 56trs_aesctr_sha1_esn \ 57trs_aesctr_sha1_esn_atom \ 58tun_3descbc_sha1 \ 59tun_3descbc_sha1_old \ 60tun_3descbc_sha1_esn \ 61tun_3descbc_sha1_esn_atom \ 62trs_3descbc_sha1 \ 63trs_3descbc_sha1_old \ 64trs_3descbc_sha1_esn \ 65trs_3descbc_sha1_esn_atom" 66 67PKT_TESTS="trs_ipv6opts \ 68tun_null_header_reconstruct" 69 70DIR=$(dirname $0) 71 72# get input options 73run4=0 74run6=0 75runpkt=0 76while getopts ":46ph" opt 77do 78 case $opt in 79 4) 80 run4=1 81 ;; 82 6) 83 run6=1 84 ;; 85 p) 86 runpkt=1 87 ;; 88 h) 89 usage 90 exit 0 91 ;; 92 ?) 93 echo "Invalid option" 94 usage 95 exit 127 96 ;; 97 esac 98done 99 100# no test suite has been selected 101if [[ ${run4} -eq 0 && ${run6} -eq 0 && ${runpkt} -eq 0 ]]; then 102 usage 103 exit 127 104fi 105 106# perform packet processing validation tests 107st=0 108if [ $runpkt -eq 1 ]; then 109 echo "Performing packet validation tests" 110 /bin/bash ${DIR}/pkttest.sh ${PKT_TESTS} 111 st=$? 112 113 echo "pkttests finished with status ${st}" 114 if [[ ${st} -ne 0 ]]; then 115 echo "ERROR pkttests FAILED" 116 exit ${st} 117 fi 118fi 119 120# perform network tests 121if [[ ${run4} -eq 1 || ${run6} -eq 1 ]]; then 122 for i in ${LINUX_TEST}; do 123 124 echo "starting test ${i}" 125 126 st4=0 127 if [[ ${run4} -ne 0 ]]; then 128 /bin/bash ${DIR}/linux_test4.sh ${i} 129 st4=$? 130 echo "test4 ${i} finished with status ${st4}" 131 fi 132 133 st6=0 134 if [[ ${run6} -ne 0 ]]; then 135 /bin/bash ${DIR}/linux_test6.sh ${i} 136 st6=$? 137 echo "test6 ${i} finished with status ${st6}" 138 fi 139 140 let "st = st4 + st6" 141 if [[ $st -ne 0 ]]; then 142 echo "ERROR test ${i} FAILED" 143 exit $st 144 fi 145 done 146fi 147