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 | # | ||||
martinjn | fef097c | 2002-07-10 14:08:24 +0000 | [diff] [blame] | 34 | |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 35 | cd `dirname $0` |
plars | efd320c | 2001-09-05 20:45:14 +0000 | [diff] [blame] | 36 | export LTPROOT=${PWD} |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 37 | export TMPBASE="/tmp" |
robbiew | 70513f0 | 2003-02-05 16:39:26 +0000 | [diff] [blame] | 38 | export TMP="${TMPBASE}/runalltests-$$" |
39 | export PATH="${PATH}:${LTPROOT}/testcases/bin" | ||||
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 40 | cmdfile="" |
iyermanoj | 6714bb1 | 2003-01-28 20:08:44 +0000 | [diff] [blame] | 41 | pretty_prt=" " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 42 | alt_dir=0 |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 43 | run_netest=0 |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 44 | quiet_mode=" " |
robbiew | b3db620 | 2003-02-05 20:39:39 +0000 | [diff] [blame] | 45 | NetPipe=0 |
robbiew | 270ef59 | 2003-02-05 22:06:00 +0000 | [diff] [blame] | 46 | GenLoad=0 |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 47 | |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 48 | usage() |
49 | { | ||||
50 | cat <<-END >&2 | ||||
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 51 | usage: ./${0##*/} -c [-d tmpdir] [-f cmdfile ] [-i # (in Mb)] [ -l logfile ] |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 52 | [ -m # (in Mb)] -N -n -q [ -r ltproot ] [ -t duration ] [ -x instances ] |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 53 | |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 54 | -c Run LTP under additional background CPU load. |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 55 | -d tmpdir Directory where temporary files will be created. |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 56 | -f cmdfile Execute user defined list of testcases. |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 57 | -h Help. Prints all available options. |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 58 | -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] | 59 | -l logfile Log results of test in a logfile. |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 60 | -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] | 61 | -N Run all the networking tests. |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 62 | (export RHOST = remote hostname) |
63 | (export PASSWD = passwd of remote host) | ||||
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 64 | -n Run LTP with network traffic in background. |
iyermanoj | 6714bb1 | 2003-01-28 20:08:44 +0000 | [diff] [blame] | 65 | -p Human readable format logfiles. |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 66 | -q Print less verbose output to screen. |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 67 | -r ltproot Fully qualified path where testsuite is installed. |
robbiew | 458cc81 | 2003-03-25 17:00:24 +0000 | [diff] [blame^] | 68 | -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 | |||||
iyermanoj | a34eb07 | 2002-12-15 21:29:15 +0000 | [diff] [blame] | 74 | -x instances Run multiple instances of this testsuite. |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 75 | |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 76 | example: ./${0##*/} -i 1024 -m 128 -p -q -l /tmp/resultlog.$$ -d ${PWD} |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 77 | END |
78 | exit | ||||
79 | } | ||||
80 | |||||
robbiew | da7deef | 2003-02-05 19:08:37 +0000 | [diff] [blame] | 81 | mkdir -p ${TMP} |
82 | |||||
robbiew | 70513f0 | 2003-02-05 16:39:26 +0000 | [diff] [blame] | 83 | cd ${TMP} |
84 | if [ $? -ne 0 ]; then | ||||
85 | echo "could not cd ${TMP} ... exiting" | ||||
86 | exit | ||||
87 | fi | ||||
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 88 | |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 89 | while getopts cd:f:hi:l:m:Nnpqr:t:x arg |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 90 | do case $arg in |
robbiew | 270ef59 | 2003-02-05 22:06:00 +0000 | [diff] [blame] | 91 | c) |
92 | $LTPROOT/testcases/bin/genload --cpu 1 2>&1 1>/dev/null & | ||||
93 | GenLoad=1 ;; | ||||
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 94 | |
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;; | ||||
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 100 | |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 101 | h) usage;; |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 102 | |
103 | i) | ||||
robbiew | b3db620 | 2003-02-05 20:39:39 +0000 | [diff] [blame] | 104 | bytesize=$(($OPTARG * 1024 * 1024)) |
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 105 | $LTPROOT/testcases/bin/genload --io 1 2>&1 1>/dev/null & |
106 | $LTPROOT/testcases/bin/genload --hdd 0 --hdd-bytes $bytesize \ | ||||
robbiew | 270ef59 | 2003-02-05 22:06:00 +0000 | [diff] [blame] | 107 | 2>&1 1>/dev/null & |
108 | GenLoad=1 ;; | ||||
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 109 | |
plars | 61bdeca | 2003-01-28 23:23:36 +0000 | [diff] [blame] | 110 | l) |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 111 | if [ ${OPTARG:0:1} != "/" ] |
112 | then | ||||
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 113 | if [ -d $LTPROOT/results ] |
114 | then | ||||
115 | logfile="-l $LTPROOT/results/$OPTARG" | ||||
116 | else | ||||
117 | mkdir -p $LTPROOT/results | ||||
iyermanoj | eb6e882 | 2003-02-04 23:32:18 +0000 | [diff] [blame] | 118 | if [ $? -ne 0 ] |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 119 | then |
120 | echo "ERROR: failed to create $LTPROOT/results" | ||||
121 | exit 1 | ||||
122 | fi | ||||
123 | logfile="-l $LTPROOT/results/$OPTARG" | ||||
124 | fi | ||||
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 125 | alt_dir=1 |
126 | else | ||||
127 | logfile="-l $OPTARG" | ||||
128 | fi ;; | ||||
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 | |
plars | 61bdeca | 2003-01-28 23:23:36 +0000 | [diff] [blame] | 141 | p) pretty_prt=" -p ";; |
iyermanoj | 6714bb1 | 2003-01-28 20:08:44 +0000 | [diff] [blame] | 142 | |
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 143 | q) quiet_mode=" -q ";; |
144 | |||||
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 145 | r) LTPROOT=$OPTARG;; |
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 146 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 147 | 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" ;; | ||||
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 151 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 152 | x) # number of ltp's to run |
153 | instances="-x $OPTARG";; | ||||
iyermanoj | 0ceb948 | 2002-12-15 22:49:34 +0000 | [diff] [blame] | 154 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 155 | \?) usage;; |
156 | esac | ||||
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 157 | done |
158 | |||||
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 159 | if [ $run_netest -eq 1 ] |
160 | then | ||||
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 | ||||
174 | fi | ||||
175 | |||||
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 176 | if [ -n "$instances" ]; then |
177 | instances="$instances -O ${TMP}" | ||||
178 | fi | ||||
179 | |||||
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 180 | |
iyermanoj | 1e45bef | 2003-01-26 20:38:45 +0000 | [diff] [blame] | 181 | # If user does not provide a command file select a default set of testcases |
182 | # to execute. | ||||
183 | if [ -z $cmdfile ] | ||||
184 | then | ||||
robbiew | 270ef59 | 2003-02-05 22:06:00 +0000 | [diff] [blame] | 185 | 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] | 186 | else |
187 | cat $cmdfile > ${TMP}/alltests | ||||
188 | fi | ||||
alaffin | 879684a | 2000-09-20 18:41:17 +0000 | [diff] [blame] | 189 | |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 190 | if [ $run_netest -eq 1 ] |
191 | then | ||||
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 | ||||
196 | fi | ||||
197 | |||||
nstraz | 731655a | 2002-06-21 20:01:59 +0000 | [diff] [blame] | 198 | # 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. | ||||
201 | unset SCRATCHDEV | ||||
202 | if [ -n "$SCRATCHDEV" ]; then | ||||
203 | cat ${LTPROOT}/runtest/fsx >> ${TMP}/alltests | ||||
204 | fi | ||||
robbiew | 9612ae0 | 2001-12-19 17:39:55 +0000 | [diff] [blame] | 205 | |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 206 | # display versions of installed software |
robbiew | 03cbf73 | 2001-10-12 21:06:50 +0000 | [diff] [blame] | 207 | ${LTPROOT}/ver_linux |
208 | |||||
iyermanoj | 1e77a29 | 2003-01-30 06:29:46 +0000 | [diff] [blame] | 209 | ${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] | 210 | |
plars | d05638c | 2002-09-09 18:30:48 +0000 | [diff] [blame] | 211 | if [ $? -eq 0 ]; then |
alaffin | 879684a | 2000-09-20 18:41:17 +0000 | [diff] [blame] | 212 | echo pan reported PASS |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 213 | else |
alaffin | 879684a | 2000-09-20 18:41:17 +0000 | [diff] [blame] | 214 | echo pan reported FAIL |
alaffin | 802d3e3 | 2000-08-23 20:04:23 +0000 | [diff] [blame] | 215 | fi |
alaffin | ad4c5fa | 2000-08-23 21:09:27 +0000 | [diff] [blame] | 216 | |
robbiew | 270ef59 | 2003-02-05 22:06:00 +0000 | [diff] [blame] | 217 | if [ $GenLoad -eq 1 ] |
218 | then | ||||
219 | killall -9 genload | ||||
220 | fi | ||||
robbiew | 797ab8c | 2003-02-04 21:04:14 +0000 | [diff] [blame] | 221 | |
robbiew | 2379611 | 2003-02-05 16:28:37 +0000 | [diff] [blame] | 222 | if [ $NetPipe -eq 1 ] |
223 | then | ||||
224 | killall -9 NPtcp | ||||
225 | fi | ||||
226 | |||||
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 227 | if [ $alt_dir -eq 1 ] |
228 | then | ||||
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 229 | echo " " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 230 | echo "###############################################################" |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 231 | echo " " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 232 | echo " result log is in the $LTPROOT/results directory" |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 233 | echo " " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 234 | echo "###############################################################" |
iyermanoj | 99d5570 | 2003-01-29 22:36:21 +0000 | [diff] [blame] | 235 | echo " " |
iyermanoj | a397395 | 2003-01-29 01:54:40 +0000 | [diff] [blame] | 236 | fi |
iyermanoj | aacf03b | 2003-01-31 02:00:58 +0000 | [diff] [blame] | 237 | rm -rf ${TMP} |