plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | ################################################################################ |
| 3 | ## ## |
| 4 | ## Copyright (c) International Business Machines Corp., 2001 ## |
| 5 | ## ## |
| 6 | ## This program is free software; you can redistribute it and#or modify ## |
| 7 | ## it under the terms of the GNU General Public License as published by ## |
| 8 | ## the Free Software Foundation; either version 2 of the License, or ## |
| 9 | ## (at your option) any later version. ## |
| 10 | ## ## |
| 11 | ## This program is distributed in the hope that it will be useful, but ## |
| 12 | ## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ## |
| 13 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ## |
| 14 | ## for more details. ## |
| 15 | ## ## |
| 16 | ## You should have received a copy of the GNU General Public License ## |
| 17 | ## along with this program; if not, write to the Free Software ## |
| 18 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## |
| 19 | ## ## |
| 20 | ################################################################################ |
| 21 | # File: runltp |
| 22 | # |
| 23 | # Description: This script can be used to the tests in the LTP test suite |
| 24 | # |
| 25 | # Authors: Manoj Iyer - manjo@mail.utexas.edu |
| 26 | # Robbe Williamson - robbiew@us.ibm.com |
| 27 | # |
| 28 | # History: Oct 07 2003 - Modified - Manoj Iyer |
| 29 | # - use functions |
| 30 | # - clean up on script exit |
| 31 | # - error checking etc. |
| 32 | # |
| 33 | # Oct 08 2003 - Modified - Manoj Iyer |
| 34 | # - fixed bug in creating results directory |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 35 | # - all checks should be enlclosed in " " to avoid bash error |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 36 | # - exit with error if pan is not found in pan directory |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 37 | # |
| 38 | # Jul 22 2007 - Modified - Ricardo Salveti de Araujo |
| 39 | # - added support to put more then one file at CMDLINE (-f) |
| 40 | # - added a new option, that the user can pass the address of |
| 41 | # the command file, and it'll use wget to get it (-w) |
| 42 | # - now -s does the grep at the selected command files (default, |
| 43 | # -f or -w) |
| 44 | # |
| 45 | # Jul 23 2007 - Modified - Ricardo Salveti de Araujo |
| 46 | # - added flag to get the command file that has all failed tests |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame^] | 47 | # |
| 48 | # Sep 11 2007 - Modified - Subrata Modak |
| 49 | # - added option to create Failed File if it is not an absolute path |
| 50 | # - added option to create Output File if it is not an absolute path |
| 51 | # - added option to create Failed File compulsory, even if user has not mentioned it |
| 52 | # |
| 53 | ################################################################################# |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 54 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 55 | |
| 56 | |
| 57 | setup() |
| 58 | { |
| 59 | cd `dirname $0` || \ |
| 60 | { |
| 61 | echo "FATAL: unable to change directory to $(dirname $0)" |
| 62 | exit 1 |
| 63 | } |
| 64 | export LTPROOT=${PWD} |
| 65 | export TMPBASE="/tmp" |
| 66 | export TMP="${TMPBASE}/ltp-$$" |
| 67 | export PATH="${PATH}:${LTPROOT}/testcases/bin" |
| 68 | |
| 69 | [ -d $LTPROOT/testcases/bin ] || |
| 70 | { |
| 71 | echo "FATAL: Test suite not installed correctly" |
| 72 | echo "INFO: as root user type 'make ; make install'" |
| 73 | exit 1 |
| 74 | } |
| 75 | |
| 76 | [ -e $LTPROOT/pan/pan ] || |
| 77 | { |
| 78 | echo "FATAL: Test suite driver 'pan' not found" |
| 79 | echo "INFO: as root user type 'make ; make install'" |
| 80 | exit 1 |
| 81 | } |
| 82 | } |
| 83 | |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 84 | version_of_ltp() |
| 85 | { |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 86 | head -n 1 $LTPROOT/ChangeLog |
| 87 | exit 0 |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 88 | } |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 89 | |
| 90 | usage() |
| 91 | { |
| 92 | cat <<-EOF >&2 |
| 93 | |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 94 | usage: ./${0##*/} -c [-C FAILCMDFILE ] [-d TMPDIR] [-f CMDFILES(,...) ] |
| 95 | [-i # (in Mb)] [ -l LOGFILE ] [ -o OUTPUTFILE ] [ -m # (in Mb)] -N -n -q |
| 96 | [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ] -v [ -w CMDFILEADDR ] |
| 97 | [ -x INSTANCES ] |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 98 | |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 99 | -C FAILCMDFILE Command file with all failed test cases. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 100 | -c NUM_PROCS Run LTP under additional background CPU load. |
| 101 | -d TMPDIR Directory where temporary files will be created. |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 102 | -e Prints the date of the current LTP release |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 103 | -f CMDFILES Execute user defined list of testcases (separate with ',') |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 104 | -h Help. Prints all available options. |
| 105 | -i # (in Mb) Run LTP with a _min_ IO load of # Mb in background. |
| 106 | -l LOGFILE Log results of test in a logfile. |
| 107 | -m # (in Mb) Run LTP with a _min_ memory load of # Mb in background. |
| 108 | -N Run all the networking tests. |
| 109 | -n Run LTP with network traffic in background. |
| 110 | -o OUTPUTFILE Redirect test output to a file. |
| 111 | -p Human readable format logfiles. |
| 112 | -q Print less verbose output to screen. |
| 113 | -r LTPROOT Fully qualified path where testsuite is installed. |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 114 | -s PATTERN Only run test cases which match PATTERN. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 115 | -t DURATION Execute the testsuite for given duration. Examples: |
| 116 | -t 60s = 60 seconds |
| 117 | -t 45m = 45 minutes |
| 118 | -t 24h = 24 hours |
| 119 | -t 2d = 2 days |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 120 | -v Print more verbose output to screen. |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 121 | -w CMDFILEADDR Uses wget to get the user's list of testcases. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 122 | -x INSTANCES Run multiple instances of this testsuite. |
| 123 | |
| 124 | example: ./${0##*/} -i 1024 -m 128 -p -q -l /tmp/resultlog.$$ -d ${PWD} |
| 125 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 126 | |
| 127 | EOF |
| 128 | exit 0 |
| 129 | } |
| 130 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 131 | main() |
| 132 | { |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 133 | local CMDFILES="" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 134 | local PRETTY_PRT="" |
| 135 | local ALT_DIR=0 |
| 136 | local RUN_NETEST=0 |
| 137 | local QUIET_MODE="" |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 138 | local VERBOSE_MODE="" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 139 | local NETPIPE=0 |
| 140 | local GENLOAD=0 |
| 141 | local MEMSIZE=0 |
| 142 | local DURATION="" |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 143 | local CMDFILEADDR="" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 144 | local BYTESIZE=0 |
| 145 | local LOGFILE="" |
| 146 | local SCENFILES="" |
| 147 | local PRETTY_PRT="" |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 148 | local TAG_RESTRICT_STRING="" |
| 149 | local PAN_COMMAND="" |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 150 | version_date=`head -n 1 $LTPROOT/ChangeLog` |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 151 | |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 152 | while getopts c:C:d:f:ehi:l:m:Nno:pqr:s:t:vw:x: arg |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 153 | do case $arg in |
| 154 | c) |
| 155 | NUM_PROCS=$(($OPTARG)) |
| 156 | $LTPROOT/testcases/bin/genload --cpu $NUM_PROCS >/dev/null 2>&1 & |
| 157 | GENLOAD=1 ;; |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 158 | |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame^] | 159 | C) echo "INFO: creating $LTPROOT/output directory" |
| 160 | [ ! -d $LTPROOT/output ] && \ |
| 161 | { |
| 162 | mkdir -p $LTPROOT/output || \ |
| 163 | { |
| 164 | echo "ERROR: failed to create $LTPROOT/output" |
| 165 | exit 1 |
| 166 | } |
| 167 | } |
| 168 | case $OPTARG in |
| 169 | /*) |
| 170 | FAILCMDFILE="-C $OPTARG" ;; |
| 171 | *) |
| 172 | FAILCMDFILE="-C $LTPROOT/output/$OPTARG" |
| 173 | ALT_DIR=1 ;; |
| 174 | esac ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 175 | |
| 176 | d) # append $$ to TMP, as it is recursively |
| 177 | # removed at end of script. |
| 178 | TMPBASE=$OPTARG |
robbiew | 58247a5 | 2005-01-19 18:44:42 +0000 | [diff] [blame] | 179 | TMP="${TMPBASE}/ltp-$$" |
robbiew | 538bc1a | 2005-03-11 19:26:14 +0000 | [diff] [blame] | 180 | export TMPDIR="$TMP";; |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 181 | e) # Print out the version of LTP |
| 182 | version_of_ltp |
| 183 | ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 184 | f) # Execute user defined set of testcases. |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 185 | # Can be more then one file, just separate it with ',', like: |
| 186 | # -f nfs,commands,/tmp/testfile |
| 187 | CMDFILES=$OPTARG;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 188 | |
| 189 | h) usage;; |
| 190 | |
| 191 | i) |
| 192 | BYTESIZE=$(($OPTARG * 1024 * 1024)) |
| 193 | $LTPROOT/testcases/bin/genload --io 1 >/dev/null 2>&1 & |
mreed10 | 56ecf39 | 2007-02-28 02:09:46 +0000 | [diff] [blame] | 194 | $LTPROOT/testcases/bin/genload --hdd 1 --hdd-bytes $BYTESIZE \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 195 | >/dev/null 2>&1 & |
| 196 | GENLOAD=1 ;; |
| 197 | |
| 198 | l) |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame^] | 199 | LOGFILE_NAME="$OPTARG" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 200 | echo "INFO: creating $LTPROOT/results directory" |
| 201 | [ ! -d $LTPROOT/results ] && \ |
| 202 | { |
| 203 | mkdir -p $LTPROOT/results || \ |
| 204 | { |
| 205 | echo "ERROR: failed to create $LTPROOT/results" |
| 206 | exit 1 |
| 207 | } |
| 208 | } |
| 209 | case $OPTARG in |
| 210 | /*) |
| 211 | LOGFILE="-l $OPTARG" ;; |
| 212 | *) |
| 213 | LOGFILE="-l $LTPROOT/results/$OPTARG" |
| 214 | ALT_DIR=1 ;; |
| 215 | esac ;; |
| 216 | |
| 217 | m) |
| 218 | MEMSIZE=$(($OPTARG * 1024 * 1024)) |
| 219 | $LTPROOT/testcases/bin/genload --vm 0 --vm-bytes $MEMSIZE \ |
| 220 | >/dev/null 2>&1 & |
| 221 | GENLOAD=1;; |
| 222 | |
| 223 | N) RUN_NETEST=1;; |
| 224 | |
| 225 | n) |
| 226 | $LTPROOT/testcases/bin/netpipe.sh |
| 227 | NETPIPE=1;; |
| 228 | |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame^] | 229 | o) OUTPUTFILE_NAME="$OPTARG" |
| 230 | echo "INFO: creating $LTPROOT/output directory" |
| 231 | [ ! -d $LTPROOT/output ] && \ |
| 232 | { |
| 233 | mkdir -p $LTPROOT/output || \ |
| 234 | { |
| 235 | echo "ERROR: failed to create $LTPROOT/output" |
| 236 | exit 1 |
| 237 | } |
| 238 | } |
| 239 | case $OPTARG in |
| 240 | /*) |
| 241 | OUTPUTFILE="-o $OPTARG";; |
| 242 | *) |
| 243 | OUTPUTFILE="-o $LTPROOT/output/$OPTARG" |
| 244 | ALT_DIR=1 ;; |
| 245 | esac ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 246 | |
| 247 | p) PRETTY_PRT=" -p ";; |
| 248 | |
| 249 | q) QUIET_MODE=" -q ";; |
| 250 | |
| 251 | r) LTPROOT=$OPTARG;; |
| 252 | |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 253 | s) TAG_RESTRICT_STRING=$OPTARG;; |
| 254 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 255 | t) # In case you want to specify the time |
| 256 | # to run from the command line |
| 257 | # (2m = two minutes, 2h = two hours, etc) |
| 258 | DURATION="-t $OPTARG" ;; |
| 259 | |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 260 | v) VERBOSE_MODE=1;; |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 261 | |
| 262 | w) CMDFILEADDR=$OPTARG;; |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 263 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 264 | x) # number of ltp's to run |
| 265 | cat <<-EOF >&1 |
| 266 | WARNING: The use of -x can cause unpredictable failures, as a |
| 267 | result of concurrently running multiple tests designed |
| 268 | to be ran exclusively. |
| 269 | Pausing for 10 seconds..." |
| 270 | EOF |
| 271 | sleep 10 |
| 272 | INSTANCES="-x $OPTARG -O ${TMP}";; |
| 273 | |
| 274 | \?) usage;; |
| 275 | esac |
| 276 | done |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame^] | 277 | |
| 278 | ## It would be nice if a Failed File is compulsorily created (gives User better Idea of Tests that failed) |
| 279 | |
| 280 | if [ ! "$FAILCMDFILE" ]; then ## User has not mentioned about Failed File name |
| 281 | echo Inside Failed File Name not Mentioned |
| 282 | [ ! -d $LTPROOT/output ] && \ ## Try Creating output Directory if it doesn exist in First Place |
| 283 | { |
| 284 | mkdir -p $LTPROOT/output || \ |
| 285 | { |
| 286 | echo "ERROR: failed to create $LTPROOT/output" ## Chuk out if not possible due to weired reason(s) |
| 287 | exit 1 |
| 288 | } |
| 289 | } |
| 290 | if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about Output File name either |
| 291 | if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name either |
| 292 | FAILED_FILE_NAME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"` |
| 293 | FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" |
| 294 | ALT_DIR=1 |
| 295 | else ## User Fortunately wanted a log file, |
| 296 | FAILED_FILE_NAME=`basename $LOGFILE_NAME` ## Extract log file name and use it to construct Failed file name |
| 297 | FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" |
| 298 | ALT_DIR=1 |
| 299 | fi |
| 300 | else ## User Fortunately wanted a Output file |
| 301 | FAILED_FILE_NAME=`basename $OUTPUTFILE_NAME` ## Extract output file name and use it to construct Failed file name |
| 302 | FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" |
| 303 | ALT_DIR=1 |
| 304 | fi |
| 305 | fi |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 306 | |
| 307 | # Added -m 777 for tests that call tst_tmpdir() and try to |
| 308 | # write to it as user nobody |
| 309 | mkdir -m 777 -p $TMP || \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 310 | { |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 311 | echo "FATAL: Unable to make temporary directory $TMP" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 312 | exit 1 |
| 313 | } |
| 314 | |
| 315 | cd $TMP || \ |
| 316 | { |
| 317 | echo "could not cd ${TMP} ... exiting" |
| 318 | exit 1 |
| 319 | } |
| 320 | |
| 321 | [ "$RUN_NETEST" -eq 1 ] && \ |
| 322 | { |
| 323 | [ -z "$RHOST" ] || [ -z "$PASSWD" ] && \ |
| 324 | { |
| 325 | [ -z "$RHOST" ] && \ |
| 326 | { |
| 327 | echo \ |
| 328 | "INFO: Enter RHOST = 'name of the remote host machine'" |
| 329 | echo -n "-> " |
| 330 | read RHOST |
| 331 | } |
| 332 | |
| 333 | [ -z "$PASSWD" ] && \ |
| 334 | { |
| 335 | echo " " |
| 336 | echo \ |
| 337 | "INFO: Enter PASSWD = 'root passwd of the remote host machine'" |
| 338 | echo -n "-> " |
| 339 | read PASSWD |
| 340 | } |
| 341 | export RHOST=$RHOST |
| 342 | export PASSWD=$PASSWD |
| 343 | echo "WARNING: security of $RHOST may be compromised" |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | # If user does not provide a command file select a default set of testcases |
| 348 | # to execute. |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 349 | if [ -z "$CMDFILES" ] && [ -z "$CMDFILEADDR" ] |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 350 | then |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 351 | cat <<-EOF >&1 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 352 | |
| 353 | INFO: no command files were provided, using default, |
| 354 | system calls, memory management, IPC, scheduler |
| 355 | direct io, file system, math and pty tests will |
| 356 | now be executed |
| 357 | |
| 358 | EOF |
| 359 | |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 360 | for SCENFILES in ${LTPROOT}/runtest/syscalls ${LTPROOT}/runtest/fs \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 361 | ${LTPROOT}/runtest/fsx ${LTPROOT}/runtest/dio \ |
| 362 | ${LTPROOT}/runtest/mm ${LTPROOT}/runtest/ipc \ |
| 363 | ${LTPROOT}/runtest/sched ${LTPROOT}/runtest/math \ |
subrata_modak | 0c5f970 | 2007-04-26 11:02:47 +0000 | [diff] [blame] | 364 | ${LTPROOT}/runtest/nptl ${LTPROOT}/runtest/pty \ |
| 365 | ${LTPROOT}/runtest/containers |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 366 | do |
| 367 | [ -a "$SCENFILES" ] || \ |
| 368 | { |
| 369 | echo "FATAL: missing scenario file $SCENFILES" |
| 370 | exit 1 |
| 371 | } |
| 372 | |
| 373 | cat $SCENFILES >> ${TMP}/alltests || \ |
| 374 | { |
| 375 | echo "FATAL: unable to create command file" |
| 376 | exit 1 |
| 377 | } |
| 378 | done |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 379 | fi |
| 380 | |
| 381 | [ -n "$CMDFILES" ] && \ |
| 382 | { |
| 383 | for SCENFILES in `echo "$CMDFILES" | sed 's/,/\n/g'` |
| 384 | do |
| 385 | [ -f "$SCENFILES" ] || SCENFILES="$LTPROOT/runtest/$SCENFILES" |
| 386 | cat "$SCENFILES" >> ${TMP}/alltests || \ |
| 387 | { |
| 388 | echo "FATAL: unable to create command file" |
| 389 | exit 1 |
| 390 | } |
| 391 | done |
| 392 | } |
| 393 | |
| 394 | [ -n "$CMDFILEADDR" ] && \ |
| 395 | { |
| 396 | wget -q "${CMDFILEADDR}" -O ${TMP}/wgetcmdfile |
| 397 | if [ $? -ne 0 ]; then |
| 398 | echo "FATAL: error while getting the command file with wget (address $CMDFILEADDR)" |
| 399 | exit 1 |
| 400 | fi |
| 401 | cat "${TMP}/wgetcmdfile" >> ${TMP}/alltests || \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 402 | { |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 403 | echo "FATAL: unable to create command file" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 404 | exit 1 |
| 405 | } |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 406 | } |
| 407 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 408 | [ "$RUN_NETEST" -eq 1 ] && \ |
| 409 | { |
| 410 | for SCENFILES in ${LTPROOT}/runtest/tcp_cmds \ |
| 411 | ${LTPROOT}/runtest/multicast \ |
| 412 | ${LTPROOT}/runtest/rpc \ |
| 413 | ${LTPROOT}/runtest/nfs |
| 414 | do |
| 415 | [ -a "$SCENFILES" ] || \ |
| 416 | { |
| 417 | echo "FATAL: missing scenario file $SCENFILES" |
| 418 | exit 1 |
| 419 | } |
| 420 | |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 421 | cat "$SCENFILES" >> ${TMP}/alltests || \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 422 | { |
| 423 | echo "FATAL: unable to create command file" |
| 424 | exit 1 |
| 425 | } |
| 426 | done |
| 427 | } |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 428 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 429 | # The fsx-linux tests use the SCRATCHDEV environment variable as a location |
| 430 | # that can be reformatted and run on. Set SCRATCHDEV if you want to run |
| 431 | # these tests. As a safeguard, this is disabled. |
| 432 | unset SCRATCHDEV |
| 433 | [ -n "$SCRATCHDEV" ] && \ |
| 434 | { |
| 435 | cat ${LTPROOT}/runtest/fsx >> ${TMP}/alltests || |
| 436 | { |
| 437 | echo "FATAL: unable to create fsx-linux tests command file" |
| 438 | exit 1 |
| 439 | } |
| 440 | } |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 441 | |
| 442 | # If enabled, execute only test cases that match the PATTERN |
| 443 | if [ -n "$TAG_RESTRICT_STRING" ] |
| 444 | then |
| 445 | mv -f ${TMP}/alltests ${TMP}/alltests.orig |
| 446 | grep $TAG_RESTRICT_STRING ${TMP}/alltests.orig > ${TMP}/alltests #Not worth checking return codes for this case |
| 447 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 448 | |
| 449 | # check for required users and groups |
| 450 | ${LTPROOT}/IDcheck.sh &>/dev/null || \ |
| 451 | { |
| 452 | echo "WARNING: required users and groups not present" |
| 453 | echo "WARNING: some test cases may fail" |
| 454 | } |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 455 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 456 | # display versions of installed software |
| 457 | [ -z "$QUIET_MODE" ] && \ |
| 458 | { |
| 459 | ${LTPROOT}/ver_linux || \ |
| 460 | { |
| 461 | echo "WARNING: unable to display versions of software installed" |
| 462 | exit 1 |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test start time: $(date)" ; } |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 467 | PAN_COMMAND="${LTPROOT}/pan/pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \ |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 468 | -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE" |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 469 | if [ ! -z "$VERBOSE_MODE" ] ; then |
| 470 | echo "COMMAND: $PAN_COMMAND" |
| 471 | if [ ! -z "$TAG_RESTRICT_STRING" ] ; then |
| 472 | echo "INFO: Restricted to $TAG_RESTRICT_STRING" |
| 473 | fi |
| 474 | fi |
| 475 | #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 476 | ${LTPROOT}/pan/pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \ |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 477 | -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 478 | |
| 479 | if [ $? -eq 0 ]; then |
| 480 | echo "INFO: pan reported all tests PASS" |
| 481 | VALUE=0 |
| 482 | else |
| 483 | echo "INFO: pan reported some tests FAIL" |
| 484 | VALUE=1 |
| 485 | fi |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 486 | echo "LTP Version: $version_date" |
| 487 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 488 | [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test end time: $(date)" ; } |
| 489 | |
| 490 | [ "$GENLOAD" -eq 1 ] && { killall -9 genload ; } |
| 491 | [ "$NETPIPE" -eq 1 ] && { killall -9 NPtcp ; } |
| 492 | |
| 493 | [ "$ALT_DIR" -eq 1 ] && \ |
| 494 | { |
| 495 | cat <<-EOF >&1 |
| 496 | |
| 497 | ###############################################################" |
| 498 | |
| 499 | Done executing testcases." |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame^] | 500 | log result(s) is in $LTPROOT/results directory" |
| 501 | output/failed result(s) in $LTPROOT/output directory [If you did not provide Absolute Path] |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 502 | LTP Version: $version_date |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 503 | ###############################################################" |
| 504 | |
| 505 | EOF |
| 506 | } |
| 507 | exit $VALUE |
| 508 | } |
| 509 | |
| 510 | cleanup() |
| 511 | { |
| 512 | rm -rf ${TMP} |
| 513 | } |
| 514 | |
| 515 | trap "cleanup" 0 |
| 516 | setup |
| 517 | main "$@" |