alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 1 | #!/bin/sh |
plars | 61bdeca | 2003-01-28 23:23:36 +0000 | [diff] [blame] | 2 | set +x |
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 | # |
martinjn | fef097c | 2002-07-10 14:08:24 +0000 | [diff] [blame] | 30 | |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 31 | cd `dirname $0` |
plars | efd320c | 2001-09-05 20:45:14 +0000 | [diff] [blame] | 32 | export LTPROOT=${PWD} |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 33 | export TMPBASE="/tmp" |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 34 | cmdfile="" |
iyermanoj | 6714bb1 | 2003-01-28 20:08:44 +0000 | [diff] [blame] | 35 | pretty_prt=" " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 36 | alt_dir=0 |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 37 | run_netest=0 |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 38 | quiet_mode=" " |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 39 | |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 40 | usage() |
| 41 | { |
| 42 | cat <<-END >&2 |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 43 | usage: ./${0##*/} -c [-d tmpdir] [-f cmdfile ] [-i # (in Mb)] [ -l logfile ] |
| 44 | [ -m # (in Mb)] -n -q [ -r ltproot ] [ -t duration ] [ -x instances ] |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 45 | |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 46 | -c Run LTP under additional background CPU load. |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 47 | -d tmpdir Directory where temporary files will be created. |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 48 | -f cmdfile Execute user defined list of testcases. |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 49 | -h Help. Prints all available options. |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 50 | -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] | 51 | -l logfile Log results of test in a logfile. |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 52 | -m # (in Mb) Run LTP with a _minimum_ memory load of # megabytes in background. |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 53 | -n Run all the networking tests. |
| 54 | (export RHOST = remote hostname) |
| 55 | (export PASSWD = passwd of remote host) |
iyermanoj | 6714bb1 | 2003-01-28 20:08:44 +0000 | [diff] [blame] | 56 | -p Human readable format logfiles. |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 57 | -q Print less verbose output to screen. |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 58 | -r ltproot Fully qualified path where testsuite is installed. |
iyermanoj | a34eb07 | 2002-12-15 21:29:15 +0000 | [diff] [blame] | 59 | -t duration Execute the testsuite for given duration in hours. |
| 60 | -x instances Run multiple instances of this testsuite. |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 61 | |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 62 | example: ./${0##*/} -i 1024 -m 128 -p -q -l /tmp/resultlog.$$ -d ${PWD} |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 63 | END |
| 64 | exit |
| 65 | } |
| 66 | |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 67 | |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 68 | while getopts cd:f:hil:mnpqr:t:x arg |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 69 | do case $arg in |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 70 | c) |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 71 | $LTPROOT/testcases/bin/genload --cpu 1 2>&1 1>/dev/null & ;; |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 72 | |
| 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;; |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 78 | |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 79 | h) usage;; |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 80 | |
| 81 | i) |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 82 | 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 \ |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 85 | 2>&1 1>/dev/null & ;; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 86 | |
plars | 61bdeca | 2003-01-28 23:23:36 +0000 | [diff] [blame] | 87 | l) |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 88 | if [ ${OPTARG:0:1} != "/" ] |
| 89 | then |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 90 | if [ -d $LTPROOT/results ] |
| 91 | then |
| 92 | logfile="-l $LTPROOT/results/$OPTARG" |
| 93 | else |
| 94 | mkdir -p $LTPROOT/results |
iyermanoj | eb6e882 | 2003-02-04 23:32:18 +0000 | [diff] [blame^] | 95 | if [ $? -ne 0 ] |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 96 | then |
| 97 | echo "ERROR: failed to create $LTPROOT/results" |
| 98 | exit 1 |
| 99 | fi |
| 100 | logfile="-l $LTPROOT/results/$OPTARG" |
| 101 | fi |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 102 | alt_dir=1 |
| 103 | else |
| 104 | logfile="-l $OPTARG" |
| 105 | fi ;; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 106 | |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 107 | m) |
| 108 | memsize = $OPTARG * 1024 * 1024 |
| 109 | $LTPROOT/testcases/bin/genload --vm 0 --vm-bytes $memsize\ |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 110 | 2>&1 1>/dev/null & ;; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 111 | |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 112 | n) run_netest=1;; |
| 113 | |
plars | 61bdeca | 2003-01-28 23:23:36 +0000 | [diff] [blame] | 114 | p) pretty_prt=" -p ";; |
iyermanoj | 6714bb1 | 2003-01-28 20:08:44 +0000 | [diff] [blame] | 115 | |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 116 | q) quiet_mode=" -q ";; |
| 117 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 118 | r) LTPROOT=$OPTARG;; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 119 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 120 | 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" ;; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 124 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 125 | x) # number of ltp's to run |
| 126 | instances="-x $OPTARG";; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 127 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 128 | \?) usage;; |
| 129 | esac |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 130 | done |
| 131 | |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 132 | if [ $run_netest -eq 1 ] |
| 133 | then |
| 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 |
| 147 | fi |
| 148 | |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 149 | export TMP="${TMPBASE}/runalltests-$$" |
| 150 | mkdir -p ${TMP} |
| 151 | |
| 152 | if [ -n "$instances" ]; then |
| 153 | instances="$instances -O ${TMP}" |
| 154 | fi |
| 155 | |
alaffin | 879684a | 2000-09-20 18:41:17 +0000 | [diff] [blame] | 156 | cd ${TMP} |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 157 | if [ $? -ne 0 ]; then |
| 158 | echo "could not cd ${TMP} ... exiting" |
| 159 | exit |
| 160 | fi |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 161 | |
plars | 1a4c202 | 2001-09-06 15:04:36 +0000 | [diff] [blame] | 162 | export PATH="${PATH}:${LTPROOT}/testcases/bin" |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 163 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 164 | # If user does not provide a command file select a default set of testcases |
| 165 | # to execute. |
| 166 | if [ -z $cmdfile ] |
| 167 | then |
| 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 |
| 169 | else |
| 170 | cat $cmdfile > ${TMP}/alltests |
| 171 | fi |
alaffin | 879684a | 2000-09-20 18:41:17 +0000 | [diff] [blame] | 172 | |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 173 | if [ $run_netest -eq 1 ] |
| 174 | then |
| 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 |
| 179 | fi |
| 180 | |
nstraz | 731655a | 2002-06-21 20:01:59 +0000 | [diff] [blame] | 181 | # 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. |
| 184 | unset SCRATCHDEV |
| 185 | if [ -n "$SCRATCHDEV" ]; then |
| 186 | cat ${LTPROOT}/runtest/fsx >> ${TMP}/alltests |
| 187 | fi |
robbiew | 9612ae0 | 2001-12-19 17:39:55 +0000 | [diff] [blame] | 188 | |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 189 | # display versions of installed software |
robbiew | 03cbf73 | 2001-10-12 21:06:50 +0000 | [diff] [blame] | 190 | ${LTPROOT}/ver_linux |
| 191 | |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 192 | ${LTPROOT}/pan/pan $quiet_mode -e -S $instances $duration -a $$ -n $$ $pretty_prt -f ${TMP}/alltests $logfile |
robbiew | 37de39b | 2003-01-28 14:31:13 +0000 | [diff] [blame] | 193 | |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 194 | if [ $? -eq 0 ]; then |
alaffin | 879684a | 2000-09-20 18:41:17 +0000 | [diff] [blame] | 195 | echo pan reported PASS |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 196 | else |
alaffin | 879684a | 2000-09-20 18:41:17 +0000 | [diff] [blame] | 197 | echo pan reported FAIL |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 198 | fi |
alaffin | ad4c5fa | 2000-08-23 21:09:27 +0000 | [diff] [blame] | 199 | |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 200 | killall -9 genload |
| 201 | |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 202 | if [ $alt_dir -eq 1 ] |
| 203 | then |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 204 | echo " " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 205 | echo "###############################################################" |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 206 | echo " " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 207 | echo " result log is in the $LTPROOT/results directory" |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 208 | echo " " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 209 | echo "###############################################################" |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 210 | echo " " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 211 | fi |
iyermanoj | aacf03b | 2003-01-31 02:00:58 +0000 | [diff] [blame] | 212 | rm -rf ${TMP} |