blob: 0d340ce632a5501c8895430e1ac0755c4d27f973 [file] [log] [blame]
alaffin802d3e32000-08-23 20:04:23 +00001#!/bin/sh
plars61bdeca2003-01-28 23:23:36 +00002set +x
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#
martinjnfef097c2002-07-10 14:08:24 +000030
alaffin802d3e32000-08-23 20:04:23 +000031cd `dirname $0`
plarsefd320c2001-09-05 20:45:14 +000032export LTPROOT=${PWD}
plarsd05638c2002-09-09 18:30:48 +000033export TMPBASE="/tmp"
iyermanoj1e45bef2003-01-26 20:38:45 +000034cmdfile=""
iyermanoj6714bb12003-01-28 20:08:44 +000035pretty_prt=" "
iyermanoja3973952003-01-29 01:54:40 +000036alt_dir=0
iyermanoj99d55702003-01-29 22:36:21 +000037run_netest=0
iyermanoj1e77a292003-01-30 06:29:46 +000038quiet_mode=" "
alaffin802d3e32000-08-23 20:04:23 +000039
plarsd05638c2002-09-09 18:30:48 +000040usage()
41{
42 cat <<-END >&2
robbiew797ab8c2003-02-04 21:04:14 +000043 usage: ./${0##*/} -c [-d tmpdir] [-f cmdfile ] [-i # (in Mb)] [ -l logfile ]
44 [ -m # (in Mb)] -n -q [ -r ltproot ] [ -t duration ] [ -x instances ]
iyermanoj0ceb9482002-12-15 22:49:34 +000045
robbiew797ab8c2003-02-04 21:04:14 +000046 -c Run LTP under additional background CPU load.
iyermanoj0ceb9482002-12-15 22:49:34 +000047 -d tmpdir Directory where temporary files will be created.
iyermanoj1e45bef2003-01-26 20:38:45 +000048 -f cmdfile Execute user defined list of testcases.
iyermanoj99d55702003-01-29 22:36:21 +000049 -h Help. Prints all available options.
robbiew797ab8c2003-02-04 21:04:14 +000050 -i # (in Mb) Run LTP with a _minimum_ IO load of # megabytes in background.
iyermanoj0ceb9482002-12-15 22:49:34 +000051 -l logfile Log results of test in a logfile.
robbiew797ab8c2003-02-04 21:04:14 +000052 -m # (in Mb) Run LTP with a _minimum_ memory load of # megabytes in background.
iyermanoj99d55702003-01-29 22:36:21 +000053 -n Run all the networking tests.
54 (export RHOST = remote hostname)
55 (export PASSWD = passwd of remote host)
iyermanoj6714bb12003-01-28 20:08:44 +000056 -p Human readable format logfiles.
iyermanoj1e77a292003-01-30 06:29:46 +000057 -q Print less verbose output to screen.
iyermanoj0ceb9482002-12-15 22:49:34 +000058 -r ltproot Fully qualified path where testsuite is installed.
iyermanoja34eb072002-12-15 21:29:15 +000059 -t duration Execute the testsuite for given duration in hours.
60 -x instances Run multiple instances of this testsuite.
plarsd05638c2002-09-09 18:30:48 +000061
robbiew797ab8c2003-02-04 21:04:14 +000062 example: ./${0##*/} -i 1024 -m 128 -p -q -l /tmp/resultlog.$$ -d ${PWD}
plarsd05638c2002-09-09 18:30:48 +000063 END
64exit
65}
66
iyermanoj0ceb9482002-12-15 22:49:34 +000067
iyermanoj1e77a292003-01-30 06:29:46 +000068while getopts cd:f:hil:mnpqr:t:x arg
iyermanoj0ceb9482002-12-15 22:49:34 +000069do case $arg in
iyermanoj1e45bef2003-01-26 20:38:45 +000070 c)
robbiew797ab8c2003-02-04 21:04:14 +000071 $LTPROOT/testcases/bin/genload --cpu 1 2>&1 1>/dev/null & ;;
iyermanoj1e45bef2003-01-26 20:38:45 +000072
73 d) # append $$ to TMP, as it is recursively
74 # removed at end of script.
75 TMPBASE=$OPTARG;;
76 f) # Execute user defined set of testcases.
77 cmdfile=$OPTARG;;
iyermanoj99d55702003-01-29 22:36:21 +000078
robbiew797ab8c2003-02-04 21:04:14 +000079 h) usage;;
iyermanoj1e45bef2003-01-26 20:38:45 +000080
81 i)
robbiew797ab8c2003-02-04 21:04:14 +000082 bytesize = $OPTARG * 1024 * 1024
83 $LTPROOT/testcases/bin/genload --io 1 2>&1 1>/dev/null &
84 $LTPROOT/testcases/bin/genload --hdd 0 --hdd-bytes $bytesize \
iyermanoj1e45bef2003-01-26 20:38:45 +000085 2>&1 1>/dev/null & ;;
iyermanoj0ceb9482002-12-15 22:49:34 +000086
plars61bdeca2003-01-28 23:23:36 +000087 l)
iyermanoja3973952003-01-29 01:54:40 +000088 if [ ${OPTARG:0:1} != "/" ]
89 then
iyermanoj99d55702003-01-29 22:36:21 +000090 if [ -d $LTPROOT/results ]
91 then
92 logfile="-l $LTPROOT/results/$OPTARG"
93 else
94 mkdir -p $LTPROOT/results
iyermanojeb6e8822003-02-04 23:32:18 +000095 if [ $? -ne 0 ]
iyermanoj99d55702003-01-29 22:36:21 +000096 then
97 echo "ERROR: failed to create $LTPROOT/results"
98 exit 1
99 fi
100 logfile="-l $LTPROOT/results/$OPTARG"
101 fi
iyermanoja3973952003-01-29 01:54:40 +0000102 alt_dir=1
103 else
104 logfile="-l $OPTARG"
105 fi ;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000106
robbiew797ab8c2003-02-04 21:04:14 +0000107 m)
108 memsize = $OPTARG * 1024 * 1024
109 $LTPROOT/testcases/bin/genload --vm 0 --vm-bytes $memsize\
iyermanoj1e45bef2003-01-26 20:38:45 +0000110 2>&1 1>/dev/null & ;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000111
iyermanoj99d55702003-01-29 22:36:21 +0000112 n) run_netest=1;;
113
plars61bdeca2003-01-28 23:23:36 +0000114 p) pretty_prt=" -p ";;
iyermanoj6714bb12003-01-28 20:08:44 +0000115
iyermanoj1e77a292003-01-30 06:29:46 +0000116 q) quiet_mode=" -q ";;
117
iyermanoj1e45bef2003-01-26 20:38:45 +0000118 r) LTPROOT=$OPTARG;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000119
iyermanoj1e45bef2003-01-26 20:38:45 +0000120 t) # In case you want to specify the time
121 # to run from the command line
122 # (2m = two minutes, 2h = two hours, etc)
123 duration="-t $OPTARG" ;;
iyermanoj0ceb9482002-12-15 22:49:34 +0000124
iyermanoj1e45bef2003-01-26 20:38:45 +0000125 x) # number of ltp's to run
126 instances="-x $OPTARG";;
iyermanoj0ceb9482002-12-15 22:49:34 +0000127
iyermanoj1e45bef2003-01-26 20:38:45 +0000128 \?) usage;;
129 esac
plarsd05638c2002-09-09 18:30:48 +0000130done
131
iyermanoj99d55702003-01-29 22:36:21 +0000132if [ $run_netest -eq 1 ]
133then
134 if [[ -z $RHOST || -z $PASSWD ]]
135 then
136 echo " "
137 echo " "
138 echo "ERROR: Initializing networking tests."
139 echo "INFO: Please export RHOST = 'name of the remote host machine'"
140 echo "INFO: Please export PASSWD = 'passwd of the remote host machine'"
141 echo "INFO: before running the networking tests."
142 echo " "
143 echo " "
144 echo " "
145 usage
146 fi
147fi
148
plarsd05638c2002-09-09 18:30:48 +0000149export TMP="${TMPBASE}/runalltests-$$"
150mkdir -p ${TMP}
151
152if [ -n "$instances" ]; then
153 instances="$instances -O ${TMP}"
154fi
155
alaffin879684a2000-09-20 18:41:17 +0000156cd ${TMP}
plarsd05638c2002-09-09 18:30:48 +0000157if [ $? -ne 0 ]; then
158 echo "could not cd ${TMP} ... exiting"
159 exit
160fi
alaffin802d3e32000-08-23 20:04:23 +0000161
plars1a4c2022001-09-06 15:04:36 +0000162export PATH="${PATH}:${LTPROOT}/testcases/bin"
alaffin802d3e32000-08-23 20:04:23 +0000163
iyermanoj1e45bef2003-01-26 20:38:45 +0000164# If user does not provide a command file select a default set of testcases
165# to execute.
166if [ -z $cmdfile ]
167then
168 cat ${LTPROOT}/runtest/syscalls ${LTPROOT}/runtest/fs ${LTPROOT}/runtest/fsx ${LTPROOT}/runtest/dio ${LTPROOT}/runtest/mm ${LTPROOT}/runtest/commands ${LTPROOT}/runtest/ipc ${LTPROOT}/runtest/sched ${LTPROOT}/runtest/math ${LTPROOT}/runtest/pty > ${TMP}/alltests
169else
170 cat $cmdfile > ${TMP}/alltests
171fi
alaffin879684a2000-09-20 18:41:17 +0000172
iyermanoj99d55702003-01-29 22:36:21 +0000173if [ $run_netest -eq 1 ]
174then
175 cat ${LTPROOT}/runtest/tcp_cmds >> ${TMP}/alltests
176 cat ${LTPROOT}/runtest/multicast >> ${TMP}/alltests
177 cat ${LTPROOT}/runtest/rpc >> ${TMP}/alltests
178 cat ${LTPROOT}/runtest/nfs >> ${TMP}/alltests
179fi
180
nstraz731655a2002-06-21 20:01:59 +0000181# The fsx-linux tests use the SCRATCHDEV environment variable as a location
182# that can be reformatted and run on. Set SCRATCHDEV if you want to run
183# these tests. As a safeguard, this is disabled.
184unset SCRATCHDEV
185if [ -n "$SCRATCHDEV" ]; then
186 cat ${LTPROOT}/runtest/fsx >> ${TMP}/alltests
187fi
robbiew9612ae02001-12-19 17:39:55 +0000188
plarsd05638c2002-09-09 18:30:48 +0000189# display versions of installed software
robbiew03cbf732001-10-12 21:06:50 +0000190${LTPROOT}/ver_linux
191
iyermanoj1e77a292003-01-30 06:29:46 +0000192${LTPROOT}/pan/pan $quiet_mode -e -S $instances $duration -a $$ -n $$ $pretty_prt -f ${TMP}/alltests $logfile
robbiew37de39b2003-01-28 14:31:13 +0000193
plarsd05638c2002-09-09 18:30:48 +0000194if [ $? -eq 0 ]; then
alaffin879684a2000-09-20 18:41:17 +0000195 echo pan reported PASS
alaffin802d3e32000-08-23 20:04:23 +0000196else
alaffin879684a2000-09-20 18:41:17 +0000197 echo pan reported FAIL
alaffin802d3e32000-08-23 20:04:23 +0000198fi
alaffinad4c5fa2000-08-23 21:09:27 +0000199
robbiew797ab8c2003-02-04 21:04:14 +0000200killall -9 genload
201
iyermanoja3973952003-01-29 01:54:40 +0000202if [ $alt_dir -eq 1 ]
203then
iyermanoj99d55702003-01-29 22:36:21 +0000204 echo " "
iyermanoja3973952003-01-29 01:54:40 +0000205 echo "###############################################################"
iyermanoj99d55702003-01-29 22:36:21 +0000206 echo " "
iyermanoja3973952003-01-29 01:54:40 +0000207 echo " result log is in the $LTPROOT/results directory"
iyermanoj99d55702003-01-29 22:36:21 +0000208 echo " "
iyermanoja3973952003-01-29 01:54:40 +0000209 echo "###############################################################"
iyermanoj99d55702003-01-29 22:36:21 +0000210 echo " "
iyermanoja3973952003-01-29 01:54:40 +0000211fi
iyermanojaacf03b2003-01-31 02:00:58 +0000212rm -rf ${TMP}