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 |
subrata_modak | 14390fd | 2009-05-19 09:39:11 +0000 | [diff] [blame] | 36 | # - exit with error if ltp-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 |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 57 | # - better ways to integrate "ltp/bin/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 |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 65 | # Aug 17 2009 - Modified - Subrata Modak |
| 66 | # - Added Fault Injection generation Capability through -F Option |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 67 | # |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 68 | ################################################################################# |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 69 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 70 | die() |
| 71 | { |
| 72 | error "$*" |
| 73 | exit 1 |
| 74 | } |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 75 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 76 | error() |
| 77 | { |
| 78 | echo "$RUNLTP: ERROR : $*" >&2 |
| 79 | } |
| 80 | |
| 81 | info() |
| 82 | { |
| 83 | [ "x$QUIET_MODE" != x1 ] && echo "$RUNLTP: INFO : $*" |
| 84 | } |
| 85 | |
| 86 | warning() |
| 87 | { |
| 88 | echo "$RUNLTP: WARNING : $*" >&2 |
| 89 | } |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 90 | |
| 91 | setup() |
| 92 | { |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 93 | OLDCWD=$(pwd) |
| 94 | RUNLTP=${0##*/} |
| 95 | export LTPROOT=$(dirname "$0") |
| 96 | if ! cd "$LTPROOT"; then |
| 97 | die "unable to change directory to $LTPROOT" |
| 98 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 99 | export TMPBASE="/tmp" |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 100 | export PATH="$LTPROOT/testcases/bin:$PATH" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 101 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 102 | if [ ! -d "$LTPROOT/testcases/bin" -o ! -x "$LTPROOT/bin/ltp-pan" ] ; then |
| 103 | die "test suite not installed correctly; please read INSTALL" |
| 104 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 105 | } |
| 106 | |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 107 | version_of_ltp() |
| 108 | { |
yaberauneya | ef77253 | 2009-10-09 17:55:43 +0000 | [diff] [blame] | 109 | cat "$LTPROOT/Version" |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 110 | return 0 |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 111 | } |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 112 | |
| 113 | usage() |
| 114 | { |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 115 | cat <<EOF >&2 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 116 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 117 | usage: $RUNLTP [ -a EMAIL_TO ] [ -c NUM_PROCS ] [ -C FAILCMDFILE ] [ -d TMPDIR ] |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 118 | [ -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] | 119 | [ -i NUM_PROCS ] [ -l LOGFILE ] [ -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG ] |
| 120 | -N -n [ -o OUTPUTFILE ] -p -q [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ] |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 121 | -v [ -w CMDFILEADDR ] [ -x INSTANCES ] [ -b DEVICE ] [-B DEVICE_FS_TYPE] |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 122 | [ -F LOOPS,PERCENTAGE ] |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 123 | |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 124 | -a EMAIL_TO EMAIL all your Reports to this E-mail Address |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 125 | -c NUM_PROCS Run LTP under additional background CPU load |
| 126 | [NUM_PROCS = no. of processes creating the CPU Load by spinning over sqrt() |
| 127 | (Defaults to 1 when value)] |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 128 | -C FAILCMDFILE Command file with all failed test cases. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 129 | -d TMPDIR Directory where temporary files will be created. |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 130 | -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG |
| 131 | Run LTP under additional background Load on Secondary Storage (Seperate by comma) |
| 132 | [NUM_PROCS = no. of processes creating Storage Load by spinning over write()] |
| 133 | [NUM_FILES = Write() to these many files (Defaults to 1 when value 0 or undefined)] |
| 134 | [NUM_BYTES = write these many bytes (defaults to 1GB, when value 0 or undefined)] |
| 135 | [CLEAN_FLAG = unlink file to which random data written, when value 1] |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 136 | -e Prints the date of the current LTP release |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 137 | -f CMDFILES Execute user defined list of testcases (separate with ',') |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 138 | -F LOOPS,PERCENTAGE Induce PERCENTAGE Fault in the Kernel Subsystems, and, run each test for LOOPS loop |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 139 | -g HTMLFILE Create an additional HTML output format |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 140 | -h Help. Prints all available options. |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 141 | -i NUM_PROCS Run LTP under additional background Load on IO Bus |
| 142 | [NUM_PROCS = no. of processes creating IO Bus Load by spinning over sync()] |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 143 | -l LOGFILE Log results of test in a logfile. |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 144 | -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG |
| 145 | Run LTP under additional background Load on Main memory (Seperate by comma) |
| 146 | [NUM_PROCS = no. of processes creating main Memory Load by spinning over malloc()] |
| 147 | [CHUNKS = malloc these many chunks (default is 1 when value 0 or undefined)] |
| 148 | [BYTES = malloc CHUNKS of BYTES bytes (default is 256MB when value 0 or undefined) ] |
| 149 | [HANGUP_FLAG = hang in a sleep loop after memory allocated, when value 1] |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 150 | -M CHECK_TYPE |
| 151 | [CHECK_TYPE=1 => Full Memory Leak Check tracing children as well] |
| 152 | [CHECK_TYPE=2 => Thread Concurrency Check tracing children as well] |
| 153 | [CHECK_TYPE=3 => Full Memory Leak & Thread Concurrency Check tracing children as well] |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 154 | -N Run all the networking tests. |
| 155 | -n Run LTP with network traffic in background. |
| 156 | -o OUTPUTFILE Redirect test output to a file. |
| 157 | -p Human readable format logfiles. |
| 158 | -q Print less verbose output to screen. |
| 159 | -r LTPROOT Fully qualified path where testsuite is installed. |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 160 | -s PATTERN Only run test cases which match PATTERN. |
subrata_modak | 2f6c981 | 2009-08-14 17:07:48 +0000 | [diff] [blame] | 161 | -S SKIPFILE Skip tests specified in SKIPFILE |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 162 | -t DURATION Execute the testsuite for given duration. Examples: |
| 163 | -t 60s = 60 seconds |
| 164 | -t 45m = 45 minutes |
| 165 | -t 24h = 24 hours |
| 166 | -t 2d = 2 days |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 167 | -T REPETITION Execute the testsuite for REPETITION no. of times |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 168 | -w CMDFILEADDR Uses wget to get the user's list of testcases. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 169 | -x INSTANCES Run multiple instances of this testsuite. |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 170 | -b DEVICE Some tests require an unmounted block device |
| 171 | to run correctly. |
| 172 | -B DEVICE_FS_TYPE The file system of test block devices. |
| 173 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 174 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 175 | Example: |
| 176 | |
| 177 | $RUNLTP -c 2 -i 2 -m 2,4,10240,1 -D 2,10,10240,1 -p -q \ |
| 178 | -l /tmp/result-log.$$ -o /tmp/result-output.$$ \ |
| 179 | -C /tmp/result-failed.$$ -d $PWD |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 180 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 181 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 182 | EOF |
| 183 | exit 0 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 184 | } |
| 185 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 186 | main() |
| 187 | { |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 188 | local CMDFILES="" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 189 | local PRETTY_PRT="" |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 190 | local ALT_DIR_OUT=0 |
| 191 | local ALT_DIR_RES=0 |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 192 | local ALT_HTML_OUT=0 |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 193 | local ALT_EMAIL_OUT=0 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 194 | local RUN_NETEST=0 |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 195 | local RUN_REPEATED=0 |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 196 | local QUIET_MODE=0 |
| 197 | local PAN_QUIET_MODE="" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 198 | local NETPIPE=0 |
| 199 | local GENLOAD=0 |
| 200 | local MEMSIZE=0 |
| 201 | local DURATION="" |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 202 | local CMDFILEADDR="" |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 203 | local FAILCMDFILE="" |
yaberauneya | ef77253 | 2009-10-09 17:55:43 +0000 | [diff] [blame] | 204 | local INJECT_KERNEL_FAULT="" |
| 205 | local INJECT_KERNEL_FAULT_PERCENTAGE="" |
| 206 | local INJECT_FAULT_LOOPS_PER_TEST="" |
| 207 | local VALGRIND_CHECK="" |
| 208 | local VALGRIND_CHECK_TYPE="" |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 209 | local LOGFILE_NAME="" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 210 | local LOGFILE="" |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 211 | local OUTPUTFILE_NAME="" |
| 212 | local OUTPUTFILE="" |
| 213 | local HTMLFILE_NAME="" |
| 214 | local HTMLFILE="" |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 215 | local EMAIL_TO="" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 216 | local SCENFILES="" |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 217 | local TAG_RESTRICT_STRING="" |
| 218 | local PAN_COMMAND="" |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 219 | local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"` |
yaberauneya | ef77253 | 2009-10-09 17:55:43 +0000 | [diff] [blame] | 220 | version_date=$(cat "$LTPROOT/Version") |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 221 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 222 | while getopts a:c:C:d:D:f:F:ehi:g:l:m:M:Nno:pqr:s:S:t:T:w:x:b:B: arg; do |
| 223 | case "$arg" in |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 224 | a) EMAIL_TO=$OPTARG |
| 225 | ALT_EMAIL_OUT=1;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 226 | c) |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 227 | NUM_PROCS=$(($OPTARG)) |
| 228 | if [ "$NUM_PROCS" -eq 0 ]; then |
| 229 | # User Did not Define the Value ,or, User Defined Zero, |
| 230 | # hence, prevent from creating infinite processes |
| 231 | NUM_PROCS=1 |
| 232 | fi |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 233 | "$LTPROOT/testcases/bin/genload" --cpu $NUM_PROCS >/dev/null 2>&1 & |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 234 | GENLOAD=1 ;; |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 235 | |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 236 | C) |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 237 | case $OPTARG in |
| 238 | /*) |
| 239 | FAILCMDFILE="-C $OPTARG" ;; |
| 240 | *) |
| 241 | FAILCMDFILE="-C $LTPROOT/output/$OPTARG" |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 242 | ALT_DIR_OUT=1 ;; |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 243 | esac ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 244 | |
subrata_modak | 5ee3e89 | 2008-10-21 13:17:56 +0000 | [diff] [blame] | 245 | d) # convert the user path to absolute path. |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 246 | export TMPBASE=$(cd $(dirname "${OPTARG}"); pwd)/$(basename "${OPTARG}") |
| 247 | ;; |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 248 | |
| 249 | D) NUM_PROCS=1; NUM_FILES=1; NUM_BYTES=$((1024 * 1024 * 1024)); CLEAN_FLAG=0 |
subrata_modak | 548379d | 2008-08-20 09:15:49 +0000 | [diff] [blame] | 250 | ARGUMENT_LIST=$OPTARG |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 251 | TOTAL_ARGUMENTS=1 # Initial Assume |
| 252 | for ARGUMENT in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop |
| 253 | do |
| 254 | case $TOTAL_ARGUMENTS in |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 255 | 1) NUM_PROCS="$ARGUMENT" ;; |
| 256 | 2) NUM_FILES="$ARGUMENT" ;; |
| 257 | 3) NUM_BYTES="$ARGUMENT" ;; |
| 258 | 4) CLEAN_FLAG="$ARGUMENT" ;; |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 259 | esac |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 260 | : $((TOTAL_ARGUMENTS += 1)) |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 261 | done |
| 262 | # just to get the default values if the user passed 0 |
| 263 | if [ "$NUM_PROCS" -eq 0 ]; then |
| 264 | NUM_PROCS=1 |
| 265 | fi |
| 266 | if [ "$NUM_FILES" -eq 0 ]; then |
| 267 | NUM_FILES=1 |
| 268 | fi |
| 269 | if [ "$NUM_BYTES" -eq 0 ]; then |
| 270 | NUM_BYTES=$((1024 * 1024 * 1024)) |
| 271 | fi |
| 272 | if [ "$CLEAN_FLAG" -ne 1 ]; then |
| 273 | CLEAN_FLAG=0 |
| 274 | fi |
| 275 | if [ "$CLEAN_FLAG" -eq 1 ]; then |
| 276 | # Do not unlink file in this case |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 277 | "$LTPROOT/testcases/bin/genload" --hdd $NUM_PROCS --hdd-files \ |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 278 | $NUM_FILES --hdd-bytes $NUM_BYTES >/dev/null 2>&1 & |
| 279 | else |
| 280 | # Cleanup otherwise |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 281 | "$LTPROOT/testcases/bin/genload" --hdd $NUM_PROCS --hdd-files \ |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 282 | $NUM_FILES --hdd-bytes $NUM_BYTES --hdd-noclean >/dev/null 2>&1 & |
| 283 | fi |
| 284 | GENLOAD=1;; |
| 285 | |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 286 | e) # Print out the version of LTP |
| 287 | version_of_ltp |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 288 | ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 289 | f) # Execute user defined set of testcases. |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 290 | # Can be more then one file, just separate it with ',', like: |
| 291 | # -f nfs,commands,/tmp/testfile |
| 292 | CMDFILES=$OPTARG;; |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 293 | F) INJECT_KERNEL_FAULT=1 |
| 294 | #Seperate out the NO_OF_LOOPS & FAULT_PERCENTAGE |
| 295 | INJECT_FAULT_LOOPS_PER_TEST=`echo $OPTARG |cut -d',' -f1 | tr -d '\n' | tr -d ' '` |
| 296 | INJECT_KERNEL_FAULT_PERCENTAGE=`echo $OPTARG |cut -d',' -f2 | tr -d '\n' | tr -d ' '` |
| 297 | if [ ! $INJECT_FAULT_LOOPS_PER_TEST ]; then |
| 298 | warning "Loops not properly defined. Defaulting to 5..." |
| 299 | export INJECT_FAULT_LOOPS_PER_TEST=5 |
| 300 | fi |
| 301 | if [ ! $INJECT_KERNEL_FAULT_PERCENTAGE ]; then |
| 302 | warning "Fault percentage not properly defined. Defaulting to 10..." |
| 303 | export INJECT_KERNEL_FAULT_PERCENTAGE=10 |
| 304 | fi;; |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 305 | g) HTMLFILE_NAME="$OPTARG" |
| 306 | case $OPTARG in |
| 307 | /*) |
| 308 | HTMLFILE="$OPTARG";; |
| 309 | *) |
subrata_modak | d48c4d0 | 2008-01-23 12:59:40 +0000 | [diff] [blame] | 310 | HTMLFILE="$LTPROOT/output/$OPTARG";; |
| 311 | esac |
| 312 | ALT_DIR_OUT=1 |
| 313 | ALT_HTML_OUT=1;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 314 | h) usage;; |
| 315 | |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 316 | i) |
| 317 | NUM_PROCS=$(($OPTARG)) |
| 318 | if [ "$NUM_PROCS" -eq 0 ]; then |
| 319 | # User Did not Define the Value ,or, User Defined Zero, |
| 320 | # hence, prevent from creating infinite processes |
| 321 | NUM_PROCS=1 |
| 322 | fi |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 323 | "$LTPROOT/testcases/bin/genload" --io $NUM_PROCS >/dev/null 2>&1 & |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 324 | GENLOAD=1 ;; |
| 325 | |
| 326 | l) |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 327 | LOGFILE_NAME="$OPTARG" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 328 | case $OPTARG in |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 329 | /*) |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 330 | LOGFILE="-l $OPTARG" ;; |
| 331 | *) |
| 332 | LOGFILE="-l $LTPROOT/results/$OPTARG" |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 333 | ALT_DIR_RES=1 ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 334 | esac ;; |
| 335 | |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 336 | m) NUM_PROCS=1; CHUNKS=1; BYTES=$((256 * 1024 * 1024)); HANGUP_FLAG=0 |
subrata_modak | 29a96d8 | 2008-08-27 13:34:46 +0000 | [diff] [blame] | 337 | ARGUMENT_LIST=$OPTARG |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 338 | TOTAL_ARGUMENTS=1 # Initial Assume |
| 339 | for ARGUMENT in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop |
| 340 | do |
| 341 | case $TOTAL_ARGUMENTS in |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 342 | 1) NUM_PROCS="$ARGUMENT" ;; |
| 343 | 2) CHUNKS="$ARGUMENT" ;; |
| 344 | 3) BYTES="$ARGUMENT" ;; |
| 345 | 4) HANGUP_FLAG="$ARGUMENT" ;; |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 346 | esac |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 347 | : $(( TOTAL_ARGUMENTS += 1 )) |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 348 | done |
| 349 | # just to get the default values if the user passed 0 |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 350 | [ "x$NUM_PROCS" = x0 ] && NUM_PROCS=1 |
| 351 | [ "x$CHUNKS" != x0 ] && CHUNKS=1 |
| 352 | [ "x$BYTES" = x0 ] && BYTES=$((256 * 1024 * 1024)) |
| 353 | [ "x$HANGUP_FLAG" != x1 ] && HANGUP_FLAG=0 |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 354 | if [ "$HANGUP_FLAG" -eq 1 ]; then |
| 355 | # Hang in a Sleep loop after memory allocated |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 356 | "$LTPROOT/testcases/bin/genload" --vm $NUM_PROCS --vm-chunks \ |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 357 | $CHUNKS --vm-bytes $BYTES --vm-hang >/dev/null 2>&1 & |
| 358 | else |
| 359 | # Otherwise Do not Hangup |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 360 | "$LTPROOT/testcases/bin/genload" --vm $NUM_PROCS --vm-chunks \ |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 361 | $CHUNKS --vm-bytes $BYTES >/dev/null 2>&1 & |
| 362 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 363 | GENLOAD=1;; |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 364 | M) |
| 365 | VALGRIND_CHECK_TYPE="$OPTARG";; |
subrata_modak | 9c7072a | 2009-08-26 07:00:25 +0000 | [diff] [blame] | 366 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 367 | N) RUN_NETEST=1;; |
| 368 | |
| 369 | n) |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 370 | "$LTPROOT/testcases/bin/netpipe.sh" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 371 | NETPIPE=1;; |
| 372 | |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 373 | o) OUTPUTFILE_NAME="$OPTARG" |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 374 | case $OPTARG in |
| 375 | /*) |
| 376 | OUTPUTFILE="-o $OPTARG";; |
| 377 | *) |
| 378 | OUTPUTFILE="-o $LTPROOT/output/$OPTARG" |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 379 | ALT_DIR_OUT=1 ;; |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 380 | esac |
| 381 | ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 382 | |
| 383 | p) PRETTY_PRT=" -p ";; |
| 384 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 385 | q) |
| 386 | PAN_QUIET_MODE=" -q " |
| 387 | QUIET_MODE=1 |
| 388 | ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 389 | |
| 390 | r) LTPROOT=$OPTARG;; |
| 391 | |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 392 | s) TAG_RESTRICT_STRING=$OPTARG;; |
subrata_modak | 2f6c981 | 2009-08-14 17:07:48 +0000 | [diff] [blame] | 393 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 394 | S) case $OPTARG in |
subrata_modak | 2f6c981 | 2009-08-14 17:07:48 +0000 | [diff] [blame] | 395 | /*) |
| 396 | SKIPFILE=$OPTARG;; |
| 397 | *) |
| 398 | SKIPFILE="$LTPROOT/$OPTARG";; |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 399 | esac |
| 400 | ;; |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 401 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 402 | t) # In case you want to specify the time |
| 403 | # to run from the command line |
| 404 | # (2m = two minutes, 2h = two hours, etc) |
| 405 | DURATION="-t $OPTARG" ;; |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 406 | |
| 407 | T) # In case you want the testcases to runsequentially RUN_REPEATED times |
| 408 | RUN_REPEATED=$OPTARG;; |
| 409 | |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 410 | w) CMDFILEADDR=$OPTARG;; |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 411 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 412 | x) # number of ltp's to run |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 413 | warning "Concurrent invocations of ltp-pan (-x option) can cause" |
| 414 | warning "unpredictable failures, because some tests cannot be run" |
| 415 | warning "in parallel." |
| 416 | warning "Pausing for 10 seconds." |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 417 | sleep 10 |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 418 | INSTANCES="-x $OPTARG" |
| 419 | ;; |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 420 | b) DEVICE=$OPTARG;; |
| 421 | B) DEVICE_FS_TYPE=$OPTARG;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 422 | \?) usage;; |
| 423 | esac |
| 424 | done |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 425 | |
| 426 | ## It would be nice to create a default log file even if the user has not mentioned |
| 427 | if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name |
| 428 | LOGFILE_NAME=$DEFAULT_FILE_NAME_GENERATION_TIME |
| 429 | LOGFILE="-l $LTPROOT/results/LTP_RUN_ON-$LOGFILE_NAME.log" |
| 430 | ALT_DIR_RES=1 |
| 431 | PRETTY_PRT=" -p " |
| 432 | fi |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 433 | |
| 434 | ## It would be nice if a Failed File is compulsorily created (gives User better Idea of Tests that failed) |
| 435 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 436 | ## User didn't request for a failed file to be created. |
| 437 | if [ -n "$FAILCMDFILE" ]; then |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 438 | ALT_DIR_OUT=1 |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 439 | # User didn't request that an output log be created. |
| 440 | if [ -n "$OUTPUTFILE" ]; then |
| 441 | # User didn't request that a log file be created. |
| 442 | if [ -n "$LOGFILE" ]; then |
| 443 | FAILCMDFILE_TAG="$DEFAULT_FILE_NAME_GENERATION_TIME" |
| 444 | # User explicitly requested a log filename. |
| 445 | else |
| 446 | FAILCMDFILE_TAG=${LOGFILE_NAME##*/} |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 447 | fi |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 448 | # User requested for a specific output log filename. |
| 449 | else |
| 450 | FAILCMDFILE_TAG="${OUTPUTFILE_NAME##*/}" |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 451 | fi |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 452 | FAILCMDFILE="-C '$LTPROOT/output/LTP_RUN_ON-${FAILCMDFILE_TAG}.failed'" |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 453 | fi |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 454 | |
subrata_modak | d48c4d0 | 2008-01-23 12:59:40 +0000 | [diff] [blame] | 455 | if [ "$ALT_HTML_OUT" -eq 1 ] ; then ## User wants the HTML version of the output |
subrata_modak | d48c4d0 | 2008-01-23 12:59:40 +0000 | [diff] [blame] | 456 | ## which the HTML parser will require |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 457 | if [ "x$OUTPUTFILE" != x ]; 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] | 458 | OUTPUTFILE_NAME=$DEFAULT_FILE_NAME_GENERATION_TIME |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 459 | OUTPUTFILE="-o $LTPROOT/output/LTP_RUN_ON-$OUTPUTFILE_NAME.output" |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 460 | ALT_DIR_OUT=1 |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 461 | if [ "x$HTMLFILE" != x ] ; then ## User has not mentioned HTML File name, We need to create one |
| 462 | HTMLFILE_NAME=${OUTPUTFILE_NAME##*/} |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 463 | HTMLFILE="$LTPROOT/output/$HTMLFILE_NAME.html" |
| 464 | fi |
| 465 | fi |
| 466 | fi |
| 467 | |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 468 | # If we need, create the output directory |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 469 | if [ "$ALT_DIR_OUT" -eq 1 ] ; then |
| 470 | if ! (test -d "$LTPROOT/output" || mkdir -p "$LTPROOT/output") ; then |
| 471 | die "failed to create $LTPROOT/output" |
| 472 | fi |
| 473 | fi |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 474 | # If we need, create the results directory |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 475 | if [ "$ALT_DIR_RES" -eq 1 ] ; then |
| 476 | if ! (test -d "$LTPROOT/results" || mkdir -p "$LTPROOT/results"); then |
| 477 | die "failed to create $LTPROOT/results" |
| 478 | fi |
| 479 | fi |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 480 | |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 481 | # Added -m 777 for tests that call tst_tmpdir() and try to |
| 482 | # write to it as user nobody |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 483 | if ! mkdir -m 777 -p $TMPBASE ; then |
| 484 | die "unable to make temporary directory $TMPBASE" |
| 485 | fi |
subrata_modak | 5ee3e89 | 2008-10-21 13:17:56 +0000 | [diff] [blame] | 486 | # use mktemp to create "safe" temporary directories |
| 487 | export TMPTEMPLATE="${TMPBASE}/ltp-XXXXXXXXXX" |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 488 | if ! export TMP=$(mktemp -d "$TMPTEMPLATE" 2>&1); then |
| 489 | die "unable to make temp directory: $TMP" |
| 490 | fi |
subrata_modak | 225cfbe | 2009-06-23 14:01:26 +0000 | [diff] [blame] | 491 | # To be invoked by tst_tmpdir() |
| 492 | # write to it as user nobody |
| 493 | export TMPDIR=$TMP |
subrata_modak | 6edfbda | 2008-10-17 12:25:48 +0000 | [diff] [blame] | 494 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 495 | if chmod 777 "$TMP" ; then |
| 496 | die "unable to chmod 777 $TMP ... aborting" |
| 497 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 498 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 499 | if ! cd $TMP ; then |
| 500 | die "could not cd ${TMP} ... exiting" |
| 501 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 502 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 503 | if [ -n $INSTANCES ] ; then |
| 504 | INSTANCES="$INSTANCES -O ${TMP}" |
| 505 | fi |
subrata_modak | 6edfbda | 2008-10-17 12:25:48 +0000 | [diff] [blame] | 506 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 507 | if [ "$RUN_NETEST" -eq 1 ] ; then |
| 508 | |
| 509 | if [ -z "$RHOST" -o -z "$PASSWD" ] ; then |
| 510 | |
| 511 | if [ -z "$RHOST" ] ; then |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 512 | echo \ |
| 513 | "INFO: Enter RHOST = 'name of the remote host machine'" |
| 514 | echo -n "-> " |
| 515 | read RHOST |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 516 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 517 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 518 | if [ -z "$PASSWD" ] ; then |
| 519 | echo |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 520 | echo \ |
| 521 | "INFO: Enter PASSWD = 'root passwd of the remote host machine'" |
| 522 | echo -n "-> " |
| 523 | read PASSWD |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 524 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 525 | export RHOST=$RHOST |
| 526 | export PASSWD=$PASSWD |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 527 | fi |
| 528 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 529 | |
| 530 | # If user does not provide a command file select a default set of testcases |
| 531 | # to execute. |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 532 | if [ -z "$CMDFILES" -a -z "$CMDFILEADDR" ] ; then |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 533 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 534 | info "No command files were provided; executing the following default " |
| 535 | info "test scenario's:" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 536 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 537 | SCENFILES="syscalls fs fsx dio io mm ipc sched math nptl pty containers" |
| 538 | SCENFILES="$SCENFILES fs_bind controllers filecaps cap_bounds" |
| 539 | SCENFILES="$SCENFILES fcntl-locktests connectors admin_tools timers" |
| 540 | SCENFILES="$SCENFILES power_management_tests numa hugetlb commands" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 541 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 542 | case "$(uname -m)" in |
| 543 | *86*) |
| 544 | # No sense in even trying to run hyperthreading tests if it |
| 545 | # isn't an Intel platform. |
| 546 | SCENFILES="$SCENFILES hyperthreading" |
| 547 | ;; |
| 548 | esac |
| 549 | |
| 550 | info "No command files were provided; executing the following default " |
| 551 | info "test scenario's:" |
| 552 | if [ "x$QUIET_MODE" != x1 ] ; then |
| 553 | for SCENARIO in $SCENFILES; do |
| 554 | echo " $SCENARIO" |
| 555 | done |
| 556 | fi |
| 557 | |
| 558 | elif [ "x$CMDFILEADDR" = x ] ; then |
| 559 | SCENFILES=$(echo "$CMDFILES" | awk 'BEGIN { RS=","; } { print }') |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 560 | fi |
| 561 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 562 | if [ "x$SCENFILES" != x ] ; then |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 563 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 564 | for SCENARIO in "$SCENFILES"; do |
| 565 | |
| 566 | # Most likely not an absolute path. |
| 567 | if [ ! -f "$SCENARIO" ] ; then |
| 568 | # Relative path from $OLDCWD. |
| 569 | if [ -f "$OLDCWD/$SCENFILES" ] ; then |
| 570 | SCENFILE="$OLDCWD/$SCENARIO" |
| 571 | # Let's assume it's just a runtest filename -- we'll figure |
| 572 | # out whether or not this assumption is correct in a |
| 573 | # second ;)... |
| 574 | else |
| 575 | SCENFILE="$LTPROOT/runtest/$SCENARIO" |
| 576 | fi |
| 577 | fi |
| 578 | # Print out a user readable message that makes sense, because the |
| 579 | # `unable to create command file' one isn't helpful in this regard |
| 580 | # if the file doesn't exist... |
| 581 | if [ ! -f "$SCENFILE" ] ; then |
| 582 | die "scenario file - $SCENFILE - doesn't exist." |
| 583 | elif ! cat "$SCENFILE" >> "$TMP/alltests"; then |
| 584 | die "unable add $SCENFILE to command file \`$TMP/alltests'" |
| 585 | fi |
| 586 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 587 | done |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 588 | |
| 589 | elif [ "x$CMDFILEADDR" != x ] ; then |
| 590 | if ! type wget >/dev/null; then |
| 591 | die "You must have wget to get $CMDFILEADDR" |
| 592 | elif wget -q "$CMDFILEADDR" -O "$TMP/wgetcmdfile" ; then |
| 593 | die "the file transfer with wget failed (address $CMDFILEADDR)" |
| 594 | elif ! cat "$TMP/wgetcmdfile" >> "$TMP/alltests" ; then |
| 595 | die "unable to add scenario - $SCENFILE - to the command file" |
| 596 | fi |
| 597 | fi |
| 598 | |
| 599 | if [ "$RUN_NETEST" -eq 1 ] ; then |
| 600 | |
| 601 | for SCENARIO in tcp_cmds multicast rpc nfs ; do |
| 602 | |
| 603 | SCENFILE="$LTPROOT/runtest/$SCENARIO" |
| 604 | if [ ! -e "$SCENFILE" ] ; then |
| 605 | die "missing scenario file: $SCENFILE" |
| 606 | fi |
| 607 | |
| 608 | if ! cat "$SCENFILE" >> ${TMP}/alltests ; then |
| 609 | die "unable to add scenario - $SCENFILE - to $TMP/alltests" |
| 610 | fi |
| 611 | |
| 612 | done |
| 613 | |
| 614 | fi |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 615 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 616 | # The fsx-linux tests use the SCRATCHDEV environment variable as a location |
| 617 | # that can be reformatted and run on. Set SCRATCHDEV if you want to run |
| 618 | # these tests. As a safeguard, this is disabled. |
| 619 | unset SCRATCHDEV |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 620 | if [ "x$SCRATCHDEV" != x ] ; then |
| 621 | if ! cat "$LTPROOT/runtest/fsx" >> "$TMP/alltests"; then |
| 622 | die "unable to create fsx-linux tests command file: $TMP/alltests" |
| 623 | fi |
| 624 | fi |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 625 | |
| 626 | # If enabled, execute only test cases that match the PATTERN |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 627 | if [ -n "$TAG_RESTRICT_STRING" ]; then |
| 628 | mv -f "$TMP/alltests" "$TMP/alltests.orig" |
| 629 | # Filter out all non-restricted tags. |
| 630 | grep "$TAG_RESTRICT_STRING" "$TMP/alltests.orig" > "$TMP/alltests" |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 631 | fi |
subrata_modak | 2f6c981 | 2009-08-14 17:07:48 +0000 | [diff] [blame] | 632 | |
| 633 | # Blacklist or skip tests if a SKIPFILE was specified with -S |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 634 | if [ -n "$SKIPFILE" ]; then |
subrata_modak | 2f6c981 | 2009-08-14 17:07:48 +0000 | [diff] [blame] | 635 | for file in $( cat $SKIPFILE ); do |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 636 | sed -i "/$file/d" "${TMP}/alltests" |
subrata_modak | 2f6c981 | 2009-08-14 17:07:48 +0000 | [diff] [blame] | 637 | done |
| 638 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 639 | |
| 640 | # check for required users and groups |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 641 | if "$LTPROOT/IDcheck.sh" &>/dev/null ; then |
| 642 | warning "missing some required users and/or groups; some testcases will fail" |
| 643 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 644 | # display versions of installed software |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 645 | if [ -z "$QUIET_MODE" ] ; then |
| 646 | if ! "$LTPROOT/ver_linux" ; then |
| 647 | die "unable to display versions of software installed" |
| 648 | fi |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 649 | fi |
| 650 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 651 | if [ "x$DEVICE" != x ]; then |
| 652 | if ! sed -i "s|DEVICE|$DEVICE|" "$TMP/alltests" ; then |
| 653 | die "the sed operation on alltests failed (DEVICE)" |
| 654 | elif ! mnt_pnt=$(mktemp -d --tmpdir=${TMP} mnt_pnt.XXXXXX); then |
| 655 | die "Failed to create a temporary mountpoint" |
| 656 | fi |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 657 | if [ -n "$DEVICE_FS_TYPE" ]; then |
| 658 | mount -t $DEVICE_FS_TYPE $DEVICE $mnt_pnt |
| 659 | else |
| 660 | mount $DEVICE $mnt_pnt |
| 661 | fi |
| 662 | |
| 663 | if [ $? -ne 0 ]; then |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 664 | die "can't mount block device $DEVICE." |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 665 | fi |
| 666 | |
| 667 | if [ -z "$DEVICE_FS_TYPE" ]; then |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 668 | DEVICE_FS_TYPE=$(awk "{if (\\\$1 == \"$DEVICE\") print \\\$3; }" /proc/mounts) |
| 669 | info "determining the file system $DEVICE_FS_TYPE on block device $DEVICE" |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 670 | fi |
| 671 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 672 | if ! umount $DEVICE; then |
| 673 | die "can't umount $DEVICE" |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 674 | fi |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 675 | else |
| 676 | info "removing testcases which require block devices." |
| 677 | if ! sed -i "/DEVICE/d" "$TMP/alltests"; then |
| 678 | die "the sed operation on alltests failed (DEVICE)" |
| 679 | fi |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 680 | fi |
| 681 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 682 | if [ "x$DEVICE_FS_TYPE" != x ]; then |
| 683 | if ! sed -i "s|DEVICE_FS_TYPE|$DEVICE_FS_TYPE|" "$TMP/alltests" ; then |
| 684 | die "the sed operation on alltests failed (DEVICE_FS_TYPE)" |
| 685 | fi |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 686 | fi |
| 687 | |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 688 | if [ $RUN_REPEATED -gt 1 ]; then # You need to specify at least more than 1 sequential run, else it runs default |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 689 | info "PAN will run these test cases $RUN_REPEATED times." |
| 690 | info "Test Tags will be prefixed with iteration" |
| 691 | inc=1 |
| 692 | ## Remove all whitespace. |
| 693 | sed -e '/^$/ d' -e 's/^[ ,\t]*//' -e '/^#/ d' < "$TMP/alltests" > "$TMP/alltests.temp" |
| 694 | ## .temp is the baseline file |
| 695 | sed 's/^[0-9,a-z,A-Z]*/'"$inc"'_ITERATION_&/' < "$TMP/alltests.temp" > "$TMP/alltests" |
| 696 | while [ $inc -lt $RUN_REPEATED ] ; do |
| 697 | : $(( inc += 1 )) |
| 698 | # Append the iteration number. |
| 699 | sed 's/^[0-9,a-z,A-Z]*/'"$inc"'_ITERATION_&/' < "$TMP/alltests.temp" >> "$TMP/alltests" |
| 700 | done |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 701 | fi |
| 702 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 703 | info "Test start time: $(date)" |
| 704 | PAN_COMMAND="\"${LTPROOT}/bin/ltp-pan\" $PAN_QUIET_MODE -e -S $INSTANCES" |
| 705 | PAN_COMMAND="$PAN_COMMAND $DURATION -a $$ -n $$ $PRETTY_PRT" |
| 706 | PAN_COMMAND="$PAN_COMMAND -f \"$TMP/alltests\" $LOGFILE $OUTPUTFILE " |
| 707 | PAN_COMMAND="$PAN_COMMAND $FAILCMDFILE" |
| 708 | info "COMMAND: $PAN_COMMAND" |
| 709 | if [ -n "$TAG_RESTRICT_STRING" ] ; then |
| 710 | info "Restricting testcase tags to: $TAG_RESTRICT_STRING" |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 711 | fi |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 712 | |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 713 | ## Display the Output/Log/Failed/HTML file names here |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 714 | info "LOG File: $(cut -b4- < "$LOGFILE")" |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 715 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 716 | [ -n "$OUTPUTFILE" ] && info "OUTPUT File: $(cut -b4- < "$OUTPUTFILE")" |
| 717 | info "FAILED COMMAND File: $(cut -b4- < "$FAILCMDFILE")" |
| 718 | |
| 719 | [ -n "$HTMLFILE" ] && info "HTML File: $HTMLFILE" |
| 720 | |
| 721 | # User wants testing with Kernel Fault Injection |
| 722 | if [ "x$INJECT_KERNEL_FAULT" = x1 ] ; then |
| 723 | #See if Debugfs is mounted, and |
| 724 | #Fault Injection Framework available through Debugfs |
| 725 | if [ -d "/sys/kernel/debug/fail_io_timeout" -o \ |
| 726 | -d "/sys/kernel/debug/fail_make_request" -o \ |
| 727 | -d "/sys/kernel/debug/fail_page_alloc" -o \ |
| 728 | -d "/sys/kernel/debug/failslab" ]; then |
| 729 | # If atleast one of the Framework is available |
| 730 | # Go ahead to Inject Fault & Create required |
| 731 | # Command Files for LTP run |
| 732 | info "Running tests with Fault Injection Enabled in the Kernel..." |
| 733 | "${LTPROOT}/bin/create_kernel_faults_in_loops_and_probability.pl"\ |
| 734 | "${TMP}/alltests" $INJECT_FAULT_LOOPS_PER_TEST \ |
| 735 | $INJECT_KERNEL_FAULT_PERCENTAGE > "${TMP}/alltests.tmp" |
| 736 | cp "${TMP}/alltests.tmp" "${TMP}/alltests" |
| 737 | rm -f "${TMP}/alltests.tmp" |
| 738 | else |
| 739 | warning "Fault injection not enabled in the kernel; will run" |
| 740 | warning "testcases normally." |
| 741 | fi |
| 742 | ## Valgrind Check will work only when Kernel Fault Injection is not expected, |
| 743 | ## We do not want to test Faults when valgrind is running |
| 744 | elif [ "x$VALGRIND_CHECK_TYPE" = x1 ]; then |
| 745 | if ! type valgrind 2>/dev/null ; then |
| 746 | error "valgrind isn't available" |
| 747 | else |
| 748 | case "$VALGRIND_CHECK_TYPE" in |
| 749 | [1-3]) |
| 750 | "${LTPROOT}/bin/create_valgrind_check.pl" "$TMP/alltests" \ |
| 751 | $VALGRIND_CHECK_TYPE > "$TMP/alltests.tmp" |
| 752 | cp "$TMP/alltests.tmp" "$TMP/alltests" |
| 753 | rm -rf "$TMP/alltests.tmp" |
| 754 | ;; |
| 755 | *) |
| 756 | error "Invalid valgrind memory check type: $VALGRIND_CHECK_TYPE.";; |
| 757 | esac |
| 758 | fi |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 759 | fi |
| 760 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 761 | info "Running tests......." |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 762 | test_start_time=$(date) |
subrata_modak | 724098e | 2009-03-19 08:49:18 +0000 | [diff] [blame] | 763 | |
| 764 | # Some tests need to run inside the "bin" directory. |
| 765 | cd "${LTPROOT}/testcases/bin" |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 766 | "${PAN_COMMAND}" |
| 767 | #"${LTPROOT}/bin/ltp-pan" $PAN_QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \ |
| 768 | # -n $$ $PRETTY_PRT -f "$TMP/alltests" "$LOGFILE" "$OUTPUTFILE" \ |
| 769 | # "$FAILCMDFILE" |
subrata_modak | d48c4d0 | 2008-01-23 12:59:40 +0000 | [diff] [blame] | 770 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 771 | if [ $? -eq 0 ]; then |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 772 | info "ltp-pan reported all tests PASS'ed" |
| 773 | LTP_EXIT_VALUE=0 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 774 | else |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 775 | info "ltp-pan reported some tests FAIL'ed" |
| 776 | LTP_EXIT_VALUE=1 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 777 | fi |
subrata_modak | 724098e | 2009-03-19 08:49:18 +0000 | [diff] [blame] | 778 | cd .. |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 779 | info "LTP Version: $version_date" |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 780 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 781 | # Punt out |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 782 | if [ "$ALT_HTML_OUT" -eq 1 ] ; then #User wants the HTML output to be created, it then needs to be generated |
| 783 | export LTP_VERSION=$version_date |
| 784 | export TEST_START_TIME=$test_start_time |
| 785 | export TEST_END_TIME=$(date) |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 786 | OUTPUT_DIRECTORY=$(cut -c4- < "$OUTPUTFILE") |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 787 | LOGS_DIRECTORY="$LTPROOT/results" |
| 788 | export TEST_OUTPUT_DIRECTORY="$LTPROOT/output" |
| 789 | export TEST_LOGS_DIRECTORY=$LOGS_DIRECTORY |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 790 | info "Generating HTML Output.....!!" |
| 791 | ( perl $LTPROOT/bin/genhtml.pl $LTPROOT/bin/html_report_header.txt \ |
| 792 | test_start test_end test_output execution_status \ |
| 793 | "$OUTPUT_DIRECTORY" > "$HTMLFILE" ) |
| 794 | info "Generated HTML Output.....!!" |
| 795 | info "Location: $HTMLFILE" |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 796 | fi |
| 797 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 798 | # Send email report |
| 799 | if [ "$ALT_EMAIL_OUT" -eq 1 ] ; then |
| 800 | |
| 801 | if [ ! -r "$HTMLFILE_NAME" -a ! -r "$OUTPUTFILE_NAME" -a ! -r "$LOGFILE_NAME" ] ; then |
| 802 | ## User does not have output/logs/html-output, nothing to be |
| 803 | ## mailed in this situation |
| 804 | info "Nothing to be mailed" |
| 805 | elif ! MUTT=$(which mutt 2>/dev/null) && ! MAIL=$(which mail 2>/dev/null) ; then |
| 806 | error "********************************************" |
| 807 | error "Cannot find a working copy of mail or mutt." |
| 808 | error "Will not email report." |
| 809 | error "********************************************" |
| 810 | elif ! type gzip 2>/dev/null; then |
| 811 | error "********************************************" |
| 812 | error "Cannot find a working copy of gzip" |
| 813 | error "Will not email report." |
| 814 | error "********************************************" |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 815 | else |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 816 | |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 817 | TAR_FILE_NAME=LTP_RUN_$version_date$DEFAULT_FILE_NAME_GENERATION_TIME.tar |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 818 | |
| 819 | # Got HTML file. |
| 820 | for f in "$HTMLFILE_NAME" "$OUTPUTFILE_NAME" ; do |
| 821 | |
| 822 | if [ -r "$f" -a "$(readlink -f "$(dirname "$f")")" != "$(readlink -f "$LTPROOT/output")" ] ; then |
| 823 | |
| 824 | test -d "$LTPROOT/output" || mkdir -p "$LTPROOT/output" |
| 825 | if [ $? -eq 0 ] ; then |
| 826 | cp $HTMLFILE_NAME "$LTPROOT/output/." |
| 827 | else |
| 828 | error "Failed to create \`$LTPROOT/output/'." |
| 829 | error "Skipping tar for all files in $LTPROOT/output/." |
| 830 | fi |
| 831 | |
| 832 | fi |
| 833 | |
| 834 | done |
| 835 | |
| 836 | if [ -r "$LOGFILE_NAME" -a "$(readlink -f "$(dirname "$LOGFILE_NAME")")" != "$(readlink -f "$LTPROOT/results")" ] ; then |
| 837 | test -d mkdir -p "$LTPROOT/results" ## We need to create this Directory |
| 838 | cp "$LOGFILE_NAME" "$LTPROOT/results/." |
| 839 | fi |
| 840 | test -d "$LTPROOT/output" || mkdir -p "$LTPROOT/output" |
| 841 | if [ $? -eq 0 ] ; then |
| 842 | cp "$LOGFILE_NAME" "$LTPROOT/results/." |
| 843 | else |
| 844 | error "Failed to create \`$LTPROOT/results/'." |
| 845 | error "Skipping tar for all files in $LTPROOT/results/." |
| 846 | fi |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 847 | fi |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 848 | # Got output log(s) |
| 849 | if [ -d "$LTPROOT/output" ] ; then |
| 850 | if tar -cf "./$TAR_FILE_NAME" "$LTPROOT/output"; then |
| 851 | info "Created TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/output" |
| 852 | else |
| 853 | error "Cannot Create TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/output" |
| 854 | fi |
| 855 | fi # END: output log(s) |
| 856 | # Got results file(s) |
| 857 | if [ -d "$LTPROOT/results" ] ; then |
| 858 | if tar -uf "./$TAR_FILE_NAME" "$LTPROOT/results"; then |
| 859 | info "Updated TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/results" |
| 860 | else |
| 861 | error "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/results" |
| 862 | fi |
| 863 | fi # END: results file(s) |
| 864 | if [ -e "$LTPROOT/nohup.out" ] ; then |
| 865 | if tar -uf "./$TAR_FILE_NAME" "$LTPROOT/nohup.out"; then |
| 866 | info "Updated TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/nohup.out" |
| 867 | else |
| 868 | error "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/nohup.out" |
| 869 | fi |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 870 | fi |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 871 | if gzip "./$TAR_FILE_NAME"; then |
| 872 | |
| 873 | info "Gunzipped TAR File: ./$TAR_FILE_NAME" |
| 874 | |
| 875 | # Use mutt(1) |
| 876 | if [ -n "$MUTT" ] ; then |
| 877 | info "Starting mailing reports to: $EMAIL_TO, file: ./$TAR_FILE_NAME.gz" |
| 878 | mutt -a ./$TAR_FILE_NAME.gz -s "LTP Reports on $test_start_time" $EMAIL_TO < /dev/null |
| 879 | if [ $? -eq 0 ]; then |
| 880 | info "Reports Successfully mailed to: $EMAIL_TO" |
| 881 | else |
| 882 | error "Email operation failed" |
| 883 | fi |
| 884 | # Use mail(1) |
| 885 | elif [ -n "$MAIL" ] ; then |
| 886 | echo "Starting mailing reports to: $EMAIL_TO, file: ./$TAR_FILE_NAME.gz" |
| 887 | uuencode ./$TAR_FILE_NAME.gz $TAR_FILE_NAME.gz | mail $EMAIL_TO -s "LTP Reports on $test_start_time" |
| 888 | if [ $? -eq 0 ]; then |
| 889 | info "Reports Successfully mailed to: $EMAIL_TO" |
| 890 | else |
| 891 | error "Email operation failed" |
| 892 | fi |
| 893 | |
| 894 | else |
| 895 | die "Programmer error; please report bug (\$MAIL and \$MUTT were both zero-length strings)." |
| 896 | fi # END: Send email via client mail or mutt. |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 897 | else |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 898 | error "Cannot Gunzip TAR File: ./$TAR_FILE_NAME" |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 899 | fi |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 900 | |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 901 | fi |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 902 | # END: Got something to email? // got a client to email with? // |
| 903 | # got gzip? // send report. |
| 904 | |
| 905 | fi # END: Send email report? |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 906 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 907 | info "Test end time: $(date)" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 908 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 909 | [ "x$GENLOAD" = x1 ] && (killall -9 genload >/dev/null 2>&1) |
| 910 | [ "x$NETPIPE" = x1 ] && (killall -9 NPtcp >/dev/null 2>&1) |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 911 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 912 | if [ "x$ALT_DIR_OUT" = x1 -o "x$ALT_DIR_RES" = x1 ] ; then |
| 913 | cat <<-EOF |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 914 | |
| 915 | ###############################################################" |
| 916 | |
| 917 | Done executing testcases." |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 918 | LTP Version: $version_date |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 919 | ###############################################################" |
| 920 | |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 921 | EOF |
| 922 | fi |
| 923 | exit $LTP_EXIT_VALUE |
| 924 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 925 | } |
| 926 | |
| 927 | cleanup() |
| 928 | { |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 929 | rm -rf "${TMP}" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 930 | } |
| 931 | |
| 932 | trap "cleanup" 0 |
| 933 | setup |
| 934 | main "$@" |