alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 1 | #!/bin/sh |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 2 | |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 3 | |
martinjn | fef097c | 2002-07-10 14:08:24 +0000 | [diff] [blame] | 4 | # |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 5 | # 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. |
martinjn | fef097c | 2002-07-10 14:08:24 +0000 | [diff] [blame] | 10 | # |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 11 | # 01/26/03 - Manoj Iyer - manjo@mail.utexas.edu: Added -f option; Execute |
| 12 | # user defined set of testcases. |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 13 | # |
iyermanoj | fb7b58f | 2003-01-27 23:01:48 +0000 | [diff] [blame] | 14 | # 01/27/03 - Manoj Iyer - manjo@mail.utexas.edu: Enabled formatted printing |
| 15 | # of logfiles. |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 16 | # |
iyermanoj | 6714bb1 | 2003-01-28 20:08:44 +0000 | [diff] [blame] | 17 | # 01/28/03 - Manoj Iyer - manjo@mail.utexas.edu: added option to enable |
| 18 | # formatted printing of logfiles. |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 19 | # |
| 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 | # |
iyermanoj | 3b59c69 | 2003-02-01 18:15:27 +0000 | [diff] [blame] | 24 | # 01/29/03 - Manoj Iyer - manjo@mail.utexas.edu: |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 25 | # added code to cause pan to print less verbose |
| 26 | # output. |
iyermanoj | 3b59c69 | 2003-02-01 18:15:27 +0000 | [diff] [blame] | 27 | # 02/01/03 - Manoj Iyer - manjo@mail.utexas.edu: Removed variables |
| 28 | # initialization of RHOST and PASSWD. |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 29 | # |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 30 | # 02/05/03 - Robbie Williamson - Added configurability to the optional load |
| 31 | # generator sections. Also added network traffic |
| 32 | # option. |
| 33 | # |
robbiew | 6e59794 | 2003-04-23 19:31:08 +0000 | [diff] [blame] | 34 | # 04/23/03 - Robbie Williamson - Added "-o" option and ability to set network |
| 35 | # testing variables RHOST and PASSWD. |
| 36 | # |
martinjn | fef097c | 2002-07-10 14:08:24 +0000 | [diff] [blame] | 37 | |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 38 | cd `dirname $0` |
plars | efd320c | 2001-09-05 20:45:14 +0000 | [diff] [blame] | 39 | export LTPROOT=${PWD} |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 40 | export TMPBASE="/tmp" |
robbiew | 70513f0 | 2003-02-05 16:39:26 +0000 | [diff] [blame] | 41 | export TMP="${TMPBASE}/runalltests-$$" |
| 42 | export PATH="${PATH}:${LTPROOT}/testcases/bin" |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 43 | cmdfile="" |
iyermanoj | 6714bb1 | 2003-01-28 20:08:44 +0000 | [diff] [blame] | 44 | pretty_prt=" " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 45 | alt_dir=0 |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 46 | run_netest=0 |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 47 | quiet_mode=" " |
robbiew | b3db620 | 2003-02-05 20:39:39 +0000 | [diff] [blame] | 48 | NetPipe=0 |
robbiew | 270ef59 | 2003-02-05 22:06:00 +0000 | [diff] [blame] | 49 | GenLoad=0 |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 50 | |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 51 | usage() |
| 52 | { |
| 53 | cat <<-END >&2 |
robbiew | d98e836 | 2003-04-15 14:19:00 +0000 | [diff] [blame] | 54 | usage: ./${0##*/} -c [-d tmpdir] [-f cmdfile ] [-i # (in Mb)] [ -l logfile ] [ -o outputfile ] |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 55 | [ -m # (in Mb)] -N -n -q [ -r ltproot ] [ -t duration ] [ -x instances ] |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 56 | |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 57 | -c Run LTP under additional background CPU load. |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 58 | -d tmpdir Directory where temporary files will be created. |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 59 | -f cmdfile Execute user defined list of testcases. |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 60 | -h Help. Prints all available options. |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 61 | -i # (in Mb) Run LTP with a _minimum_ IO load of # megabytes in background. |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 62 | -l logfile Log results of test in a logfile. |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 63 | -m # (in Mb) Run LTP with a _minimum_ memory load of # megabytes in background. |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 64 | -N Run all the networking tests. |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 65 | -n Run LTP with network traffic in background. |
robbiew | d98e836 | 2003-04-15 14:19:00 +0000 | [diff] [blame] | 66 | -o outputfile Redirect test output to a file. |
iyermanoj | 6714bb1 | 2003-01-28 20:08:44 +0000 | [diff] [blame] | 67 | -p Human readable format logfiles. |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 68 | -q Print less verbose output to screen. |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 69 | -r ltproot Fully qualified path where testsuite is installed. |
robbiew | 458cc81 | 2003-03-25 17:00:24 +0000 | [diff] [blame] | 70 | -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 | |
iyermanoj | a34eb07 | 2002-12-15 21:29:15 +0000 | [diff] [blame] | 76 | -x instances Run multiple instances of this testsuite. |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 77 | |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 78 | example: ./${0##*/} -i 1024 -m 128 -p -q -l /tmp/resultlog.$$ -d ${PWD} |
iyermanoj | b299a83 | 2003-03-27 09:21:33 +0000 | [diff] [blame] | 79 | |
| 80 | NOTE: If you do not wish to learn these options use the "runltp" program instead. |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 81 | END |
| 82 | exit |
| 83 | } |
| 84 | |
robbiew | da7deef | 2003-02-05 19:08:37 +0000 | [diff] [blame] | 85 | mkdir -p ${TMP} |
| 86 | |
robbiew | 70513f0 | 2003-02-05 16:39:26 +0000 | [diff] [blame] | 87 | cd ${TMP} |
| 88 | if [ $? -ne 0 ]; then |
| 89 | echo "could not cd ${TMP} ... exiting" |
| 90 | exit |
| 91 | fi |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 92 | |
robbiew | d98e836 | 2003-04-15 14:19:00 +0000 | [diff] [blame] | 93 | while getopts cd:f:hi:l:m:Nno:pqr:t:x: arg |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 94 | do case $arg in |
robbiew | 270ef59 | 2003-02-05 22:06:00 +0000 | [diff] [blame] | 95 | c) |
| 96 | $LTPROOT/testcases/bin/genload --cpu 1 2>&1 1>/dev/null & |
| 97 | GenLoad=1 ;; |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 98 | |
| 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;; |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 104 | |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 105 | h) usage;; |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 106 | |
| 107 | i) |
robbiew | b3db620 | 2003-02-05 20:39:39 +0000 | [diff] [blame] | 108 | bytesize=$(($OPTARG * 1024 * 1024)) |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 109 | $LTPROOT/testcases/bin/genload --io 1 2>&1 1>/dev/null & |
| 110 | $LTPROOT/testcases/bin/genload --hdd 0 --hdd-bytes $bytesize \ |
robbiew | 270ef59 | 2003-02-05 22:06:00 +0000 | [diff] [blame] | 111 | 2>&1 1>/dev/null & |
| 112 | GenLoad=1 ;; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 113 | |
plars | 61bdeca | 2003-01-28 23:23:36 +0000 | [diff] [blame] | 114 | l) |
robbiew | 8c819a5 | 2003-04-14 21:00:16 +0000 | [diff] [blame] | 115 | 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 |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 124 | fi |
robbiew | 8c819a5 | 2003-04-14 21:00:16 +0000 | [diff] [blame] | 125 | fi |
| 126 | logfile="-l $LTPROOT/results/$OPTARG" |
| 127 | alt_dir=1 ;; |
| 128 | esac ;; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 129 | |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 130 | m) |
robbiew | b3db620 | 2003-02-05 20:39:39 +0000 | [diff] [blame] | 131 | memsize=$(($OPTARG * 1024 * 1024)) |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 132 | $LTPROOT/testcases/bin/genload --vm 0 --vm-bytes $memsize\ |
robbiew | 270ef59 | 2003-02-05 22:06:00 +0000 | [diff] [blame] | 133 | 2>&1 1>/dev/null & |
| 134 | GenLoad=1;; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 135 | |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 136 | N) run_netest=1;; |
| 137 | |
| 138 | n) $LTPROOT/testcases/bin/netpipe.sh |
robbiew | b3db620 | 2003-02-05 20:39:39 +0000 | [diff] [blame] | 139 | NetPipe=1;; |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 140 | |
robbiew | d98e836 | 2003-04-15 14:19:00 +0000 | [diff] [blame] | 141 | o) outputfile="-o $OPTARG" ;; |
| 142 | |
plars | 61bdeca | 2003-01-28 23:23:36 +0000 | [diff] [blame] | 143 | p) pretty_prt=" -p ";; |
iyermanoj | 6714bb1 | 2003-01-28 20:08:44 +0000 | [diff] [blame] | 144 | |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 145 | q) quiet_mode=" -q ";; |
| 146 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 147 | r) LTPROOT=$OPTARG;; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 148 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 149 | 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" ;; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 153 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 154 | x) # number of ltp's to run |
robbiew | f1aad31 | 2003-05-29 21:10:22 +0000 | [diff] [blame] | 155 | 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 "" |
| 159 | echo "Press [Enter] to continue or [CTRL-C] to abort." |
| 160 | read go |
robbiew | 0eabbe9 | 2003-03-27 17:23:23 +0000 | [diff] [blame] | 161 | instances="-x $OPTARG -O ${TMP}";; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 162 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 163 | \?) usage;; |
| 164 | esac |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 165 | done |
| 166 | |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 167 | if [ $run_netest -eq 1 ] |
| 168 | then |
robbiew | c9a1b7f | 2003-05-22 21:04:19 +0000 | [diff] [blame] | 169 | if [ -z $RHOST ] || [ -z $PASSWD ] |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 170 | then |
robbiew | 6e59794 | 2003-04-23 19:31:08 +0000 | [diff] [blame] | 171 | 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 |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 185 | fi |
robbiew | 6e59794 | 2003-04-23 19:31:08 +0000 | [diff] [blame] | 186 | export $RHOST |
| 187 | export $PASSWD |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 188 | fi |
| 189 | |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 190 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 191 | # If user does not provide a command file select a default set of testcases |
| 192 | # to execute. |
| 193 | if [ -z $cmdfile ] |
| 194 | then |
robbiew | 270ef59 | 2003-02-05 22:06:00 +0000 | [diff] [blame] | 195 | 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 |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 196 | else |
| 197 | cat $cmdfile > ${TMP}/alltests |
| 198 | fi |
alaffin | 879684a | 2000-09-20 18:41:17 +0000 | [diff] [blame] | 199 | |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 200 | if [ $run_netest -eq 1 ] |
| 201 | then |
| 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 |
| 206 | fi |
| 207 | |
nstraz | 731655a | 2002-06-21 20:01:59 +0000 | [diff] [blame] | 208 | # 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. |
| 211 | unset SCRATCHDEV |
| 212 | if [ -n "$SCRATCHDEV" ]; then |
| 213 | cat ${LTPROOT}/runtest/fsx >> ${TMP}/alltests |
| 214 | fi |
robbiew | 9612ae0 | 2001-12-19 17:39:55 +0000 | [diff] [blame] | 215 | |
robbiew | 06e3bdf | 2003-04-08 15:23:33 +0000 | [diff] [blame] | 216 | # check for required users and groups |
| 217 | ${LTPROOT}/IDcheck.sh |
| 218 | |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 219 | # display versions of installed software |
robbiew | 03cbf73 | 2001-10-12 21:06:50 +0000 | [diff] [blame] | 220 | ${LTPROOT}/ver_linux |
| 221 | |
robbiew | d98e836 | 2003-04-15 14:19:00 +0000 | [diff] [blame] | 222 | ${LTPROOT}/pan/pan $quiet_mode -e -S $instances $duration -a $$ -n $$ $pretty_prt -f ${TMP}/alltests $logfile $outputfile |
robbiew | 37de39b | 2003-01-28 14:31:13 +0000 | [diff] [blame] | 223 | |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 224 | if [ $? -eq 0 ]; then |
alaffin | 879684a | 2000-09-20 18:41:17 +0000 | [diff] [blame] | 225 | echo pan reported PASS |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 226 | else |
alaffin | 879684a | 2000-09-20 18:41:17 +0000 | [diff] [blame] | 227 | echo pan reported FAIL |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 228 | fi |
alaffin | ad4c5fa | 2000-08-23 21:09:27 +0000 | [diff] [blame] | 229 | |
robbiew | 270ef59 | 2003-02-05 22:06:00 +0000 | [diff] [blame] | 230 | if [ $GenLoad -eq 1 ] |
| 231 | then |
| 232 | killall -9 genload |
| 233 | fi |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 234 | |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 235 | if [ $NetPipe -eq 1 ] |
| 236 | then |
| 237 | killall -9 NPtcp |
| 238 | fi |
| 239 | |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 240 | if [ $alt_dir -eq 1 ] |
| 241 | then |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 242 | echo " " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 243 | echo "###############################################################" |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 244 | echo " " |
iyermanoj | 41bd079 | 2003-03-27 09:12:52 +0000 | [diff] [blame] | 245 | echo " Done executing testcases." |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 246 | echo " result log is in the $LTPROOT/results directory" |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 247 | echo " " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 248 | echo "###############################################################" |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 249 | echo " " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 250 | fi |
iyermanoj | aacf03b | 2003-01-31 02:00:58 +0000 | [diff] [blame] | 251 | rm -rf ${TMP} |