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