blob: 92f54c0ad5b87b66e81b326361f303d594875890 [file] [log] [blame]
alaffin802d3e32000-08-23 20:04:23 +00001#!/bin/sh
robbiew23796112003-02-05 16:28:37 +00002
alaffin802d3e32000-08-23 20:04:23 +00003
martinjnfef097c2002-07-10 14:08:24 +00004#
iyermanoj0ceb9482002-12-15 22:49:34 +00005# 07/10/02 - Jeff Martin - martinjn@us.ibm.com: Added instance and
6# time command line options
7#
8# 12/15/02 - Manoj Iyer - manjo@mail.utexas.edu: Added options to run
9# LTP under CPU, IO and MM load.
martinjnfef097c2002-07-10 14:08:24 +000010#
iyermanoj1e45bef2003-01-26 20:38:45 +000011# 01/26/03 - Manoj Iyer - manjo@mail.utexas.edu: Added -f option; Execute
12# user defined set of testcases.
iyermanoj99d55702003-01-29 22:36:21 +000013#
iyermanojfb7b58f2003-01-27 23:01:48 +000014# 01/27/03 - Manoj Iyer - manjo@mail.utexas.edu: Enabled formatted printing
15# of logfiles.
iyermanoj99d55702003-01-29 22:36:21 +000016#
iyermanoj6714bb12003-01-28 20:08:44 +000017# 01/28/03 - Manoj Iyer - manjo@mail.utexas.edu: added option to enable
18# formatted printing of logfiles.
iyermanoj99d55702003-01-29 22:36:21 +000019#
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.
23#
iyermanoj3b59c692003-02-01 18:15:27 +000024# 01/29/03 - Manoj Iyer - manjo@mail.utexas.edu:
iyermanoj1e77a292003-01-30 06:29:46 +000025# added code to cause pan to print less verbose
26# output.
iyermanoj3b59c692003-02-01 18:15:27 +000027# 02/01/03 - Manoj Iyer - manjo@mail.utexas.edu: Removed variables
28# initialization of RHOST and PASSWD.
iyermanoj1e45bef2003-01-26 20:38:45 +000029#
robbiew23796112003-02-05 16:28:37 +000030# 02/05/03 - Robbie Williamson - Added configurability to the optional load
31# generator sections. Also added network traffic
32# option.
33#
robbiew6e597942003-04-23 19:31:08 +000034# 04/23/03 - Robbie Williamson - Added "-o" option and ability to set network
35# testing variables RHOST and PASSWD.
36#
martinjnfef097c2002-07-10 14:08:24 +000037
alaffin802d3e32000-08-23 20:04:23 +000038cd `dirname $0`
plarsefd320c2001-09-05 20:45:14 +000039export LTPROOT=${PWD}
plarsd05638c2002-09-09 18:30:48 +000040export TMPBASE="/tmp"
robbiew70513f02003-02-05 16:39:26 +000041export TMP="${TMPBASE}/runalltests-$$"
42export PATH="${PATH}:${LTPROOT}/testcases/bin"
iyermanoj1e45bef2003-01-26 20:38:45 +000043cmdfile=""
iyermanoj6714bb12003-01-28 20:08:44 +000044pretty_prt=" "
iyermanoja3973952003-01-29 01:54:40 +000045alt_dir=0
iyermanoj99d55702003-01-29 22:36:21 +000046run_netest=0
iyermanoj1e77a292003-01-30 06:29:46 +000047quiet_mode=" "
robbiewb3db6202003-02-05 20:39:39 +000048NetPipe=0
robbiew270ef592003-02-05 22:06:00 +000049GenLoad=0
alaffin802d3e32000-08-23 20:04:23 +000050
plarsd05638c2002-09-09 18:30:48 +000051usage()
52{
53 cat <<-END >&2
robbiewd98e8362003-04-15 14:19:00 +000054 usage: ./${0##*/} -c [-d tmpdir] [-f cmdfile ] [-i # (in Mb)] [ -l logfile ] [ -o outputfile ]
robbiew23796112003-02-05 16:28:37 +000055 [ -m # (in Mb)] -N -n -q [ -r ltproot ] [ -t duration ] [ -x instances ]
iyermanoj0ceb9482002-12-15 22:49:34 +000056
robbiew797ab8c2003-02-04 21:04:14 +000057 -c Run LTP under additional background CPU load.
iyermanoj0ceb9482002-12-15 22:49:34 +000058 -d tmpdir Directory where temporary files will be created.
iyermanoj1e45bef2003-01-26 20:38:45 +000059 -f cmdfile Execute user defined list of testcases.
iyermanoj99d55702003-01-29 22:36:21 +000060 -h Help. Prints all available options.
robbiew797ab8c2003-02-04 21:04:14 +000061 -i # (in Mb) Run LTP with a _minimum_ IO load of # megabytes in background.
iyermanoj0ceb9482002-12-15 22:49:34 +000062 -l logfile Log results of test in a logfile.
robbiew797ab8c2003-02-04 21:04:14 +000063 -m # (in Mb) Run LTP with a _minimum_ memory load of # megabytes in background.
robbiew23796112003-02-05 16:28:37 +000064 -N Run all the networking tests.
robbiew23796112003-02-05 16:28:37 +000065 -n Run LTP with network traffic in background.
robbiewd98e8362003-04-15 14:19:00 +000066 -o outputfile Redirect test output to a file.
iyermanoj6714bb12003-01-28 20:08:44 +000067 -p Human readable format logfiles.
iyermanoj1e77a292003-01-30 06:29:46 +000068 -q Print less verbose output to screen.
iyermanoj0ceb9482002-12-15 22:49:34 +000069 -r ltproot Fully qualified path where testsuite is installed.
robbiew458cc812003-03-25 17:00:24 +000070 -t duration Execute the testsuite for given duration. Examples:
71 -t 60s = 60 seconds
72 -t 45m = 45 minutes
73 -t 24h = 24 hours
74 -t 2d = 2 days
75
iyermanoja34eb072002-12-15 21:29:15 +000076 -x instances Run multiple instances of this testsuite.
plarsd05638c2002-09-09 18:30:48 +000077
robbiew797ab8c2003-02-04 21:04:14 +000078 example: ./${0##*/} -i 1024 -m 128 -p -q -l /tmp/resultlog.$$ -d ${PWD}
iyermanojb299a832003-03-27 09:21:33 +000079
80 NOTE: If you do not wish to learn these options use the "runltp" program instead.
plarsd05638c2002-09-09 18:30:48 +000081 END
82exit
83}
84
robbiewda7deef2003-02-05 19:08:37 +000085mkdir -p ${TMP}
86
robbiew70513f02003-02-05 16:39:26 +000087cd ${TMP}
88if [ $? -ne 0 ]; then
89 echo "could not cd ${TMP} ... exiting"
90 exit
91fi
iyermanoj0ceb9482002-12-15 22:49:34 +000092
robbiewd98e8362003-04-15 14:19:00 +000093while getopts cd:f:hi:l:m:Nno:pqr:t:x: arg
iyermanoj0ceb9482002-12-15 22:49:34 +000094do case $arg in
robbiew270ef592003-02-05 22:06:00 +000095 c)
96 $LTPROOT/testcases/bin/genload --cpu 1 2>&1 1>/dev/null &
97 GenLoad=1 ;;
iyermanoj1e45bef2003-01-26 20:38:45 +000098
99 d) # append $$ to TMP, as it is recursively
100 # removed at end of script.
101 TMPBASE=$OPTARG;;
102 f) # Execute user defined set of testcases.
103 cmdfile=$OPTARG;;
iyermanoj99d55702003-01-29 22:36:21 +0000104
robbiew23796112003-02-05 16:28:37 +0000105 h) usage;;
iyermanoj1e45bef2003-01-26 20:38:45 +0000106
107 i)
robbiewb3db6202003-02-05 20:39:39 +0000108 bytesize=$(($OPTARG * 1024 * 1024))
robbiew797ab8c2003-02-04 21:04:14 +0000109 $LTPROOT/testcases/bin/genload --io 1 2>&1 1>/dev/null &
110 $LTPROOT/testcases/bin/genload --hdd 0 --hdd-bytes $bytesize \
robbiew270ef592003-02-05 22:06:00 +0000111 2>&1 1>/dev/null &
112 GenLoad=1 ;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000113
plars61bdeca2003-01-28 23:23:36 +0000114 l)
robbiew8c819a52003-04-14 21:00:16 +0000115 case $OPTARG in
116 /*)
117 logfile="-l $OPTARG" ;;
118 *)
119 if [ ! -d $LTPROOT/results ]; then
120 mkdir -p $LTPROOT/results
121 if [ $? -ne 0 ]; then
122 echo "ERROR: failed to create $LTPROOT/results"
123 exit 1
iyermanoj99d55702003-01-29 22:36:21 +0000124 fi
robbiew8c819a52003-04-14 21:00:16 +0000125 fi
126 logfile="-l $LTPROOT/results/$OPTARG"
127 alt_dir=1 ;;
128 esac ;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000129
robbiew797ab8c2003-02-04 21:04:14 +0000130 m)
robbiewb3db6202003-02-05 20:39:39 +0000131 memsize=$(($OPTARG * 1024 * 1024))
robbiew797ab8c2003-02-04 21:04:14 +0000132 $LTPROOT/testcases/bin/genload --vm 0 --vm-bytes $memsize\
robbiew270ef592003-02-05 22:06:00 +0000133 2>&1 1>/dev/null &
134 GenLoad=1;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000135
robbiew23796112003-02-05 16:28:37 +0000136 N) run_netest=1;;
137
138 n) $LTPROOT/testcases/bin/netpipe.sh
robbiewb3db6202003-02-05 20:39:39 +0000139 NetPipe=1;;
iyermanoj99d55702003-01-29 22:36:21 +0000140
robbiewd98e8362003-04-15 14:19:00 +0000141 o) outputfile="-o $OPTARG" ;;
142
plars61bdeca2003-01-28 23:23:36 +0000143 p) pretty_prt=" -p ";;
iyermanoj6714bb12003-01-28 20:08:44 +0000144
iyermanoj1e77a292003-01-30 06:29:46 +0000145 q) quiet_mode=" -q ";;
146
iyermanoj1e45bef2003-01-26 20:38:45 +0000147 r) LTPROOT=$OPTARG;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000148
iyermanoj1e45bef2003-01-26 20:38:45 +0000149 t) # In case you want to specify the time
150 # to run from the command line
151 # (2m = two minutes, 2h = two hours, etc)
152 duration="-t $OPTARG" ;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000153
iyermanoj1e45bef2003-01-26 20:38:45 +0000154 x) # number of ltp's to run
robbiewf1aad312003-05-29 21:10:22 +0000155 echo "WARNING: The use of -x can cause unpredictable failures, as a"
156 echo " result of concurrently running multiple tests designed"
157 echo " to be ran exclusively."
158 echo ""
robbiewcb089682003-06-02 20:02:06 +0000159 echo "Pausing for 10 seconds..."
160 sleep 10
robbiew0eabbe92003-03-27 17:23:23 +0000161 instances="-x $OPTARG -O ${TMP}";;
iyermanoj0ceb9482002-12-15 22:49:34 +0000162
iyermanoj1e45bef2003-01-26 20:38:45 +0000163 \?) usage;;
164 esac
plarsd05638c2002-09-09 18:30:48 +0000165done
166
iyermanoj99d55702003-01-29 22:36:21 +0000167if [ $run_netest -eq 1 ]
168then
robbiewc9a1b7f2003-05-22 21:04:19 +0000169 if [ -z $RHOST ] || [ -z $PASSWD ]
iyermanoj99d55702003-01-29 22:36:21 +0000170 then
robbiew6e597942003-04-23 19:31:08 +0000171 if [ -z $RHOST ]
172 then
173 echo " "
174 echo "Please enter RHOST = 'name of the remote host machine'"
175 echo -n "-> "
176 read RHOST
177 fi
178 if [ -z $PASSWD ]
179 then
180 echo " "
181 echo "Please enter PASSWD = 'root passwd of the remote host machine'"
182 echo -n "-> "
183 read PASSWD
184 fi
iyermanoj99d55702003-01-29 22:36:21 +0000185 fi
robbiew6e597942003-04-23 19:31:08 +0000186 export $RHOST
187 export $PASSWD
iyermanoj99d55702003-01-29 22:36:21 +0000188fi
189
alaffin802d3e32000-08-23 20:04:23 +0000190
iyermanoj1e45bef2003-01-26 20:38:45 +0000191# If user does not provide a command file select a default set of testcases
192# to execute.
193if [ -z $cmdfile ]
194then
robbiew270ef592003-02-05 22:06:00 +0000195 cat ${LTPROOT}/runtest/syscalls ${LTPROOT}/runtest/fs ${LTPROOT}/runtest/fsx ${LTPROOT}/runtest/dio ${LTPROOT}/runtest/mm ${LTPROOT}/runtest/ipc ${LTPROOT}/runtest/sched ${LTPROOT}/runtest/math ${LTPROOT}/runtest/pty > ${TMP}/alltests
iyermanoj1e45bef2003-01-26 20:38:45 +0000196else
197 cat $cmdfile > ${TMP}/alltests
198fi
alaffin879684a2000-09-20 18:41:17 +0000199
iyermanoj99d55702003-01-29 22:36:21 +0000200if [ $run_netest -eq 1 ]
201then
202 cat ${LTPROOT}/runtest/tcp_cmds >> ${TMP}/alltests
203 cat ${LTPROOT}/runtest/multicast >> ${TMP}/alltests
204 cat ${LTPROOT}/runtest/rpc >> ${TMP}/alltests
205 cat ${LTPROOT}/runtest/nfs >> ${TMP}/alltests
206fi
207
nstraz731655a2002-06-21 20:01:59 +0000208# The fsx-linux tests use the SCRATCHDEV environment variable as a location
209# that can be reformatted and run on. Set SCRATCHDEV if you want to run
210# these tests. As a safeguard, this is disabled.
211unset SCRATCHDEV
212if [ -n "$SCRATCHDEV" ]; then
213 cat ${LTPROOT}/runtest/fsx >> ${TMP}/alltests
214fi
robbiew9612ae02001-12-19 17:39:55 +0000215
robbiew06e3bdf2003-04-08 15:23:33 +0000216# check for required users and groups
217${LTPROOT}/IDcheck.sh
218
plarsd05638c2002-09-09 18:30:48 +0000219# display versions of installed software
robbiew03cbf732001-10-12 21:06:50 +0000220${LTPROOT}/ver_linux
221
robbiewd98e8362003-04-15 14:19:00 +0000222${LTPROOT}/pan/pan $quiet_mode -e -S $instances $duration -a $$ -n $$ $pretty_prt -f ${TMP}/alltests $logfile $outputfile
robbiew37de39b2003-01-28 14:31:13 +0000223
plarsd05638c2002-09-09 18:30:48 +0000224if [ $? -eq 0 ]; then
alaffin879684a2000-09-20 18:41:17 +0000225 echo pan reported PASS
alaffin802d3e32000-08-23 20:04:23 +0000226else
alaffin879684a2000-09-20 18:41:17 +0000227 echo pan reported FAIL
alaffin802d3e32000-08-23 20:04:23 +0000228fi
alaffinad4c5fa2000-08-23 21:09:27 +0000229
robbiew270ef592003-02-05 22:06:00 +0000230if [ $GenLoad -eq 1 ]
231then
232 killall -9 genload
233fi
robbiew797ab8c2003-02-04 21:04:14 +0000234
robbiew23796112003-02-05 16:28:37 +0000235if [ $NetPipe -eq 1 ]
236then
237 killall -9 NPtcp
238fi
239
iyermanoja3973952003-01-29 01:54:40 +0000240if [ $alt_dir -eq 1 ]
241then
iyermanoj99d55702003-01-29 22:36:21 +0000242 echo " "
iyermanoja3973952003-01-29 01:54:40 +0000243 echo "###############################################################"
iyermanoj99d55702003-01-29 22:36:21 +0000244 echo " "
iyermanoj41bd0792003-03-27 09:12:52 +0000245 echo " Done executing testcases."
iyermanoja3973952003-01-29 01:54:40 +0000246 echo " result log is in the $LTPROOT/results directory"
iyermanoj99d55702003-01-29 22:36:21 +0000247 echo " "
iyermanoja3973952003-01-29 01:54:40 +0000248 echo "###############################################################"
iyermanoj99d55702003-01-29 22:36:21 +0000249 echo " "
iyermanoja3973952003-01-29 01:54:40 +0000250fi
iyermanojaacf03b2003-01-31 02:00:58 +0000251rm -rf ${TMP}