1 #!/bin/sh 2 3 cd $(dirname $0) 4 export LTPROOT=${LTPROOT:-"$PWD"} 5 echo $LTPROOT | grep -q testscripts 6 if [ $? -eq 0 ]; then 7 cd .. 8 export LTPROOT=${PWD} 9 fi 10 11 export TMPDIR=/tmp/netpan-$$ 12 mkdir -p $TMPDIR 13 CMDFILE=${TMPDIR}/network.tests 14 VERBOSE="no" 15 16 export PATH="${PATH}:${LTPROOT}/testcases/bin" 17 18 usage() 19 { 20 echo "Usage: $0 OPTIONS" 21 echo " -6 IPv6 tests" 22 echo " -m multicast tests" 23 echo " -n NFS tests" 24 echo " -r RPC tests" 25 echo " -s SCTP tests" 26 echo " -t TCP/IP command tests" 27 echo " -c TI-RPC tests" 28 echo " -d TS-RPC tests" 29 echo " -a Application stress tests (HTTP, SSH, DNS)" 30 echo " -e Interface stress tests" 31 echo " -b Stress tests with malformed ICMP packets" 32 echo " -i IPsec ICMP stress tests" 33 echo " -T IPsec TCP stress tests" 34 echo " -U IPsec UDP stress tests" 35 echo " -R route stress tests" 36 echo " -M multicast stress tests" 37 echo " -F network features tests (TFO, vxlan, etc.)" 38 echo " -f x where x is a runtest file" 39 echo " -V|v verbose" 40 echo " -h print this help" 41 } 42 43 TEST_CASES= 44 45 while getopts 6mnrstaebcdiTURMFf:Vvh OPTION 46 do 47 case $OPTION in 48 6) TEST_CASES="$TEST_CASES net.ipv6 net.ipv6_lib";; 49 m) TEST_CASES="$TEST_CASES net.multicast";; 50 n) TEST_CASES="$TEST_CASES net.nfs";; 51 r) TEST_CASES="$TEST_CASES net.rpc";; 52 s) TEST_CASES="$TEST_CASES net.sctp";; 53 t) TEST_CASES="$TEST_CASES net.tcp_cmds";; 54 c) TEST_CASES="$TEST_CASES net.rpc_tests";; 55 d) TEST_CASES="$TEST_CASES net.tirpc_tests";; 56 a) TEST_CASES="$TEST_CASES net_stress.appl";; 57 e) TEST_CASES="$TEST_CASES net_stress.interface";; 58 b) TEST_CASES="$TEST_CASES net_stress.broken_ip";; 59 i) TEST_CASES="$TEST_CASES net_stress.ipsec_icmp";; 60 T) TEST_CASES="$TEST_CASES net_stress.ipsec_tcp";; 61 U) TEST_CASES="$TEST_CASES net_stress.ipsec_udp";; 62 R) TEST_CASES="$TEST_CASES net_stress.route";; 63 M) TEST_CASES="$TEST_CASES net_stress.multicast";; 64 F) TEST_CASES="$TEST_CASES net.features";; 65 f) TEST_CASES=${OPTARG};; 66 V|v) VERBOSE="yes";; 67 h) usage; exit 0;; 68 *) echo "Error: invalid option..."; usage; exit 1;; 69 esac 70 done 71 72 if [ "$OPTIND" -eq 1 ]; then 73 echo "Error: option is required" 74 usage 75 exit 1 76 fi 77 78 TST_TOTAL=1 79 TCID="network_settings" 80 81 . test_net.sh 82 83 # Reset variables. 84 # Don't break the tests which are using 'testcases/lib/cmdlib.sh' 85 export TCID= 86 export TST_LIB_LOADED= 87 88 rm -f $CMDFILE 89 90 for t in $TEST_CASES; do 91 cat ${LTPROOT}/runtest/$t >> $CMDFILE 92 done 93 94 cd $TMPDIR 95 96 if [ ${VERBOSE} = "yes" ]; then 97 echo "Network parameters:" 98 echo " - ${LHOST_IFACES} local interface (MAC address: ${LHOST_HWADDRS})" 99 echo " - ${RHOST_IFACES} remote interface (MAC address: ${RHOST_HWADDRS})" 100 101 cat $CMDFILE 102 ${LTPROOT}/ver_linux 103 echo "" 104 echo ${LTPROOT}/bin/ltp-pan -e -l /tmp/netpan.log -S -a ltpnet -n ltpnet -f $CMDFILE 105 fi 106 107 ${LTPROOT}/bin/ltp-pan -e -l /tmp/netpan.log -S -a ltpnet -n ltpnet -f $CMDFILE 108 109 if [ $? -eq "0" ]; then 110 echo ltp-pan reported PASS 111 else 112 echo ltp-pan reported FAIL 113 fi 114