File: networktests.sh

package info (click to toggle)
ltp 20091231%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 55,344 kB
  • ctags: 42,033
  • sloc: ansic: 428,545; sh: 80,565; xml: 8,269; java: 4,742; perl: 4,182; cpp: 4,105; makefile: 3,801; python: 2,151; exp: 1,150; php: 626; lex: 575; pascal: 441; csh: 59; awk: 16; tcl: 11
file content (133 lines) | stat: -rwxr-xr-x 3,533 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/sh
# This will run all the network tests, with the status logged in /tmp/netpan.log

# ---***** THESE MUST BE SET FOR CORRECT OPERATION *****---
export RHOST=
export PASSWD=
# ---***************************************************---

cd `dirname $0`
export LTPROOT=${PWD}
echo $LTPROOT | grep testscripts > /dev/null 2>&1
if [ $? -eq 0 ]; then
 cd ..
 export LTPROOT=${PWD}
fi

export TMPDIR=/tmp/netpan-$$
mkdir -p $TMPDIR
CMDFILE=${TMPDIR}/network.tests
VERBOSE="no"

# For bitwise operation to determine which testsets run
CMD_IPV6=1		# 0x0001
CMD_IPV6_LIB=2		# 0x0002
CMD_MULTICAST=4		# 0x0004
CMD_NFS=8		# 0x0008
CMD_RPC=16		# 0x0010
CMD_SCTP=32		# 0x0020
CMD_TCPCMDS=64		# 0x0040
CMD_TCPCMDS_ADD=128	# 0x0080
CMD_WHOLE=65535		# 0xFFFF
CMD_DEFAULT=$(($CMD_MULTICAST|$CMD_NFS|$CMD_RPC|$CMD_TCPCMDS))

# ---***** NFS OPTIONAL SETTINGS *****---
# DEFAULTS
# export VERSION=2 
# export SOCKET_TYPE=udp
# ---*********************************---

usage() {
    echo ""
    echo "---------------------------------------------------------"
    echo -e "\033[31m $0 [options] \033[0m "
    echo "---------------------------------------------------------"
    echo " -W|w: whole network tests"
    echo " -D|d: default network tests"
    echo " -6:   IPv6 tests"
    echo " -L|l: IPv6 library tests"
    echo " -M|m: multicast tests"
    echo " -N|n: nfs tests"
    echo " -R|r: rpc tests"
    echo " -S|s: sctp tests"
    echo " -T|t: TCP/IP command tests"
    echo " -V|v: Enable verbose"
    echo " -H|h: This Usage"
    echo "*) 'default' runs multicast, rpc, nfs and some of TCP/IP command"
    echo "   It is interpreted as 'default' if no test sets are specified"
    echo ""
}

# Parse options
CMD=0
while getopts WwDd6LlMmNnRrSsTtVvHh OPTION
do
    case $OPTION in
	W|w) CMD=$CMD_WHOLE;;
	D|d) CMD=$(($CMD|$CMD_DEFAULT));;
	6)   CMD=$(($CMD|$CMD_IPV6));;
	L|l) CMD=$(($CMD|$CMD_IPV6_LIB));;
	M|m) CMD=$(($CMD|$CMD_MULTICAST));;
	N|n) CMD=$(($CMD|$CMD_NFS));;
	R|r) CMD=$(($CMD|$CMD_RPC));;
	S|s) CMD=$(($CMD|$CMD_SCTP));;
	T|t) CMD=$(($CMD|$CMD_TCPCMDS|$CMD_TCPCMDS_ADD));;
	V|v) VERBOSE="yes";;
	H|h) usage; exit 0 ;;
	*) echo "Error: invalid option..."; usage; exit 1 ;;
    esac
done
if [ $CMD -eq 0 ]; then
    CMD=$CMD_DEFAULT
fi

# Determine which test set will run
rm -f $CMDFILE
if [ $(($CMD&$CMD_IPV6)) -ne 0 ]; then
    cat  ${LTPROOT}/runtest/ipv6 >> $CMDFILE
fi
if [ $(($CMD&$CMD_IPV6_LIB)) -ne 0 ]; then
    cat  ${LTPROOT}/runtest/ipv6_lib >> $CMDFILE
fi
if [ $(($CMD&$CMD_MULTICAST)) -ne 0 ]; then
    cat  ${LTPROOT}/runtest/multicast >> $CMDFILE
fi
if [ $(($CMD&$CMD_NFS)) -ne 0 ]; then
    cat  ${LTPROOT}/runtest/nfs >> $CMDFILE
fi
if [ $(($CMD&$CMD_RPC)) -ne 0 ]; then
    cat  ${LTPROOT}/runtest/rpc >> $CMDFILE
fi
if [ $(($CMD&$CMD_SCTP)) -ne 0 ]; then
    cat  ${LTPROOT}/runtest/sctp >> $CMDFILE
fi
if [ $(($CMD&$CMD_TCPCMDS)) -ne 0 ]; then
    cat  ${LTPROOT}/runtest/tcp_cmds >> $CMDFILE
fi
if [ $(($CMD&$CMD_TCPCMDS_ADD)) -ne 0 ]; then
    cat  ${LTPROOT}/runtest/tcp_cmds_addition >> $CMDFILE
fi

cd $TMPDIR

export PATH="${PATH}:${LTPROOT}/testcases/bin"

if [ ${VERBOSE} = "yes" ]; then
    echo "Network parameters:"
    echo " - Remote Host: ${RHOST}"

    cat $CMDFILE
    ${LTPROOT}/ver_linux
    echo ""
    echo ${LTPROOT}/pan/ltp-pan -e -l /tmp/netpan.log -S -a ltpnet -n ltpnet -f $CMDFILE
fi

${LTPROOT}/pan/ltp-pan -e -l /tmp/netpan.log -S -a ltpnet -n ltpnet -f $CMDFILE

if [ $? -eq "0" ]; then
  echo ltp-pan reported PASS
else
  echo ltp-pan reported FAIL
fi

rm -rf ${TMPDIR}