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 | # |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 53 | # Sep 14 2007 - Modified - Ricardo Salveti de Araujo |
| 54 | # - cleaning and removing duplicated code |
| 55 | # |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 56 | # Oct 27 2007 - Modified - Ricardo Salveti de Araujo and Subrata Modak |
| 57 | # - better ways to integrate "ltp/tools/genload/stress" with "ltp/runltp" |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 58 | # Nov 24 2007 - Modified - Subrata Modak |
| 59 | # - Added a new option to generate output in HTML format also. Also retaining |
| 60 | # the original test format |
subrata_modak | f376b48 | 2007-11-28 11:30:54 +0000 | [diff] [blame] | 61 | # Nov 28 2007 - Modified - Subrata Modak |
| 62 | # - Added a new option to mail back LTP reports |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 63 | # May 19 2008 - Modified - Subrata Modak |
| 64 | # - Added capability for default Log file generation |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 65 | # |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 66 | ################################################################################# |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 67 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 68 | |
| 69 | |
| 70 | setup() |
| 71 | { |
| 72 | cd `dirname $0` || \ |
| 73 | { |
| 74 | echo "FATAL: unable to change directory to $(dirname $0)" |
| 75 | exit 1 |
| 76 | } |
| 77 | export LTPROOT=${PWD} |
| 78 | export TMPBASE="/tmp" |
| 79 | export TMP="${TMPBASE}/ltp-$$" |
subrata_modak | 4a57fe8 | 2007-09-24 06:40:12 +0000 | [diff] [blame] | 80 | export TMPDIR="${TMP}" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 81 | export PATH="${PATH}:${LTPROOT}/testcases/bin" |
| 82 | |
| 83 | [ -d $LTPROOT/testcases/bin ] || |
| 84 | { |
| 85 | echo "FATAL: Test suite not installed correctly" |
| 86 | echo "INFO: as root user type 'make ; make install'" |
| 87 | exit 1 |
| 88 | } |
| 89 | |
| 90 | [ -e $LTPROOT/pan/pan ] || |
| 91 | { |
| 92 | echo "FATAL: Test suite driver 'pan' not found" |
| 93 | echo "INFO: as root user type 'make ; make install'" |
| 94 | exit 1 |
| 95 | } |
| 96 | } |
| 97 | |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 98 | version_of_ltp() |
| 99 | { |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 100 | head -n 1 $LTPROOT/ChangeLog |
| 101 | exit 0 |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 102 | } |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 103 | |
| 104 | usage() |
| 105 | { |
| 106 | cat <<-EOF >&2 |
| 107 | |
subrata_modak | f376b48 | 2007-11-28 11:30:54 +0000 | [diff] [blame] | 108 | usage: ./${0##*/} [ -a EMAIL_TO ] [ -c NUM_PROCS ] [ -C FAILCMDFILE ] [ -d TMPDIR ] |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 109 | [ -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG ] -e [ -f CMDFILES(,...) ] [ -g HTMLFILE] |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 110 | [ -i NUM_PROCS ] [ -l LOGFILE ] [ -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG ] |
| 111 | -N -n [ -o OUTPUTFILE ] -p -q [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ] |
| 112 | -v [ -w CMDFILEADDR ] [ -x INSTANCES ] |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 113 | |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 114 | -a EMAIL_TO EMAIL all your Reports to this E-mail Address |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 115 | -c NUM_PROCS Run LTP under additional background CPU load |
| 116 | [NUM_PROCS = no. of processes creating the CPU Load by spinning over sqrt() |
| 117 | (Defaults to 1 when value)] |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 118 | -C FAILCMDFILE Command file with all failed test cases. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 119 | -d TMPDIR Directory where temporary files will be created. |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 120 | -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG |
| 121 | Run LTP under additional background Load on Secondary Storage (Seperate by comma) |
| 122 | [NUM_PROCS = no. of processes creating Storage Load by spinning over write()] |
| 123 | [NUM_FILES = Write() to these many files (Defaults to 1 when value 0 or undefined)] |
| 124 | [NUM_BYTES = write these many bytes (defaults to 1GB, when value 0 or undefined)] |
| 125 | [CLEAN_FLAG = unlink file to which random data written, when value 1] |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 126 | -e Prints the date of the current LTP release |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 127 | -f CMDFILES Execute user defined list of testcases (separate with ',') |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 128 | -g HTMLFILE Create an additional HTML output format |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 129 | -h Help. Prints all available options. |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 130 | -i NUM_PROCS Run LTP under additional background Load on IO Bus |
| 131 | [NUM_PROCS = no. of processes creating IO Bus Load by spinning over sync()] |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 132 | -l LOGFILE Log results of test in a logfile. |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 133 | -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG |
| 134 | Run LTP under additional background Load on Main memory (Seperate by comma) |
| 135 | [NUM_PROCS = no. of processes creating main Memory Load by spinning over malloc()] |
| 136 | [CHUNKS = malloc these many chunks (default is 1 when value 0 or undefined)] |
| 137 | [BYTES = malloc CHUNKS of BYTES bytes (default is 256MB when value 0 or undefined) ] |
| 138 | [HANGUP_FLAG = hang in a sleep loop after memory allocated, when value 1] |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 139 | -N Run all the networking tests. |
| 140 | -n Run LTP with network traffic in background. |
| 141 | -o OUTPUTFILE Redirect test output to a file. |
| 142 | -p Human readable format logfiles. |
| 143 | -q Print less verbose output to screen. |
| 144 | -r LTPROOT Fully qualified path where testsuite is installed. |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 145 | -s PATTERN Only run test cases which match PATTERN. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 146 | -t DURATION Execute the testsuite for given duration. Examples: |
| 147 | -t 60s = 60 seconds |
| 148 | -t 45m = 45 minutes |
| 149 | -t 24h = 24 hours |
| 150 | -t 2d = 2 days |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 151 | -T REPETITION Execute the testsuite for REPETITION no. of times |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 152 | -v Print more verbose output to screen. |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 153 | -w CMDFILEADDR Uses wget to get the user's list of testcases. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 154 | -x INSTANCES Run multiple instances of this testsuite. |
| 155 | |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 156 | example: ./${0##*/} -c 2 -i 2 -m 2,4,10240,1 -D 2,10,10240,1 -p -q -l /tmp/result-log.$$ -o /tmp/result-output.$$ -C /tmp/result-failed.$$ -d ${PWD} |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 157 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 158 | |
| 159 | EOF |
| 160 | exit 0 |
| 161 | } |
| 162 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 163 | main() |
| 164 | { |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 165 | local CMDFILES="" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 166 | local PRETTY_PRT="" |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 167 | local ALT_DIR_OUT=0 |
| 168 | local ALT_DIR_RES=0 |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 169 | local ALT_HTML_OUT=0 |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 170 | local ALT_EMAIL_OUT=0 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 171 | local RUN_NETEST=0 |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 172 | local RUN_REPEATED=0 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 173 | local QUIET_MODE="" |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 174 | local VERBOSE_MODE="" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 175 | local NETPIPE=0 |
| 176 | local GENLOAD=0 |
| 177 | local MEMSIZE=0 |
| 178 | local DURATION="" |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 179 | local CMDFILEADDR="" |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 180 | local FAILCMDFILE="" |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 181 | local LOGFILE_NAME="" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 182 | local LOGFILE="" |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 183 | local OUTPUTFILE_NAME="" |
| 184 | local OUTPUTFILE="" |
| 185 | local HTMLFILE_NAME="" |
| 186 | local HTMLFILE="" |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 187 | local EMAIL_TO="" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 188 | local SCENFILES="" |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 189 | local TAG_RESTRICT_STRING="" |
| 190 | local PAN_COMMAND="" |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 191 | local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"` |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 192 | version_date=`head -n 1 $LTPROOT/ChangeLog` |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 193 | |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 194 | while getopts a:c:C:d:D:f:ehi:g:l:m:Nno:pqr:s:t:T:vw:x: arg |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 195 | do case $arg in |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 196 | a) EMAIL_TO=$OPTARG |
| 197 | ALT_EMAIL_OUT=1;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 198 | c) |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 199 | NUM_PROCS=$(($OPTARG)) |
| 200 | if [ "$NUM_PROCS" -eq 0 ]; then |
| 201 | # User Did not Define the Value ,or, User Defined Zero, |
| 202 | # hence, prevent from creating infinite processes |
| 203 | NUM_PROCS=1 |
| 204 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 205 | $LTPROOT/testcases/bin/genload --cpu $NUM_PROCS >/dev/null 2>&1 & |
| 206 | GENLOAD=1 ;; |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 207 | |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 208 | C) |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 209 | case $OPTARG in |
| 210 | /*) |
| 211 | FAILCMDFILE="-C $OPTARG" ;; |
| 212 | *) |
| 213 | FAILCMDFILE="-C $LTPROOT/output/$OPTARG" |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 214 | ALT_DIR_OUT=1 ;; |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 215 | esac ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 216 | |
| 217 | d) # append $$ to TMP, as it is recursively |
| 218 | # removed at end of script. |
subrata_modak | 4a57fe8 | 2007-09-24 06:40:12 +0000 | [diff] [blame] | 219 | export TMPBASE=$OPTARG |
| 220 | export TMP="${TMPBASE}/ltp-$$" |
robbiew | 538bc1a | 2005-03-11 19:26:14 +0000 | [diff] [blame] | 221 | export TMPDIR="$TMP";; |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 222 | |
| 223 | D) NUM_PROCS=1; NUM_FILES=1; NUM_BYTES=$((1024 * 1024 * 1024)); CLEAN_FLAG=0 |
| 224 | ARGUMENT_LIST=$(($OPTARG)) |
| 225 | TOTAL_ARGUMENTS=1 # Initial Assume |
| 226 | for ARGUMENT in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop |
| 227 | do |
| 228 | case $TOTAL_ARGUMENTS in |
| 229 | 1) NUM_PROCS="$ARGUMENT" ;; |
| 230 | 2) NUM_FILES="$ARGUMENT" ;; |
| 231 | 3) NUM_BYTES="$ARGUMENT" ;; |
| 232 | 4) CLEAN_FLAG="$ARGUMENT" ;; |
| 233 | esac |
| 234 | TOTAL_ARGUMENTS=`expr $TOTAL_ARGUMENTS + 1` |
| 235 | done |
| 236 | # just to get the default values if the user passed 0 |
| 237 | if [ "$NUM_PROCS" -eq 0 ]; then |
| 238 | NUM_PROCS=1 |
| 239 | fi |
| 240 | if [ "$NUM_FILES" -eq 0 ]; then |
| 241 | NUM_FILES=1 |
| 242 | fi |
| 243 | if [ "$NUM_BYTES" -eq 0 ]; then |
| 244 | NUM_BYTES=$((1024 * 1024 * 1024)) |
| 245 | fi |
| 246 | if [ "$CLEAN_FLAG" -ne 1 ]; then |
| 247 | CLEAN_FLAG=0 |
| 248 | fi |
| 249 | if [ "$CLEAN_FLAG" -eq 1 ]; then |
| 250 | # Do not unlink file in this case |
| 251 | $LTPROOT/testcases/bin/genload --hdd $NUM_PROCS --hdd-files \ |
| 252 | $NUM_FILES --hdd-bytes $NUM_BYTES >/dev/null 2>&1 & |
| 253 | else |
| 254 | # Cleanup otherwise |
| 255 | $LTPROOT/testcases/bin/genload --hdd $NUM_PROCS --hdd-files \ |
| 256 | $NUM_FILES --hdd-bytes $NUM_BYTES --hdd-noclean >/dev/null 2>&1 & |
| 257 | fi |
| 258 | GENLOAD=1;; |
| 259 | |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 260 | e) # Print out the version of LTP |
| 261 | version_of_ltp |
| 262 | ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 263 | f) # Execute user defined set of testcases. |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 264 | # Can be more then one file, just separate it with ',', like: |
| 265 | # -f nfs,commands,/tmp/testfile |
| 266 | CMDFILES=$OPTARG;; |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 267 | g) HTMLFILE_NAME="$OPTARG" |
| 268 | case $OPTARG in |
| 269 | /*) |
| 270 | HTMLFILE="$OPTARG";; |
| 271 | *) |
subrata_modak | d48c4d0 | 2008-01-23 12:59:40 +0000 | [diff] [blame] | 272 | HTMLFILE="$LTPROOT/output/$OPTARG";; |
| 273 | esac |
| 274 | ALT_DIR_OUT=1 |
| 275 | ALT_HTML_OUT=1;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 276 | h) usage;; |
| 277 | |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 278 | i) |
| 279 | NUM_PROCS=$(($OPTARG)) |
| 280 | if [ "$NUM_PROCS" -eq 0 ]; then |
| 281 | # User Did not Define the Value ,or, User Defined Zero, |
| 282 | # hence, prevent from creating infinite processes |
| 283 | NUM_PROCS=1 |
| 284 | fi |
| 285 | $LTPROOT/testcases/bin/genload --io $NUM_PROCS >/dev/null 2>&1 & |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 286 | GENLOAD=1 ;; |
| 287 | |
| 288 | l) |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 289 | LOGFILE_NAME="$OPTARG" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 290 | case $OPTARG in |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 291 | /*) |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 292 | LOGFILE="-l $OPTARG" ;; |
| 293 | *) |
| 294 | LOGFILE="-l $LTPROOT/results/$OPTARG" |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 295 | ALT_DIR_RES=1 ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 296 | esac ;; |
| 297 | |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 298 | m) NUM_PROCS=1; CHUNKS=1; BYTES=$((256 * 1024 * 1024)); HANGUP_FLAG=0 |
| 299 | ARGUMENT_LIST=$(($OPTARG)) |
| 300 | TOTAL_ARGUMENTS=1 # Initial Assume |
| 301 | for ARGUMENT in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop |
| 302 | do |
| 303 | case $TOTAL_ARGUMENTS in |
| 304 | 1) NUM_PROCS="$ARGUMENT" ;; |
| 305 | 2) CHUNKS="$ARGUMENT" ;; |
| 306 | 3) BYTES="$ARGUMENT" ;; |
| 307 | 4) HANGUP_FLAG="$ARGUMENT" ;; |
| 308 | esac |
| 309 | TOTAL_ARGUMENTS=`expr $TOTAL_ARGUMENTS + 1` |
| 310 | done |
| 311 | # just to get the default values if the user passed 0 |
| 312 | if [ "$NUM_PROCS" -eq 0 ]; then |
| 313 | NUM_PROCS=1 |
| 314 | fi |
| 315 | if [ "$CHUNKS" -eq 0 ]; then |
| 316 | CHUNKS=1 |
| 317 | fi |
| 318 | if [ "$BYTES" -eq 0 ]; then |
| 319 | BYTES=$((256 * 1024 * 1024)) |
| 320 | fi |
| 321 | if [ "$HANGUP_FLAG" -ne 1 ]; then |
| 322 | HANGUP_FLAG=0 |
| 323 | fi |
| 324 | if [ "$HANGUP_FLAG" -eq 1 ]; then |
| 325 | # Hang in a Sleep loop after memory allocated |
| 326 | $LTPROOT/testcases/bin/genload --vm $NUM_PROCS --vm-chunks \ |
| 327 | $CHUNKS --vm-bytes $BYTES --vm-hang >/dev/null 2>&1 & |
| 328 | else |
| 329 | # Otherwise Do not Hangup |
| 330 | $LTPROOT/testcases/bin/genload --vm $NUM_PROCS --vm-chunks \ |
| 331 | $CHUNKS --vm-bytes $BYTES >/dev/null 2>&1 & |
| 332 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 333 | GENLOAD=1;; |
| 334 | |
| 335 | N) RUN_NETEST=1;; |
| 336 | |
| 337 | n) |
| 338 | $LTPROOT/testcases/bin/netpipe.sh |
| 339 | NETPIPE=1;; |
| 340 | |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 341 | o) OUTPUTFILE_NAME="$OPTARG" |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 342 | case $OPTARG in |
| 343 | /*) |
| 344 | OUTPUTFILE="-o $OPTARG";; |
| 345 | *) |
| 346 | OUTPUTFILE="-o $LTPROOT/output/$OPTARG" |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 347 | ALT_DIR_OUT=1 ;; |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 348 | esac ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 349 | |
| 350 | p) PRETTY_PRT=" -p ";; |
| 351 | |
| 352 | q) QUIET_MODE=" -q ";; |
| 353 | |
| 354 | r) LTPROOT=$OPTARG;; |
| 355 | |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 356 | s) TAG_RESTRICT_STRING=$OPTARG;; |
| 357 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 358 | t) # In case you want to specify the time |
| 359 | # to run from the command line |
| 360 | # (2m = two minutes, 2h = two hours, etc) |
| 361 | DURATION="-t $OPTARG" ;; |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 362 | |
| 363 | T) # In case you want the testcases to runsequentially RUN_REPEATED times |
| 364 | RUN_REPEATED=$OPTARG;; |
| 365 | |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 366 | v) VERBOSE_MODE=1;; |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 367 | |
| 368 | w) CMDFILEADDR=$OPTARG;; |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 369 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 370 | x) # number of ltp's to run |
| 371 | cat <<-EOF >&1 |
| 372 | WARNING: The use of -x can cause unpredictable failures, as a |
| 373 | result of concurrently running multiple tests designed |
| 374 | to be ran exclusively. |
| 375 | Pausing for 10 seconds..." |
| 376 | EOF |
| 377 | sleep 10 |
| 378 | INSTANCES="-x $OPTARG -O ${TMP}";; |
| 379 | |
| 380 | \?) usage;; |
| 381 | esac |
| 382 | done |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 383 | |
| 384 | ## It would be nice to create a default log file even if the user has not mentioned |
| 385 | if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name |
| 386 | LOGFILE_NAME=$DEFAULT_FILE_NAME_GENERATION_TIME |
| 387 | LOGFILE="-l $LTPROOT/results/LTP_RUN_ON-$LOGFILE_NAME.log" |
| 388 | ALT_DIR_RES=1 |
| 389 | PRETTY_PRT=" -p " |
| 390 | fi |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 391 | |
| 392 | ## It would be nice if a Failed File is compulsorily created (gives User better Idea of Tests that failed) |
| 393 | |
| 394 | if [ ! "$FAILCMDFILE" ]; then ## User has not mentioned about Failed File name |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 395 | ALT_DIR_OUT=1 |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 396 | if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about Output File name either |
| 397 | if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name either |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 398 | FAILED_FILE_NAME=$DEFAULT_FILE_NAME_GENERATION_TIME |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 399 | FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 400 | else ## User Fortunately wanted a log file, |
| 401 | FAILED_FILE_NAME=`basename $LOGFILE_NAME` ## Extract log file name and use it to construct Failed file name |
| 402 | FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 403 | fi |
| 404 | else ## User Fortunately wanted a Output file |
| 405 | FAILED_FILE_NAME=`basename $OUTPUTFILE_NAME` ## Extract output file name and use it to construct Failed file name |
| 406 | FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 407 | fi |
| 408 | fi |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 409 | |
subrata_modak | d48c4d0 | 2008-01-23 12:59:40 +0000 | [diff] [blame] | 410 | if [ "$ALT_HTML_OUT" -eq 1 ] ; then ## User wants the HTML version of the output |
| 411 | QUIET_MODE="" ## Suppressing this guy as it will prevent generation of proper output |
| 412 | ## which the HTML parser will require |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 413 | if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about the Outputfile name, then we need to definitely generate one |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 414 | OUTPUTFILE_NAME=$DEFAULT_FILE_NAME_GENERATION_TIME |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 415 | OUTPUTFILE="-o $LTPROOT/output/LTP_RUN_ON-$OUTPUTFILE_NAME.output" |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 416 | ALT_DIR_OUT=1 |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 417 | if [ ! "$HTMLFILE" ] ; then ## User has not mentioned HTML File name, We need to create one |
| 418 | HTMLFILE_NAME=`basename $OUTPUTFILE_NAME` |
| 419 | HTMLFILE="$LTPROOT/output/$HTMLFILE_NAME.html" |
| 420 | fi |
| 421 | fi |
| 422 | fi |
| 423 | |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 424 | # If we need, create the output directory |
| 425 | [ "$ALT_DIR_OUT" -eq 1 ] && \ |
| 426 | { |
| 427 | echo "INFO: creating $LTPROOT/output directory" |
| 428 | [ ! -d $LTPROOT/output ] && \ |
| 429 | { |
| 430 | mkdir -p $LTPROOT/output || \ |
| 431 | { |
| 432 | echo "ERROR: failed to create $LTPROOT/output" |
| 433 | exit 1 |
| 434 | } |
| 435 | } |
| 436 | } |
| 437 | # If we need, create the results directory |
| 438 | [ "$ALT_DIR_RES" -eq 1 ] && \ |
| 439 | { |
| 440 | echo "INFO: creating $LTPROOT/results directory" |
| 441 | [ ! -d $LTPROOT/results ] && \ |
| 442 | { |
| 443 | mkdir -p $LTPROOT/results || \ |
| 444 | { |
| 445 | echo "ERROR: failed to create $LTPROOT/results" |
| 446 | exit 1 |
| 447 | } |
| 448 | } |
| 449 | } |
| 450 | |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 451 | # Added -m 777 for tests that call tst_tmpdir() and try to |
| 452 | # write to it as user nobody |
| 453 | mkdir -m 777 -p $TMP || \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 454 | { |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 455 | echo "FATAL: Unable to make temporary directory $TMP" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 456 | exit 1 |
| 457 | } |
| 458 | |
| 459 | cd $TMP || \ |
| 460 | { |
| 461 | echo "could not cd ${TMP} ... exiting" |
| 462 | exit 1 |
| 463 | } |
| 464 | |
| 465 | [ "$RUN_NETEST" -eq 1 ] && \ |
| 466 | { |
| 467 | [ -z "$RHOST" ] || [ -z "$PASSWD" ] && \ |
| 468 | { |
| 469 | [ -z "$RHOST" ] && \ |
| 470 | { |
| 471 | echo \ |
| 472 | "INFO: Enter RHOST = 'name of the remote host machine'" |
| 473 | echo -n "-> " |
| 474 | read RHOST |
| 475 | } |
| 476 | |
| 477 | [ -z "$PASSWD" ] && \ |
| 478 | { |
| 479 | echo " " |
| 480 | echo \ |
| 481 | "INFO: Enter PASSWD = 'root passwd of the remote host machine'" |
| 482 | echo -n "-> " |
| 483 | read PASSWD |
| 484 | } |
| 485 | export RHOST=$RHOST |
| 486 | export PASSWD=$PASSWD |
| 487 | echo "WARNING: security of $RHOST may be compromised" |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | # If user does not provide a command file select a default set of testcases |
| 492 | # to execute. |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 493 | if [ -z "$CMDFILES" ] && [ -z "$CMDFILEADDR" ] |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 494 | then |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 495 | cat <<-EOF >&1 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 496 | |
| 497 | INFO: no command files were provided, using default, |
| 498 | system calls, memory management, IPC, scheduler |
| 499 | direct io, file system, math and pty tests will |
| 500 | now be executed |
| 501 | |
| 502 | EOF |
| 503 | |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 504 | for SCENFILES in ${LTPROOT}/runtest/syscalls ${LTPROOT}/runtest/fs \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 505 | ${LTPROOT}/runtest/fsx ${LTPROOT}/runtest/dio \ |
| 506 | ${LTPROOT}/runtest/mm ${LTPROOT}/runtest/ipc \ |
| 507 | ${LTPROOT}/runtest/sched ${LTPROOT}/runtest/math \ |
subrata_modak | 0c5f970 | 2007-04-26 11:02:47 +0000 | [diff] [blame] | 508 | ${LTPROOT}/runtest/nptl ${LTPROOT}/runtest/pty \ |
subrata_modak | 2817ce1 | 2008-01-23 13:45:03 +0000 | [diff] [blame] | 509 | ${LTPROOT}/runtest/containers \ |
subrata_modak | 1d1937a | 2008-05-13 10:44:02 +0000 | [diff] [blame] | 510 | ${LTPROOT}/runtest/fs_bind \ |
subrata_modak | dce1a72 | 2008-02-28 15:50:18 +0000 | [diff] [blame] | 511 | ${LTPROOT}/runtest/controllers \ |
subrata_modak | aad9c3b | 2008-05-23 10:20:10 +0000 | [diff] [blame] | 512 | ${LTPROOT}/runtest/filecaps \ |
| 513 | ${LTPROOT}/runtest/fcntl-locktests |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 514 | do |
vapier | e42c4b2 | 2008-03-08 12:49:06 +0000 | [diff] [blame] | 515 | [ -e "$SCENFILES" ] || \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 516 | { |
| 517 | echo "FATAL: missing scenario file $SCENFILES" |
| 518 | exit 1 |
| 519 | } |
| 520 | |
| 521 | cat $SCENFILES >> ${TMP}/alltests || \ |
| 522 | { |
| 523 | echo "FATAL: unable to create command file" |
| 524 | exit 1 |
| 525 | } |
| 526 | done |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 527 | fi |
| 528 | |
| 529 | [ -n "$CMDFILES" ] && \ |
| 530 | { |
| 531 | for SCENFILES in `echo "$CMDFILES" | sed 's/,/\n/g'` |
| 532 | do |
| 533 | [ -f "$SCENFILES" ] || SCENFILES="$LTPROOT/runtest/$SCENFILES" |
| 534 | cat "$SCENFILES" >> ${TMP}/alltests || \ |
| 535 | { |
| 536 | echo "FATAL: unable to create command file" |
| 537 | exit 1 |
| 538 | } |
| 539 | done |
| 540 | } |
| 541 | |
| 542 | [ -n "$CMDFILEADDR" ] && \ |
| 543 | { |
| 544 | wget -q "${CMDFILEADDR}" -O ${TMP}/wgetcmdfile |
| 545 | if [ $? -ne 0 ]; then |
| 546 | echo "FATAL: error while getting the command file with wget (address $CMDFILEADDR)" |
| 547 | exit 1 |
| 548 | fi |
| 549 | cat "${TMP}/wgetcmdfile" >> ${TMP}/alltests || \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 550 | { |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 551 | echo "FATAL: unable to create command file" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 552 | exit 1 |
| 553 | } |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 554 | } |
| 555 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 556 | [ "$RUN_NETEST" -eq 1 ] && \ |
| 557 | { |
| 558 | for SCENFILES in ${LTPROOT}/runtest/tcp_cmds \ |
| 559 | ${LTPROOT}/runtest/multicast \ |
| 560 | ${LTPROOT}/runtest/rpc \ |
| 561 | ${LTPROOT}/runtest/nfs |
| 562 | do |
vapier | e42c4b2 | 2008-03-08 12:49:06 +0000 | [diff] [blame] | 563 | [ -e "$SCENFILES" ] || \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 564 | { |
| 565 | echo "FATAL: missing scenario file $SCENFILES" |
| 566 | exit 1 |
| 567 | } |
| 568 | |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 569 | cat "$SCENFILES" >> ${TMP}/alltests || \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 570 | { |
| 571 | echo "FATAL: unable to create command file" |
| 572 | exit 1 |
| 573 | } |
| 574 | done |
| 575 | } |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 576 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 577 | # The fsx-linux tests use the SCRATCHDEV environment variable as a location |
| 578 | # that can be reformatted and run on. Set SCRATCHDEV if you want to run |
| 579 | # these tests. As a safeguard, this is disabled. |
| 580 | unset SCRATCHDEV |
| 581 | [ -n "$SCRATCHDEV" ] && \ |
| 582 | { |
| 583 | cat ${LTPROOT}/runtest/fsx >> ${TMP}/alltests || |
| 584 | { |
| 585 | echo "FATAL: unable to create fsx-linux tests command file" |
| 586 | exit 1 |
| 587 | } |
| 588 | } |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 589 | |
| 590 | # If enabled, execute only test cases that match the PATTERN |
| 591 | if [ -n "$TAG_RESTRICT_STRING" ] |
| 592 | then |
| 593 | mv -f ${TMP}/alltests ${TMP}/alltests.orig |
| 594 | grep $TAG_RESTRICT_STRING ${TMP}/alltests.orig > ${TMP}/alltests #Not worth checking return codes for this case |
| 595 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 596 | |
| 597 | # check for required users and groups |
| 598 | ${LTPROOT}/IDcheck.sh &>/dev/null || \ |
| 599 | { |
| 600 | echo "WARNING: required users and groups not present" |
| 601 | echo "WARNING: some test cases may fail" |
| 602 | } |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 603 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 604 | # display versions of installed software |
| 605 | [ -z "$QUIET_MODE" ] && \ |
| 606 | { |
| 607 | ${LTPROOT}/ver_linux || \ |
| 608 | { |
| 609 | echo "WARNING: unable to display versions of software installed" |
| 610 | exit 1 |
| 611 | } |
| 612 | } |
| 613 | |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 614 | if [ $RUN_REPEATED -gt 1 ]; then # You need to specify at least more than 1 sequential run, else it runs default |
| 615 | echo "PAN will run these test cases $RUN_REPEATED times....." |
| 616 | echo "Test Tags will be Prepended with ITERATION NO.s....." |
| 617 | inc=1 |
| 618 | sed -e '/^$/ d' -e 's/^[ ,\t]*//' -e '/^#/ d' < ${TMP}/alltests > ${TMP}/alltests.temp ##This removes all newlines, leading spaces, tabs, # |
| 619 | sed 's/^[0-9,a-z,A-Z]*/'"$inc"'_ITERATION_&/' < ${TMP}/alltests.temp > ${TMP}/alltests ## .temp is kept as Base file |
| 620 | while [ $inc -lt $RUN_REPEATED ] ; do |
| 621 | inc=`expr $inc + 1` |
| 622 | sed 's/^[0-9,a-z,A-Z]*/'"$inc"'_ITERATION_&/' < ${TMP}/alltests.temp >> ${TMP}/alltests #Keep appending with Iteration No.s |
| 623 | done |
| 624 | fi |
| 625 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 626 | [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test start time: $(date)" ; } |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 627 | PAN_COMMAND="${LTPROOT}/pan/pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \ |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 628 | -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE" |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 629 | if [ ! -z "$VERBOSE_MODE" ] ; then |
| 630 | echo "COMMAND: $PAN_COMMAND" |
| 631 | if [ ! -z "$TAG_RESTRICT_STRING" ] ; then |
| 632 | echo "INFO: Restricted to $TAG_RESTRICT_STRING" |
| 633 | fi |
| 634 | fi |
| 635 | #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 636 | |
| 637 | ## Display the Output/Log/Failed/HTML file names here |
| 638 | echo -e "LOG File: \c" |
| 639 | echo $LOGFILE | cut -b4- |
| 640 | |
| 641 | if [ "$OUTPUTFILE" ]; then |
| 642 | echo -e "OUTPUT File: \c" |
| 643 | echo $OUTPUTFILE | cut -b4- |
| 644 | fi |
| 645 | |
| 646 | echo -e "FAILED COMMAND File: \c" |
| 647 | echo $FAILCMDFILE | cut -b4- |
| 648 | |
| 649 | if [ "$HTMLFILE" ]; then |
| 650 | echo "HTML File: $HTMLFILE" |
| 651 | fi |
| 652 | |
| 653 | echo "Running tests......." |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 654 | test_start_time=$(date) |
subrata_modak | d48c4d0 | 2008-01-23 12:59:40 +0000 | [diff] [blame] | 655 | ${LTPROOT}/pan/pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE |
| 656 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 657 | if [ $? -eq 0 ]; then |
| 658 | echo "INFO: pan reported all tests PASS" |
| 659 | VALUE=0 |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 660 | export LTP_EXIT_VALUE=0; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 661 | else |
| 662 | echo "INFO: pan reported some tests FAIL" |
| 663 | VALUE=1 |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 664 | export LTP_EXIT_VALUE=1; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 665 | fi |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 666 | echo "LTP Version: $version_date" |
| 667 | |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 668 | if [ "$ALT_HTML_OUT" -eq 1 ] ; then #User wants the HTML output to be created, it then needs to be generated |
| 669 | export LTP_VERSION=$version_date |
| 670 | export TEST_START_TIME=$test_start_time |
| 671 | export TEST_END_TIME=$(date) |
| 672 | OUTPUT_DIRECTORY=`echo $OUTPUTFILE | cut -c4-` |
| 673 | LOGS_DIRECTORY="$LTPROOT/results" |
| 674 | export TEST_OUTPUT_DIRECTORY="$LTPROOT/output" |
| 675 | export TEST_LOGS_DIRECTORY=$LOGS_DIRECTORY |
| 676 | echo "Generating HTML Output.....!!" |
| 677 | ( perl $LTPROOT/tools/genhtml.pl $LTPROOT/tools/html_report_header.txt test_start test_end test_output execution_status $OUTPUT_DIRECTORY > $HTMLFILE; ) |
| 678 | echo "Generated HTML Output.....!!" |
| 679 | echo "Location: $HTMLFILE"; |
| 680 | |
| 681 | fi |
| 682 | |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 683 | if [ "$ALT_EMAIL_OUT" -eq 1 ] ; then ## User wants reports to be e-mailed |
| 684 | if [ [ ! "$HTMLFILE_NAME" ] -o [ ! "$OUTPUTFILE_NAME" ] -o [ ! "$LOGFILE_NAME" ] ] ; then |
| 685 | ##User does not have output/logs/html-output, nothing to be mailed in this situation |
| 686 | echo "Nothing to be mailed here...." |
| 687 | else |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 688 | TAR_FILE_NAME=LTP_RUN_$version_date$DEFAULT_FILE_NAME_GENERATION_TIME.tar |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 689 | if [ "$HTMLFILE_NAME" ] ; then ## HTML file Exists |
| 690 | if [ "$ALT_HTML_OUT" -ne 1 ] ; then ## The HTML file path is absolute and not $LTPROOT/output |
| 691 | mkdir -p $LTPROOT/output ## We need to create this Directory |
| 692 | cp $HTMLFILE_NAME $LTPROOT/output/ |
| 693 | fi |
| 694 | fi |
| 695 | if [ "$OUTPUTFILE_NAME" ] ; then ## Output file exists |
| 696 | if [ "$ALT_DIR_OUT" -ne 1 ] ; then ## The Output file path is absolute and not $LTPROOT/output |
| 697 | mkdir -p $LTPROOT/output ## We need to create this Directory |
| 698 | cp $OUTPUTFILE_NAME $LTPROOT/output/ |
| 699 | fi |
| 700 | fi |
| 701 | if [ "$LOGFILE_NAME" ] ; then ## Log file exists |
| 702 | if [ "$ALT_DIR_RES" -ne 1 ] ; then ## The Log file path is absolute and not $LTPROOT/results |
| 703 | mkdir -p $LTPROOT/results ## We need to create this Directory |
| 704 | cp $LOGFILE_NAME $LTPROOT/results/ |
| 705 | fi |
| 706 | fi |
| 707 | if [ -d $LTPROOT/output ] ; then |
| 708 | tar -cf ./$TAR_FILE_NAME $LTPROOT/output |
| 709 | if [ $? -eq 0 ]; then |
| 710 | echo "Created TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/output" |
| 711 | else |
| 712 | echo "Cannot Create TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/output" |
| 713 | fi |
| 714 | fi |
| 715 | if [ -d $LTPROOT/results ] ; then |
| 716 | tar -uf ./$TAR_FILE_NAME $LTPROOT/results |
| 717 | if [ $? -eq 0 ]; then |
| 718 | echo "Updated TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/results" |
| 719 | else |
| 720 | echo "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/results" |
| 721 | fi |
| 722 | fi |
| 723 | if [ -e $LTPROOT/nohup.out ] ; then ## If User would have Chosen nohup to do ltprun |
| 724 | tar -uf ./$TAR_FILE_NAME $LTPROOT/nohup.out |
| 725 | if [ $? -eq 0 ]; then |
| 726 | echo "Updated TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/nohup.out" |
| 727 | else |
| 728 | echo "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/nohup.out" |
| 729 | fi |
| 730 | fi |
| 731 | gzip ./$TAR_FILE_NAME ## gzip this guy |
| 732 | if [ $? -eq 0 ]; then |
| 733 | echo "Gunzipped TAR File: ./$TAR_FILE_NAME" |
| 734 | else |
| 735 | echo "Cannot Gunzip TAR File: ./$TAR_FILE_NAME" |
| 736 | fi |
| 737 | if [ -e /usr/bin/mutt ] ; then ## This is a better mail client than others |
| 738 | echo "Starting mailing reports to: $EMAIL_TO, file: ./$TAR_FILE_NAME.gz" |
| 739 | mutt -a ./$TAR_FILE_NAME.gz -s "LTP Reports on $test_start_time" $EMAIL_TO < /dev/null |
| 740 | if [ $? -eq 0 ]; then |
| 741 | echo "Reports Successfully mailed to: $EMAIL_TO" |
| 742 | else |
| 743 | echo "Reports cannot be mailed to: $EMAIL_TO" |
| 744 | fi |
| 745 | else ## Use our Ageold mail program |
| 746 | echo "Starting mailing reports to: $EMAIL_TO, file: ./$TAR_FILE_NAME.gz" |
| 747 | uuencode ./$TAR_FILE_NAME.gz $TAR_FILE_NAME.gz | mail $EMAIL_TO -s "LTP Reports on $test_start_time" |
| 748 | if [ $? -eq 0 ]; then |
| 749 | echo "Reports Successfully mailed to: $EMAIL_TO" |
| 750 | else |
| 751 | echo "Reports cannot be mailed to: $EMAIL_TO" |
| 752 | fi |
| 753 | fi |
| 754 | fi |
| 755 | fi |
| 756 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 757 | [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test end time: $(date)" ; } |
| 758 | |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 759 | [ "$GENLOAD" -eq 1 ] && { killall -9 genload >/dev/null 2>&1; } |
| 760 | [ "$NETPIPE" -eq 1 ] && { killall -9 NPtcp >/dev/null 2>&1; } |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 761 | |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 762 | [ "$ALT_DIR_OUT" -eq 1 ] || [ "$ALT_DIR_RES" -eq 1 ] && \ |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 763 | { |
| 764 | cat <<-EOF >&1 |
| 765 | |
| 766 | ###############################################################" |
| 767 | |
| 768 | Done executing testcases." |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 769 | LTP Version: $version_date |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 770 | ###############################################################" |
| 771 | |
| 772 | EOF |
| 773 | } |
| 774 | exit $VALUE |
| 775 | } |
| 776 | |
| 777 | cleanup() |
| 778 | { |
| 779 | rm -rf ${TMP} |
| 780 | } |
| 781 | |
| 782 | trap "cleanup" 0 |
| 783 | setup |
| 784 | main "$@" |