Imported Upstream version 20090930
[ltp-debian.git] / testscripts / runEALtests.sh
blobc18acc2883009065b5aac9379a268532dbdf1c6a
1 #!/bin/sh
4 #
5 # 07/10/02 - Jeff Martin - martinjn@us.ibm.com: Added instance and
6 # time command line options
8 # 12/15/02 - Manoj Iyer - manjo@mail.utexas.edu: Added options to run
9 # LTP under CPU, IO and MM load.
11 # 01/26/03 - Manoj Iyer - manjo@mail.utexas.edu: Added -f option; Execute
12 # user defined set of testcases.
14 # 01/27/03 - Manoj Iyer - manjo@mail.utexas.edu: Enabled formatted printing
15 # of logfiles.
17 # 01/28/03 - Manoj Iyer - manjo@mail.utexas.edu: added option to enable
18 # formatted printing of logfiles.
20 # 01/29/03 - Manoj Iyer - manjo@mail.utexas.edu: merged networktests.sh with
21 # this script, added the -n option to run these
22 # tests. Also, added -h option to print help messages.
24 # 01/29/03 - Manoj Iyer - manjo@mail.utexas.edu:
25 # added code to cause pan to print less verbose
26 # output.
27 # 02/01/03 - Manoj Iyer - manjo@mail.utexas.edu: Removed variables
28 # initialization of RHOST and PASSWD.
30 # 02/05/03 - Robbie Williamson - Added configurability to the optional load
31 # generator sections. Also added network traffic
32 # option.
35 cd `dirname $0`
36 export LTPROOT=${PWD}
37 export TMPBASE="/tmp"
38 export TMP="${TMPBASE}/runalltests-$$"
39 export PATH="${PATH}:${LTPROOT}/../testcases/bin"
40 cmdfile=""
41 pretty_prt=" "
42 alt_dir=0
43 run_netest=0
44 quiet_mode=" "
45 NetPipe=0
46 GenLoad=0
48 usage()
50 cat <<-END >&2
51 usage: ./${0##*/} -c [-d tmpdir] [-f cmdfile ] [-i # (in Mb)] [ -l logfile ]
52 [ -m # (in Mb)] -N -n -q [ -r ltproot ] [ -t duration ] [ -x instances ]
54 -c Run LTP under additional background CPU load.
55 -d tmpdir Directory where temporary files will be created.
56 -f cmdfile Execute user defined list of testcases.
57 -h Help. Prints all available options.
58 -i # (in Mb) Run LTP with a _minimum_ IO load of # megabytes in background.
59 -l logfile Log results of test in a logfile.
60 -m # (in Mb) Run LTP with a _minimum_ memory load of # megabytes in background.
61 -N Run all the networking tests.
62 (export RHOST = remote hostname)
63 (export PASSWD = passwd of remote host)
64 -n Run LTP with network traffic in background.
65 -p Human readable format logfiles.
66 -q Print less verbose output to screen.
67 -r ltproot Fully qualified path where testsuite is installed.
68 -t duration Execute the testsuite for given duration in hours.
69 -x instances Run multiple instances of this testsuite.
71 example: ./${0##*/} -i 1024 -m 128 -p -q -l /tmp/resultlog.$$ -d ${PWD}
72 END
73 exit
76 mkdir -p ${TMP}
78 cd ${TMP}
79 if [ $? -ne 0 ]; then
80 echo "could not cd ${TMP} ... exiting"
81 exit
84 while getopts cd:f:hi:l:m:Nnpqr:t:x arg
85 do case $arg in
86 c)
87 $LTPROOT/../testcases/bin/genload --cpu 1 2>&1 1>/dev/null &
88 GenLoad=1 ;;
90 d) # append $$ to TMP, as it is recursively
91 # removed at end of script.
92 TMPBASE=$OPTARG;;
93 f) # Execute user defined set of testcases.
94 cmdfile=$OPTARG;;
96 h) usage;;
98 i)
99 bytesize=$(($OPTARG * 1024 * 1024))
100 $LTPROOT/../testcases/bin/genload --io 1 2>&1 1>/dev/null &
101 $LTPROOT/../testcases/bin/genload --hdd 0 --hdd-bytes $bytesize \
102 2>&1 1>/dev/null &
103 GenLoad=1 ;;
106 if [ ${OPTARG:0:1} != "/" ]
107 then
108 if [ -d $LTPROOT/results ]
109 then
110 logfile="-l $LTPROOT/results/$OPTARG"
111 else
112 mkdir -p $LTPROOT/results
113 if [ $? -ne 0 ]
114 then
115 echo "ERROR: failed to create $LTPROOT/results"
116 exit 1
118 logfile="-l $LTPROOT/results/$OPTARG"
120 alt_dir=1
121 else
122 logfile="-l $OPTARG"
123 fi ;;
126 memsize=$(($OPTARG * 1024 * 1024))
127 $LTPROOT/../testcases/bin/genload --vm 0 --vm-bytes $memsize\
128 2>&1 1>/dev/null &
129 GenLoad=1;;
131 N) run_netest=1;;
133 n) $LTPROOT/../testcases/bin/netpipe.sh
134 NetPipe=1;;
136 p) pretty_prt=" -p ";;
138 q) quiet_mode=" -q ";;
140 r) LTPROOT=$OPTARG;;
142 t) # In case you want to specify the time
143 # to run from the command line
144 # (2m = two minutes, 2h = two hours, etc)
145 duration="-t $OPTARG" ;;
147 x) # number of ltp's to run
148 instances="-x $OPTARG";;
150 \?) usage;;
151 esac
152 done
154 if [ -z $PASSWD ]
155 then
156 echo " "
157 echo "ERROR:"
158 echo "Please export enviroment variable PASSWD"
159 echo "INFO: export PASSWD = 'root's password'"
160 exit 1
163 #if [ $run_netest -eq 1 ]
164 #then
165 # if [[ -z $RHOST || -z $PASSWD ]]
166 # then
167 # echo " "
168 # echo " "
169 # echo "ERROR: Initializing networking tests."
170 # echo "INFO: Please export RHOST = 'name of the remote host machine'"
171 # echo "INFO: Please export PASSWD = 'passwd of the remote host machine'"
172 # echo "INFO: before running the networking tests."
173 # echo " "
174 # echo " "
175 # echo " "
176 # usage
177 # fi
180 if [ -n "$instances" ]; then
181 instances="$instances -O ${TMP}"
185 # If user does not provide a command file select a default set of testcases
186 # to execute.
187 if [ -z $cmdfile ]
188 then
189 cat ${LTPROOT}/../runtest/admin_tools > ${TMP}/alltests
190 else
191 cat $cmdfile > ${TMP}/alltests
194 if [ $run_netest -eq 1 ]
195 then
196 cat ${LTPROOT}/../runtest/network_commands >> ${TMP}/alltests
199 # The fsx-linux tests use the SCRATCHDEV environment variable as a location
200 # that can be reformatted and run on. Set SCRATCHDEV if you want to run
201 # these tests. As a safeguard, this is disabled.
202 unset SCRATCHDEV
203 if [ -n "$SCRATCHDEV" ]; then
204 cat ${LTPROOT}/../runtest/fsx >> ${TMP}/alltests
207 # display versions of installed software
208 ${LTPROOT}/../ver_linux
210 ${LTPROOT}/../pan/ltp-pan $quiet_mode -e -S $instances $duration -a $$ -n $$ $pretty_prt -f ${TMP}/alltests $logfile
212 if [ $? -eq 0 ]; then
213 echo ltp-pan reported PASS
214 else
215 echo ltp-pan reported FAIL
218 if [ $GenLoad -eq 1 ]
219 then
220 killall -9 genload
223 if [ $NetPipe -eq 1 ]
224 then
225 killall -9 NPtcp
228 if [ $alt_dir -eq 1 ]
229 then
230 echo " "
231 echo "###############################################################"
232 echo " "
233 echo " result log is in the $LTPROOT/results directory"
234 echo " "
235 echo "###############################################################"
236 echo " "
238 rm -rf ${TMP}