blob: 1d26267442d0025891bf04a91c35a03c6142c9fc [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#
martinjnfef097c2002-07-10 14:08:24 +000034
alaffin802d3e32000-08-23 20:04:23 +000035cd `dirname $0`
plarsefd320c2001-09-05 20:45:14 +000036export LTPROOT=${PWD}
plarsd05638c2002-09-09 18:30:48 +000037export TMPBASE="/tmp"
robbiew70513f02003-02-05 16:39:26 +000038export TMP="${TMPBASE}/runalltests-$$"
39export PATH="${PATH}:${LTPROOT}/testcases/bin"
iyermanoj1e45bef2003-01-26 20:38:45 +000040cmdfile=""
iyermanoj6714bb12003-01-28 20:08:44 +000041pretty_prt=" "
iyermanoja3973952003-01-29 01:54:40 +000042alt_dir=0
iyermanoj99d55702003-01-29 22:36:21 +000043run_netest=0
iyermanoj1e77a292003-01-30 06:29:46 +000044quiet_mode=" "
robbiewb3db6202003-02-05 20:39:39 +000045NetPipe=0
robbiew270ef592003-02-05 22:06:00 +000046GenLoad=0
alaffin802d3e32000-08-23 20:04:23 +000047
plarsd05638c2002-09-09 18:30:48 +000048usage()
49{
50 cat <<-END >&2
robbiew797ab8c2003-02-04 21:04:14 +000051 usage: ./${0##*/} -c [-d tmpdir] [-f cmdfile ] [-i # (in Mb)] [ -l logfile ]
robbiew23796112003-02-05 16:28:37 +000052 [ -m # (in Mb)] -N -n -q [ -r ltproot ] [ -t duration ] [ -x instances ]
iyermanoj0ceb9482002-12-15 22:49:34 +000053
robbiew797ab8c2003-02-04 21:04:14 +000054 -c Run LTP under additional background CPU load.
iyermanoj0ceb9482002-12-15 22:49:34 +000055 -d tmpdir Directory where temporary files will be created.
iyermanoj1e45bef2003-01-26 20:38:45 +000056 -f cmdfile Execute user defined list of testcases.
iyermanoj99d55702003-01-29 22:36:21 +000057 -h Help. Prints all available options.
robbiew797ab8c2003-02-04 21:04:14 +000058 -i # (in Mb) Run LTP with a _minimum_ IO load of # megabytes in background.
iyermanoj0ceb9482002-12-15 22:49:34 +000059 -l logfile Log results of test in a logfile.
robbiew797ab8c2003-02-04 21:04:14 +000060 -m # (in Mb) Run LTP with a _minimum_ memory load of # megabytes in background.
robbiew23796112003-02-05 16:28:37 +000061 -N Run all the networking tests.
iyermanoj99d55702003-01-29 22:36:21 +000062 (export RHOST = remote hostname)
63 (export PASSWD = passwd of remote host)
robbiew23796112003-02-05 16:28:37 +000064 -n Run LTP with network traffic in background.
iyermanoj6714bb12003-01-28 20:08:44 +000065 -p Human readable format logfiles.
iyermanoj1e77a292003-01-30 06:29:46 +000066 -q Print less verbose output to screen.
iyermanoj0ceb9482002-12-15 22:49:34 +000067 -r ltproot Fully qualified path where testsuite is installed.
robbiew458cc812003-03-25 17:00:24 +000068 -t duration Execute the testsuite for given duration. Examples:
69 -t 60s = 60 seconds
70 -t 45m = 45 minutes
71 -t 24h = 24 hours
72 -t 2d = 2 days
73
iyermanoja34eb072002-12-15 21:29:15 +000074 -x instances Run multiple instances of this testsuite.
plarsd05638c2002-09-09 18:30:48 +000075
robbiew797ab8c2003-02-04 21:04:14 +000076 example: ./${0##*/} -i 1024 -m 128 -p -q -l /tmp/resultlog.$$ -d ${PWD}
plarsd05638c2002-09-09 18:30:48 +000077 END
78exit
79}
80
robbiewda7deef2003-02-05 19:08:37 +000081mkdir -p ${TMP}
82
robbiew70513f02003-02-05 16:39:26 +000083cd ${TMP}
84if [ $? -ne 0 ]; then
85 echo "could not cd ${TMP} ... exiting"
86 exit
87fi
iyermanoj0ceb9482002-12-15 22:49:34 +000088
robbiew23796112003-02-05 16:28:37 +000089while getopts cd:f:hi:l:m:Nnpqr:t:x arg
iyermanoj0ceb9482002-12-15 22:49:34 +000090do case $arg in
robbiew270ef592003-02-05 22:06:00 +000091 c)
92 $LTPROOT/testcases/bin/genload --cpu 1 2>&1 1>/dev/null &
93 GenLoad=1 ;;
iyermanoj1e45bef2003-01-26 20:38:45 +000094
95 d) # append $$ to TMP, as it is recursively
96 # removed at end of script.
97 TMPBASE=$OPTARG;;
98 f) # Execute user defined set of testcases.
99 cmdfile=$OPTARG;;
iyermanoj99d55702003-01-29 22:36:21 +0000100
robbiew23796112003-02-05 16:28:37 +0000101 h) usage;;
iyermanoj1e45bef2003-01-26 20:38:45 +0000102
103 i)
robbiewb3db6202003-02-05 20:39:39 +0000104 bytesize=$(($OPTARG * 1024 * 1024))
robbiew797ab8c2003-02-04 21:04:14 +0000105 $LTPROOT/testcases/bin/genload --io 1 2>&1 1>/dev/null &
106 $LTPROOT/testcases/bin/genload --hdd 0 --hdd-bytes $bytesize \
robbiew270ef592003-02-05 22:06:00 +0000107 2>&1 1>/dev/null &
108 GenLoad=1 ;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000109
plars61bdeca2003-01-28 23:23:36 +0000110 l)
iyermanoja3973952003-01-29 01:54:40 +0000111 if [ ${OPTARG:0:1} != "/" ]
112 then
iyermanoj99d55702003-01-29 22:36:21 +0000113 if [ -d $LTPROOT/results ]
114 then
115 logfile="-l $LTPROOT/results/$OPTARG"
116 else
117 mkdir -p $LTPROOT/results
iyermanojeb6e8822003-02-04 23:32:18 +0000118 if [ $? -ne 0 ]
iyermanoj99d55702003-01-29 22:36:21 +0000119 then
120 echo "ERROR: failed to create $LTPROOT/results"
121 exit 1
122 fi
123 logfile="-l $LTPROOT/results/$OPTARG"
124 fi
iyermanoja3973952003-01-29 01:54:40 +0000125 alt_dir=1
126 else
127 logfile="-l $OPTARG"
128 fi ;;
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
plars61bdeca2003-01-28 23:23:36 +0000141 p) pretty_prt=" -p ";;
iyermanoj6714bb12003-01-28 20:08:44 +0000142
iyermanoj1e77a292003-01-30 06:29:46 +0000143 q) quiet_mode=" -q ";;
144
iyermanoj1e45bef2003-01-26 20:38:45 +0000145 r) LTPROOT=$OPTARG;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000146
iyermanoj1e45bef2003-01-26 20:38:45 +0000147 t) # In case you want to specify the time
148 # to run from the command line
149 # (2m = two minutes, 2h = two hours, etc)
150 duration="-t $OPTARG" ;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000151
iyermanoj1e45bef2003-01-26 20:38:45 +0000152 x) # number of ltp's to run
153 instances="-x $OPTARG";;
iyermanoj0ceb9482002-12-15 22:49:34 +0000154
iyermanoj1e45bef2003-01-26 20:38:45 +0000155 \?) usage;;
156 esac
plarsd05638c2002-09-09 18:30:48 +0000157done
158
iyermanoj99d55702003-01-29 22:36:21 +0000159if [ $run_netest -eq 1 ]
160then
161 if [[ -z $RHOST || -z $PASSWD ]]
162 then
163 echo " "
164 echo " "
165 echo "ERROR: Initializing networking tests."
166 echo "INFO: Please export RHOST = 'name of the remote host machine'"
167 echo "INFO: Please export PASSWD = 'passwd of the remote host machine'"
168 echo "INFO: before running the networking tests."
169 echo " "
170 echo " "
171 echo " "
172 usage
173 fi
174fi
175
plarsd05638c2002-09-09 18:30:48 +0000176if [ -n "$instances" ]; then
177 instances="$instances -O ${TMP}"
178fi
179
alaffin802d3e32000-08-23 20:04:23 +0000180
iyermanoj1e45bef2003-01-26 20:38:45 +0000181# If user does not provide a command file select a default set of testcases
182# to execute.
183if [ -z $cmdfile ]
184then
robbiew270ef592003-02-05 22:06:00 +0000185 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 +0000186else
187 cat $cmdfile > ${TMP}/alltests
188fi
alaffin879684a2000-09-20 18:41:17 +0000189
iyermanoj99d55702003-01-29 22:36:21 +0000190if [ $run_netest -eq 1 ]
191then
192 cat ${LTPROOT}/runtest/tcp_cmds >> ${TMP}/alltests
193 cat ${LTPROOT}/runtest/multicast >> ${TMP}/alltests
194 cat ${LTPROOT}/runtest/rpc >> ${TMP}/alltests
195 cat ${LTPROOT}/runtest/nfs >> ${TMP}/alltests
196fi
197
nstraz731655a2002-06-21 20:01:59 +0000198# The fsx-linux tests use the SCRATCHDEV environment variable as a location
199# that can be reformatted and run on. Set SCRATCHDEV if you want to run
200# these tests. As a safeguard, this is disabled.
201unset SCRATCHDEV
202if [ -n "$SCRATCHDEV" ]; then
203 cat ${LTPROOT}/runtest/fsx >> ${TMP}/alltests
204fi
robbiew9612ae02001-12-19 17:39:55 +0000205
plarsd05638c2002-09-09 18:30:48 +0000206# display versions of installed software
robbiew03cbf732001-10-12 21:06:50 +0000207${LTPROOT}/ver_linux
208
iyermanoj1e77a292003-01-30 06:29:46 +0000209${LTPROOT}/pan/pan $quiet_mode -e -S $instances $duration -a $$ -n $$ $pretty_prt -f ${TMP}/alltests $logfile
robbiew37de39b2003-01-28 14:31:13 +0000210
plarsd05638c2002-09-09 18:30:48 +0000211if [ $? -eq 0 ]; then
alaffin879684a2000-09-20 18:41:17 +0000212 echo pan reported PASS
alaffin802d3e32000-08-23 20:04:23 +0000213else
alaffin879684a2000-09-20 18:41:17 +0000214 echo pan reported FAIL
alaffin802d3e32000-08-23 20:04:23 +0000215fi
alaffinad4c5fa2000-08-23 21:09:27 +0000216
robbiew270ef592003-02-05 22:06:00 +0000217if [ $GenLoad -eq 1 ]
218then
219 killall -9 genload
220fi
robbiew797ab8c2003-02-04 21:04:14 +0000221
robbiew23796112003-02-05 16:28:37 +0000222if [ $NetPipe -eq 1 ]
223then
224 killall -9 NPtcp
225fi
226
iyermanoja3973952003-01-29 01:54:40 +0000227if [ $alt_dir -eq 1 ]
228then
iyermanoj99d55702003-01-29 22:36:21 +0000229 echo " "
iyermanoja3973952003-01-29 01:54:40 +0000230 echo "###############################################################"
iyermanoj99d55702003-01-29 22:36:21 +0000231 echo " "
iyermanoja3973952003-01-29 01:54:40 +0000232 echo " result log is in the $LTPROOT/results directory"
iyermanoj99d55702003-01-29 22:36:21 +0000233 echo " "
iyermanoja3973952003-01-29 01:54:40 +0000234 echo "###############################################################"
iyermanoj99d55702003-01-29 22:36:21 +0000235 echo " "
iyermanoja3973952003-01-29 01:54:40 +0000236fi
iyermanojaacf03b2003-01-31 02:00:58 +0000237rm -rf ${TMP}