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