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