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 ## |
Wanlong Gao | 4548c6c | 2012-10-19 18:03:36 +0800 | [diff] [blame] | 18 | ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 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 |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 27 | # |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 28 | # History: Oct 07 2003 - Modified - Manoj Iyer |
| 29 | # - use functions |
| 30 | # - clean up on script exit |
| 31 | # - error checking etc. |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 32 | # |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 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 | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 57 | # - better ways to integrate "ltp/tools/genload/stress" with "ltp/runltp" |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 58 | # Nov 24 2007 - Modified - Subrata Modak |
| 59 | # - Added a new option to generate output in HTML format also. Also retaining |
| 60 | # the original test format |
subrata_modak | f376b48 | 2007-11-28 11:30:54 +0000 | [diff] [blame] | 61 | # Nov 28 2007 - Modified - Subrata Modak |
| 62 | # - Added a new option to mail back LTP reports |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 63 | # May 19 2008 - Modified - Subrata Modak |
| 64 | # - Added capability for default Log file generation |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +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 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 70 | |
| 71 | |
| 72 | setup() |
| 73 | { |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 74 | cd `dirname $0` || \ |
| 75 | { |
| 76 | echo "FATAL: unable to change directory to $(dirname $0)" |
| 77 | exit 1 |
| 78 | } |
| 79 | export LTPROOT=${PWD} |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 80 | export TMPBASE="/tmp" |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 81 | export PATH="${PATH}:${LTPROOT}/testcases/bin" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 82 | |
Xiaoguang Wang | 5b42a1e | 2013-12-12 19:10:58 +0800 | [diff] [blame] | 83 | export LTP_DEV_FS_TYPE="ext2" |
Xiaoguang Wang | 5b42a1e | 2013-12-12 19:10:58 +0800 | [diff] [blame] | 84 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 85 | [ -d "$LTPROOT/testcases/bin" ] || |
| 86 | { |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 87 | echo "FATAL: LTP not installed correctly" |
| 88 | echo "INFO: Follow directions in INSTALL!" |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 89 | exit 1 |
| 90 | } |
| 91 | |
| 92 | [ -e "$LTPROOT/bin/ltp-pan" ] || |
| 93 | { |
| 94 | echo "FATAL: Test suite driver 'ltp-pan' not found" |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 95 | echo "INFO: Follow directions in INSTALL!" |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 96 | exit 1 |
| 97 | } |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 98 | } |
| 99 | |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 100 | version_of_ltp() |
| 101 | { |
yaberauneya | ef77253 | 2009-10-09 17:55:43 +0000 | [diff] [blame] | 102 | cat "$LTPROOT/Version" |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 103 | exit 0 |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 104 | } |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 105 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 106 | usage() |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 107 | { |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 108 | cat <<-EOF >&2 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 109 | |
Xiaoguang Wang | 5f71cf9 | 2014-09-23 15:59:43 +0800 | [diff] [blame] | 110 | usage: ${0##*/} [ -a EMAIL_TO ] [ -c NUM_PROCS ] [ -C FAILCMDFILE ] [ -T TCONFCMDFILE ] |
| 111 | [ -d TMPDIR ] [ -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG ] -e [ -f CMDFILES(,...) ] |
| 112 | [ -g HTMLFILE] [ -i NUM_PROCS ] [ -l LOGFILE ] [ -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG ] |
Petr Vorel | 8283520 | 2017-08-22 15:33:47 +0200 | [diff] [blame] | 113 | -N -n [ -o OUTPUTFILE ] -p -q -Q [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ] |
Xiaoguang Wang | 5b42a1e | 2013-12-12 19:10:58 +0800 | [diff] [blame] | 114 | -v [ -w CMDFILEADDR ] [ -x INSTANCES ] [ -b DEVICE ] [-B LTP_DEV_FS_TYPE] |
| 115 | [ -F LOOPS,PERCENTAGE ] [ -z BIG_DEVICE ] [-Z LTP_BIG_DEV_FS_TYPE] |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 116 | |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 117 | -a EMAIL_TO EMAIL all your Reports to this E-mail Address |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 118 | -c NUM_PROCS Run LTP under additional background CPU load |
| 119 | [NUM_PROCS = no. of processes creating the CPU Load by spinning over sqrt() |
| 120 | (Defaults to 1 when value)] |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 121 | -C FAILCMDFILE Command file with all failed test cases. |
Xiaoguang Wang | 5f71cf9 | 2014-09-23 15:59:43 +0800 | [diff] [blame] | 122 | -T TCONFCMDFILE Command file with all test cases that are not fully tested. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 123 | -d TMPDIR Directory where temporary files will be created. |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 124 | -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG |
| 125 | Run LTP under additional background Load on Secondary Storage (Seperate by comma) |
| 126 | [NUM_PROCS = no. of processes creating Storage Load by spinning over write()] |
| 127 | [NUM_FILES = Write() to these many files (Defaults to 1 when value 0 or undefined)] |
| 128 | [NUM_BYTES = write these many bytes (defaults to 1GB, when value 0 or undefined)] |
| 129 | [CLEAN_FLAG = unlink file to which random data written, when value 1] |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 130 | -e Prints the date of the current LTP release |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 131 | -f CMDFILES Execute user defined list of testcases (separate with ',') |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 132 | -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] | 133 | -g HTMLFILE Create an additional HTML output format |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 134 | -h Help. Prints all available options. |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 135 | -i NUM_PROCS Run LTP under additional background Load on IO Bus |
| 136 | [NUM_PROCS = no. of processes creating IO Bus Load by spinning over sync()] |
Subrata Modak | bd9d440 | 2010-05-12 22:03:21 +0530 | [diff] [blame] | 137 | -K DMESG_LOG_DIR |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 138 | Log Kernel messages generated for each test cases inside this directory |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 139 | -l LOGFILE Log results of test in a logfile. |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 140 | -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG |
| 141 | Run LTP under additional background Load on Main memory (Seperate by comma) |
| 142 | [NUM_PROCS = no. of processes creating main Memory Load by spinning over malloc()] |
| 143 | [CHUNKS = malloc these many chunks (default is 1 when value 0 or undefined)] |
| 144 | [BYTES = malloc CHUNKS of BYTES bytes (default is 256MB when value 0 or undefined) ] |
| 145 | [HANGUP_FLAG = hang in a sleep loop after memory allocated, when value 1] |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 146 | -M CHECK_TYPE |
| 147 | [CHECK_TYPE=1 => Full Memory Leak Check tracing children as well] |
| 148 | [CHECK_TYPE=2 => Thread Concurrency Check tracing children as well] |
| 149 | [CHECK_TYPE=3 => Full Memory Leak & Thread Concurrency Check tracing children as well] |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 150 | -N Run all the networking tests. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 151 | -n Run LTP with network traffic in background. |
| 152 | -o OUTPUTFILE Redirect test output to a file. |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 153 | -p Human readable format logfiles. |
Petr Vorel | 8283520 | 2017-08-22 15:33:47 +0200 | [diff] [blame] | 154 | -q Print less verbose output to screen. This implies |
| 155 | not logging start of the test in kernel log. |
| 156 | -Q Don't log start of test in kernel log. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 157 | -r LTPROOT Fully qualified path where testsuite is installed. |
Zorro Lang | 8aa2102 | 2016-09-26 21:19:49 +0800 | [diff] [blame] | 158 | -R Randomize test order. |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 159 | -s PATTERN Only run test cases which match PATTERN. |
subrata_modak | 2f6c981 | 2009-08-14 17:07:48 +0000 | [diff] [blame] | 160 | -S SKIPFILE Skip tests specified in SKIPFILE |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 161 | -t DURATION Execute the testsuite for given duration. Examples: |
| 162 | -t 60s = 60 seconds |
| 163 | -t 45m = 45 minutes |
| 164 | -t 24h = 24 hours |
| 165 | -t 2d = 2 days |
Cyril Hrubis | 5f79570 | 2016-04-26 14:45:57 +0200 | [diff] [blame] | 166 | -I ITERATIONS Execute the testsuite ITERATIONS times. |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 167 | -w CMDFILEADDR Uses wget to get the user's list of testcases. |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 168 | -x INSTANCES Run multiple instances of this testsuite. |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 169 | -b DEVICE Some tests require an unmounted block device |
| 170 | to run correctly. |
Xiaoguang Wang | 5b42a1e | 2013-12-12 19:10:58 +0800 | [diff] [blame] | 171 | -B LTP_DEV_FS_TYPE The file system of test block devices. |
| 172 | -z BIG_DEVICE Some tests require a big unmounted block device |
| 173 | to run correctly. |
| 174 | -Z LTP_BIG_DEV_FS_TYPE The file system of the big device |
| 175 | |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 176 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 177 | |
Garrett Cooper | f95875a | 2010-03-05 02:44:39 -0800 | [diff] [blame] | 178 | 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] | 179 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 180 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 181 | EOF |
| 182 | exit 0 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 183 | } |
| 184 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 185 | main() |
| 186 | { |
Petr Vorel | 8283520 | 2017-08-22 15:33:47 +0200 | [diff] [blame] | 187 | local CMDFILES= |
| 188 | local PRETTY_PRT= |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 189 | local ALT_DIR_OUT=0 |
| 190 | local ALT_DIR_RES=0 |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 191 | local ALT_HTML_OUT=0 |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 192 | local ALT_EMAIL_OUT=0 |
Subrata Modak | bd9d440 | 2010-05-12 22:03:21 +0530 | [diff] [blame] | 193 | local ALT_DMESG_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 |
Petr Vorel | 8283520 | 2017-08-22 15:33:47 +0200 | [diff] [blame] | 196 | local QUIET_MODE= |
| 197 | local NO_KMSG= |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 198 | local NETPIPE=0 |
| 199 | local GENLOAD=0 |
| 200 | local MEMSIZE=0 |
Petr Vorel | 8283520 | 2017-08-22 15:33:47 +0200 | [diff] [blame] | 201 | local DURATION= |
| 202 | local CMDFILEADDR= |
| 203 | local FAILCMDFILE= |
| 204 | local TCONFCMDFILE= |
| 205 | local INJECT_KERNEL_FAULT= |
| 206 | local INJECT_KERNEL_FAULT_PERCENTAGE= |
| 207 | local INJECT_FAULT_LOOPS_PER_TEST= |
| 208 | local VALGRIND_CHECK= |
| 209 | local VALGRIND_CHECK_TYPE= |
| 210 | local LOGFILE_NAME= |
| 211 | local LOGFILE= |
| 212 | local OUTPUTFILE_NAME= |
| 213 | local OUTPUTFILE= |
| 214 | local HTMLFILE_NAME= |
| 215 | local HTMLFILE= |
| 216 | local DMESG_DIR= |
| 217 | local EMAIL_TO= |
| 218 | local TAG_RESTRICT_STRING= |
| 219 | local PAN_COMMAND= |
Zorro Lang | 8aa2102 | 2016-09-26 21:19:49 +0800 | [diff] [blame] | 220 | local RANDOMRUN=0 |
look | 69f39f5 | 2014-04-30 09:55:44 +0800 | [diff] [blame] | 221 | local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%m_%d-%Hh_%Mm_%Ss"` |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 222 | local scenfile= |
| 223 | |
yaberauneya | ef77253 | 2009-10-09 17:55:43 +0000 | [diff] [blame] | 224 | version_date=$(cat "$LTPROOT/Version") |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 225 | |
Petr Vorel | 8283520 | 2017-08-22 15:33:47 +0200 | [diff] [blame] | 226 | while getopts a:b:B:c:C:T:d:D:ef:F:g:hi:I:K:l:m:M:No:pqQr:Rs:S:t:T:w:x:z:Z: arg |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 227 | do case $arg in |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 228 | a) EMAIL_TO=$OPTARG |
| 229 | ALT_EMAIL_OUT=1;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 230 | c) |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 231 | NUM_PROCS=$(($OPTARG)) |
| 232 | if [ "$NUM_PROCS" -eq 0 ]; then |
| 233 | # User Did not Define the Value ,or, User Defined Zero, |
| 234 | # hence, prevent from creating infinite processes |
| 235 | NUM_PROCS=1 |
| 236 | fi |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 237 | $LTPROOT/testcases/bin/genload --cpu $NUM_PROCS >/dev/null 2>&1 & |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 238 | GENLOAD=1 ;; |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 239 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 240 | C) |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 241 | case $OPTARG in |
| 242 | /*) |
| 243 | FAILCMDFILE="-C $OPTARG" ;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 244 | *) |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 245 | FAILCMDFILE="-C $LTPROOT/output/$OPTARG" |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 246 | ALT_DIR_OUT=1 ;; |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 247 | esac ;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 248 | |
Xiaoguang Wang | 5f71cf9 | 2014-09-23 15:59:43 +0800 | [diff] [blame] | 249 | T) |
| 250 | case $OPTARG in |
| 251 | /*) |
| 252 | TCONFCMDFILE="-T $OPTARG" ;; |
| 253 | *) |
| 254 | TCONFCMDFILE="-T $LTPROOT/output/$OPTARG" |
| 255 | ALT_DIR_OUT=1 ;; |
| 256 | esac ;; |
| 257 | |
subrata_modak | 5ee3e89 | 2008-10-21 13:17:56 +0000 | [diff] [blame] | 258 | d) # convert the user path to absolute path. |
Garrett Cooper | 5d520f4 | 2012-08-07 08:57:31 -0700 | [diff] [blame] | 259 | export TMPBASE=$(readlink -f ${OPTARG}) ;; |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 260 | |
| 261 | 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] | 262 | ARGUMENT_LIST=$OPTARG |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 263 | TOTAL_ARGUMENTS=1 |
| 264 | for ARGUMENT in `echo "$ARGUMENT_LIST" | tr ',' ' '` |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 265 | do |
| 266 | case $TOTAL_ARGUMENTS in |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 267 | 1) NUM_PROCS="$ARGUMENT" ;; |
| 268 | 2) NUM_FILES="$ARGUMENT" ;; |
| 269 | 3) NUM_BYTES="$ARGUMENT" ;; |
| 270 | 4) CLEAN_FLAG="$ARGUMENT" ;; |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 271 | esac |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 272 | TOTAL_ARGUMENTS=`expr $TOTAL_ARGUMENTS + 1` |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 273 | done |
| 274 | # just to get the default values if the user passed 0 |
| 275 | if [ "$NUM_PROCS" -eq 0 ]; then |
| 276 | NUM_PROCS=1 |
| 277 | fi |
| 278 | if [ "$NUM_FILES" -eq 0 ]; then |
| 279 | NUM_FILES=1 |
| 280 | fi |
| 281 | if [ "$NUM_BYTES" -eq 0 ]; then |
| 282 | NUM_BYTES=$((1024 * 1024 * 1024)) |
| 283 | fi |
| 284 | if [ "$CLEAN_FLAG" -ne 1 ]; then |
| 285 | CLEAN_FLAG=0 |
| 286 | fi |
| 287 | if [ "$CLEAN_FLAG" -eq 1 ]; then |
| 288 | # Do not unlink file in this case |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 289 | $LTPROOT/testcases/bin/genload --hdd $NUM_PROCS --hdd-files \ |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 290 | $NUM_FILES --hdd-bytes $NUM_BYTES >/dev/null 2>&1 & |
| 291 | else |
| 292 | # Cleanup otherwise |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 293 | $LTPROOT/testcases/bin/genload --hdd $NUM_PROCS --hdd-files \ |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 294 | $NUM_FILES --hdd-bytes $NUM_BYTES --hdd-noclean >/dev/null 2>&1 & |
| 295 | fi |
| 296 | GENLOAD=1;; |
| 297 | |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 298 | e) # Print out the version of LTP |
| 299 | version_of_ltp |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 300 | ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 301 | f) # Execute user defined set of testcases. |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 302 | # Can be more then one file, just separate it with ',', like: |
| 303 | # -f nfs,commands,/tmp/testfile |
| 304 | CMDFILES=$OPTARG;; |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 305 | F) INJECT_KERNEL_FAULT=1 |
| 306 | #Seperate out the NO_OF_LOOPS & FAULT_PERCENTAGE |
| 307 | INJECT_FAULT_LOOPS_PER_TEST=`echo $OPTARG |cut -d',' -f1 | tr -d '\n' | tr -d ' '` |
| 308 | INJECT_KERNEL_FAULT_PERCENTAGE=`echo $OPTARG |cut -d',' -f2 | tr -d '\n' | tr -d ' '` |
| 309 | if [ ! $INJECT_FAULT_LOOPS_PER_TEST ]; then |
| 310 | echo "Loops not properly defined. Resorting to default 5..." |
| 311 | export INJECT_FAULT_LOOPS_PER_TEST=5 |
| 312 | fi |
| 313 | if [ ! $INJECT_KERNEL_FAULT_PERCENTAGE ]; then |
| 314 | echo "Fault Persentage not properly defined. Resorting to default 10..." |
| 315 | export INJECT_KERNEL_FAULT_PERCENTAGE=10 |
| 316 | fi;; |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 317 | g) HTMLFILE_NAME="$OPTARG" |
| 318 | case $OPTARG in |
| 319 | /*) |
| 320 | HTMLFILE="$OPTARG";; |
| 321 | *) |
subrata_modak | d48c4d0 | 2008-01-23 12:59:40 +0000 | [diff] [blame] | 322 | HTMLFILE="$LTPROOT/output/$OPTARG";; |
| 323 | esac |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 324 | ALT_DIR_OUT=1 |
subrata_modak | d48c4d0 | 2008-01-23 12:59:40 +0000 | [diff] [blame] | 325 | ALT_HTML_OUT=1;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 326 | h) usage;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 327 | |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 328 | i) |
| 329 | NUM_PROCS=$(($OPTARG)) |
| 330 | if [ "$NUM_PROCS" -eq 0 ]; then |
| 331 | # User Did not Define the Value ,or, User Defined Zero, |
| 332 | # hence, prevent from creating infinite processes |
| 333 | NUM_PROCS=1 |
| 334 | fi |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 335 | $LTPROOT/testcases/bin/genload --io $NUM_PROCS >/dev/null 2>&1 & |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 336 | GENLOAD=1 ;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 337 | |
| 338 | K) |
Subrata Modak | bd9d440 | 2010-05-12 22:03:21 +0530 | [diff] [blame] | 339 | case $OPTARG in |
| 340 | /*) |
Cyril Hrubis | c381f58 | 2013-08-08 18:19:35 +0200 | [diff] [blame] | 341 | DMESG_DIR="$OPTARG-dmesg-output-`echo $$-``date +%X | tr -d ' '`";; |
Subrata Modak | bd9d440 | 2010-05-12 22:03:21 +0530 | [diff] [blame] | 342 | *) |
Cyril Hrubis | c381f58 | 2013-08-08 18:19:35 +0200 | [diff] [blame] | 343 | DMESG_DIR="$LTPROOT/output/$OPTARG-dmesg-output-`echo $$-``date +%X | tr -d ' '`";; |
Subrata Modak | bd9d440 | 2010-05-12 22:03:21 +0530 | [diff] [blame] | 344 | esac |
| 345 | mkdir -p $DMESG_DIR |
| 346 | ALT_DMESG_OUT=1;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 347 | l) |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 348 | LOGFILE_NAME="$OPTARG" |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 349 | case $OPTARG in |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 350 | /*) |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 351 | LOGFILE="-l $OPTARG" ;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 352 | *) |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 353 | LOGFILE="-l $LTPROOT/results/$OPTARG" |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 354 | ALT_DIR_RES=1 ;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 355 | esac ;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 356 | |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 357 | 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] | 358 | ARGUMENT_LIST=$OPTARG |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 359 | TOTAL_ARGUMENTS=1 |
| 360 | for ARGUMENT in `echo "$ARGUMENT_LIST" | tr ',' ' '` |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 361 | do |
| 362 | case $TOTAL_ARGUMENTS in |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 363 | 1) NUM_PROCS="$ARGUMENT" ;; |
| 364 | 2) CHUNKS="$ARGUMENT" ;; |
| 365 | 3) BYTES="$ARGUMENT" ;; |
| 366 | 4) HANGUP_FLAG="$ARGUMENT" ;; |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 367 | esac |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 368 | TOTAL_ARGUMENTS=`expr $TOTAL_ARGUMENTS + 1` |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 369 | done |
| 370 | # just to get the default values if the user passed 0 |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 371 | if [ "$NUM_PROCS" -eq 0 ]; then |
| 372 | NUM_PROCS=1 |
| 373 | fi |
| 374 | if [ "$CHUNKS" -eq 0 ]; then |
| 375 | CHUNKS=1 |
| 376 | fi |
| 377 | if [ "$BYTES" -eq 0 ]; then |
| 378 | BYTES=$((256 * 1024 * 1024)) |
| 379 | fi |
| 380 | if [ "$HANGUP_FLAG" -ne 1 ]; then |
| 381 | HANGUP_FLAG=0 |
| 382 | fi |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 383 | if [ "$HANGUP_FLAG" -eq 1 ]; then |
| 384 | # Hang in a Sleep loop after memory allocated |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 385 | $LTPROOT/testcases/bin/genload --vm $NUM_PROCS --vm-chunks \ |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 386 | $CHUNKS --vm-bytes $BYTES --vm-hang >/dev/null 2>&1 & |
| 387 | else |
| 388 | # Otherwise Do not Hangup |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 389 | $LTPROOT/testcases/bin/genload --vm $NUM_PROCS --vm-chunks \ |
subrata_modak | e099b2a | 2007-10-29 12:22:01 +0000 | [diff] [blame] | 390 | $CHUNKS --vm-bytes $BYTES >/dev/null 2>&1 & |
| 391 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 392 | GENLOAD=1;; |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 393 | M) |
| 394 | VALGRIND_CHECK=1 |
| 395 | VALGRIND_CHECK_TYPE="$OPTARG";; |
subrata_modak | 9c7072a | 2009-08-26 07:00:25 +0000 | [diff] [blame] | 396 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 397 | N) RUN_NETEST=1;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 398 | |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 399 | o) OUTPUTFILE_NAME="$OPTARG" |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 400 | case $OPTARG in |
| 401 | /*) |
| 402 | OUTPUTFILE="-o $OPTARG";; |
| 403 | *) |
| 404 | OUTPUTFILE="-o $LTPROOT/output/$OPTARG" |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 405 | ALT_DIR_OUT=1 ;; |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 406 | esac ;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 407 | |
Petr Vorel | 8283520 | 2017-08-22 15:33:47 +0200 | [diff] [blame] | 408 | p) PRETTY_PRT="-p";; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 409 | |
Petr Vorel | 8283520 | 2017-08-22 15:33:47 +0200 | [diff] [blame] | 410 | q) QUIET_MODE="-q";; |
| 411 | |
| 412 | Q) NO_KMSG="-Q";; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 413 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 414 | r) LTPROOT=$OPTARG;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 415 | |
Zorro Lang | 8aa2102 | 2016-09-26 21:19:49 +0800 | [diff] [blame] | 416 | R) RANDOMRUN=1;; |
| 417 | |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 418 | s) TAG_RESTRICT_STRING=$OPTARG;; |
subrata_modak | 2f6c981 | 2009-08-14 17:07:48 +0000 | [diff] [blame] | 419 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 420 | S) case $OPTARG in |
subrata_modak | 2f6c981 | 2009-08-14 17:07:48 +0000 | [diff] [blame] | 421 | /*) |
| 422 | SKIPFILE=$OPTARG;; |
| 423 | *) |
| 424 | SKIPFILE="$LTPROOT/$OPTARG";; |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 425 | esac ;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 426 | |
| 427 | t) # In case you want to specify the time |
| 428 | # to run from the command line |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 429 | # (2m = two minutes, 2h = two hours, etc) |
| 430 | DURATION="-t $OPTARG" ;; |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 431 | |
Cyril Hrubis | 5f79570 | 2016-04-26 14:45:57 +0200 | [diff] [blame] | 432 | I) # In case you want the testcases to runsequentially RUN_REPEATED times |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 433 | RUN_REPEATED=$OPTARG;; |
| 434 | |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 435 | w) CMDFILEADDR=$OPTARG;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 436 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 437 | x) # number of ltp's to run |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 438 | cat <<-EOF >&1 |
| 439 | WARNING: The use of -x can cause unpredictable failures, as a |
| 440 | result of concurrently running multiple tests designed |
| 441 | to be ran exclusively. |
| 442 | Pausing for 10 seconds..." |
| 443 | EOF |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 444 | sleep 10 |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 445 | INSTANCES="-x $OPTARG";; |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 446 | b) DEVICE=$OPTARG;; |
Xiaoguang Wang | 5b42a1e | 2013-12-12 19:10:58 +0800 | [diff] [blame] | 447 | B) LTP_DEV_FS_TYPE=$OPTARG;; |
| 448 | z) BIG_DEVICE=$OPTARG;; |
Xiaoguang Wang | cb1a4ae | 2014-04-15 19:33:21 +0800 | [diff] [blame] | 449 | Z) BIG_DEVICE_FS_TYPE=$OPTARG;; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 450 | \?) usage;; |
| 451 | esac |
| 452 | done |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 453 | |
| 454 | ## It would be nice to create a default log file even if the user has not mentioned |
| 455 | if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name |
look | 69f39f5 | 2014-04-30 09:55:44 +0800 | [diff] [blame] | 456 | LOGFILE_NAME="$DEFAULT_FILE_NAME_GENERATION_TIME" |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 457 | LOGFILE="-l $LTPROOT/results/LTP_RUN_ON-$LOGFILE_NAME.log" |
| 458 | ALT_DIR_RES=1 |
Petr Vorel | 8283520 | 2017-08-22 15:33:47 +0200 | [diff] [blame] | 459 | PRETTY_PRT="-p" |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 460 | fi |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 461 | |
| 462 | ## It would be nice if a Failed File is compulsorily created (gives User better Idea of Tests that failed) |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 463 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 464 | if [ ! "$FAILCMDFILE" ]; then ## User has not mentioned about Failed File name |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 465 | ALT_DIR_OUT=1 |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 466 | if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about Output File name either |
| 467 | if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name either |
look | 69f39f5 | 2014-04-30 09:55:44 +0800 | [diff] [blame] | 468 | FAILED_FILE_NAME="$DEFAULT_FILE_NAME_GENERATION_TIME" |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 469 | FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" |
| 470 | else ## User Fortunately wanted a log file, |
| 471 | FAILED_FILE_NAME=`basename $LOGFILE_NAME` ## Extract log file name and use it to construct Failed file name |
| 472 | FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 473 | fi |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 474 | else ## User Fortunately wanted a Output file |
| 475 | FAILED_FILE_NAME=`basename $OUTPUTFILE_NAME` ## Extract output file name and use it to construct Failed file name |
| 476 | FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" |
subrata_modak | 6838ec3 | 2007-09-14 10:10:12 +0000 | [diff] [blame] | 477 | fi |
| 478 | fi |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 479 | |
Xiaoguang Wang | 5f71cf9 | 2014-09-23 15:59:43 +0800 | [diff] [blame] | 480 | if [ ! "$TCONFCMDFILE" ]; then |
| 481 | ALT_DIR_OUT=1 |
| 482 | if [ ! "$OUTPUTFILE" ]; then |
| 483 | if [ ! "$LOGFILE" ]; then |
| 484 | TCONF_FILE_NAME="$DEFAULT_FILE_NAME_GENERATION_TIME" |
| 485 | TCONFCMDFILE="-T $LTPROOT/output/LTP_RUN_ON-${TCONF_FILE_NAME}.tconf" |
| 486 | else |
| 487 | TCONF_FILE_NAME=`basename $LOGFILE_NAME` |
| 488 | TCONFCMDFILE="-T $LTPROOT/output/LTP_RUN_ON-${TCONF_FILE_NAME}.tconf" |
| 489 | fi |
| 490 | else |
| 491 | TCONF_FILE_NAME=`basename $OUTPUTFILE_NAME` |
| 492 | TCONFCMDFILE="-T $LTPROOT/output/LTP_RUN_ON-${TCONF_FILE_NAME}.tconf" |
| 493 | fi |
| 494 | fi |
| 495 | |
subrata_modak | d48c4d0 | 2008-01-23 12:59:40 +0000 | [diff] [blame] | 496 | if [ "$ALT_HTML_OUT" -eq 1 ] ; then ## User wants the HTML version of the output |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 497 | QUIET_MODE="" ## Suppressing this guy as it will prevent generation of proper output |
subrata_modak | d48c4d0 | 2008-01-23 12:59:40 +0000 | [diff] [blame] | 498 | ## which the HTML parser will require |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 499 | if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about the Outputfile name, then we need to definitely generate one |
look | 69f39f5 | 2014-04-30 09:55:44 +0800 | [diff] [blame] | 500 | OUTPUTFILE_NAME="$DEFAULT_FILE_NAME_GENERATION_TIME" |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 501 | OUTPUTFILE="-o $LTPROOT/output/LTP_RUN_ON-$OUTPUTFILE_NAME.output" |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 502 | ALT_DIR_OUT=1 |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 503 | if [ ! "$HTMLFILE" ] ; then ## User has not mentioned HTML File name, We need to create one |
| 504 | HTMLFILE_NAME=`basename $OUTPUTFILE_NAME` |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 505 | HTMLFILE="$LTPROOT/output/$HTMLFILE_NAME.html" |
| 506 | fi |
| 507 | fi |
| 508 | fi |
| 509 | |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 510 | # If we need, create the output directory |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 511 | [ "$ALT_DIR_OUT" -eq 1 ] && \ |
| 512 | { |
| 513 | [ ! -d $LTPROOT/output ] && \ |
| 514 | { |
| 515 | echo "INFO: creating $LTPROOT/output directory" |
| 516 | mkdir -p $LTPROOT/output || \ |
| 517 | { |
| 518 | echo "ERROR: failed to create $LTPROOT/output" |
| 519 | exit 1 |
| 520 | } |
| 521 | } |
| 522 | } |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 523 | # If we need, create the results directory |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 524 | [ "$ALT_DIR_RES" -eq 1 ] && \ |
| 525 | { |
| 526 | echo "INFO: creating $LTPROOT/results directory" |
| 527 | [ ! -d $LTPROOT/results ] && \ |
| 528 | { |
| 529 | mkdir -p $LTPROOT/results || \ |
| 530 | { |
| 531 | echo "ERROR: failed to create $LTPROOT/results" |
| 532 | exit 1 |
| 533 | } |
| 534 | } |
| 535 | } |
subrata_modak | 5d7deea | 2007-09-15 13:51:36 +0000 | [diff] [blame] | 536 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 537 | # Added -m 777 for tests that call tst_tmpdir() and try to |
subrata_modak | a1fd64b | 2007-04-11 11:24:49 +0000 | [diff] [blame] | 538 | # write to it as user nobody |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 539 | mkdir -m 777 -p $TMPBASE || \ |
| 540 | { |
| 541 | echo "FATAL: Unable to make temporary directory $TMPBASE" |
| 542 | exit 1 |
| 543 | } |
subrata_modak | 5ee3e89 | 2008-10-21 13:17:56 +0000 | [diff] [blame] | 544 | # use mktemp to create "safe" temporary directories |
| 545 | export TMPTEMPLATE="${TMPBASE}/ltp-XXXXXXXXXX" |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 546 | TMP=`mktemp -d $TMPTEMPLATE` || \ |
| 547 | { |
| 548 | echo "FATAL: Unable to make temporary directory: $TMP" |
| 549 | exit 1 |
| 550 | } |
| 551 | export TMP |
subrata_modak | 225cfbe | 2009-06-23 14:01:26 +0000 | [diff] [blame] | 552 | # To be invoked by tst_tmpdir() |
| 553 | # write to it as user nobody |
| 554 | export TMPDIR=$TMP |
subrata_modak | 6edfbda | 2008-10-17 12:25:48 +0000 | [diff] [blame] | 555 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 556 | chmod 777 $TMP || \ |
| 557 | { |
| 558 | echo "unable to chmod 777 $TMP ... aborting" |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 559 | exit 1 |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 560 | } |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 561 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 562 | cd $TMP || \ |
| 563 | { |
| 564 | echo "could not cd ${TMP} ... exiting" |
| 565 | exit 1 |
| 566 | } |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 567 | |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 568 | [ -n "$INSTANCES" ] && \ |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 569 | { |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 570 | INSTANCES="$INSTANCES -O ${TMP}" |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 571 | } |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 572 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 573 | [ "$RUN_NETEST" -eq 1 ] && \ |
| 574 | { |
| 575 | [ -z "$RHOST" ] || [ -z "$PASSWD" ] && \ |
| 576 | { |
| 577 | [ -z "$RHOST" ] && \ |
| 578 | { |
Anders Roxell | 4691f01 | 2013-09-03 09:42:35 +0200 | [diff] [blame] | 579 | printf "INFO: Enter RHOST = 'name of the remote host machine'" |
| 580 | printf "\n-> " |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 581 | read RHOST |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 582 | } |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 583 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 584 | [ -z "$PASSWD" ] && \ |
| 585 | { |
Anders Roxell | 4691f01 | 2013-09-03 09:42:35 +0200 | [diff] [blame] | 586 | printf "\nINFO: " |
| 587 | printf "Enter PASSWD = 'root passwd of the remote host machine'" |
| 588 | printf "\n-> " |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 589 | read PASSWD |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 590 | } |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 591 | export RHOST=$RHOST |
| 592 | export PASSWD=$PASSWD |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 593 | echo "WARNING: security of $RHOST may be compromised" |
| 594 | } |
| 595 | } |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 596 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 597 | # If user does not provide a command file select a default set of testcases |
| 598 | # to execute. |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 599 | if [ -z "$CMDFILES" ] && [ -z "$CMDFILEADDR" ] |
| 600 | then |
| 601 | cat <<-EOF >&1 |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 602 | |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 603 | INFO: no command files were provided. Will execute the following |
| 604 | runtest scenario files: |
Garrett Cooper | 66d67b5 | 2010-11-16 22:42:48 -0800 | [diff] [blame] | 605 | |
| 606 | `cat $LTPROOT/scenario_groups/default | tr '\012' ' '` |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 607 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 608 | EOF |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 609 | |
Garrett Cooper | 89fde87 | 2010-11-16 22:38:08 -0800 | [diff] [blame] | 610 | SCENARIO_LISTS="$LTPROOT/scenario_groups/default" |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 611 | if [ "$RUN_NETEST" -eq 1 ]; then |
Garrett Cooper | 89fde87 | 2010-11-16 22:38:08 -0800 | [diff] [blame] | 612 | SCENARIO_LISTS="$SCENARIO_LISTS $LTPROOT/scenario_groups/network" |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 613 | fi |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 614 | |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 615 | # DO NOT INDENT/DEDENT! |
| 616 | if [ -n "$SCENARIO_LISTS" ]; then |
| 617 | # Insurance to make sure that the first element in the pipe |
| 618 | # completed successfully. |
| 619 | cat_ok_sentinel=$TMP/cat_ok.$$ |
Garrett Cooper | 66d67b5 | 2010-11-16 22:42:48 -0800 | [diff] [blame] | 620 | (cat $SCENARIO_LISTS && touch "$cat_ok_sentinel") | \ |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 621 | while read scenfile; do |
| 622 | |
| 623 | scenfile=${LTPROOT}/runtest/$scenfile |
| 624 | |
| 625 | # Skip over non-existent scenario files; things are |
| 626 | # robust enough now that the build will fail if these |
| 627 | # files don't exist. |
| 628 | [ -f "$scenfile" ] || continue |
| 629 | |
| 630 | cat $scenfile >> "$TMP/alltests" || { |
| 631 | echo "FATAL: unable to append to command file" |
| 632 | rm -Rf "$TMP" |
| 633 | rm -f "$cat_ok_sentinel" |
| 634 | exit 1 |
| 635 | } |
| 636 | |
| 637 | done |
| 638 | |
| 639 | rm -f "$cat_ok_sentinel" |
| 640 | |
| 641 | fi |
| 642 | # ^^DO NOT INDENT/DEDENT!^^ |
| 643 | |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 644 | fi |
| 645 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 646 | [ -n "$CMDFILES" ] && \ |
| 647 | { |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 648 | for scenfile in `echo "$CMDFILES" | tr ',' ' '` |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 649 | do |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 650 | [ -f "$scenfile" ] || scenfile="$LTPROOT/runtest/$scenfile" |
| 651 | cat "$scenfile" >> ${TMP}/alltests || \ |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 652 | { |
| 653 | echo "FATAL: unable to create command file" |
Garrett Cooper | cf86b8b | 2010-11-16 21:46:41 -0800 | [diff] [blame] | 654 | rm -Rf "$TMP" |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 655 | exit 1 |
| 656 | } |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 657 | done |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 658 | } |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 659 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 660 | [ -n "$CMDFILEADDR" ] && \ |
| 661 | { |
| 662 | wget -q "${CMDFILEADDR}" -O ${TMP}/wgetcmdfile |
| 663 | if [ $? -ne 0 ]; then |
| 664 | echo "FATAL: error while getting the command file with wget (address $CMDFILEADDR)" |
| 665 | exit 1 |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 666 | fi |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 667 | cat "${TMP}/wgetcmdfile" >> ${TMP}/alltests || \ |
| 668 | { |
| 669 | echo "FATAL: unable to create command file" |
| 670 | exit 1 |
| 671 | } |
| 672 | } |
yaberauneya | d8f1f5d | 2010-01-28 15:46:58 +0000 | [diff] [blame] | 673 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 674 | # The fsx-linux tests use the SCRATCHDEV environment variable as a location |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 675 | # that can be reformatted and run on. Set SCRATCHDEV if you want to run |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 676 | # these tests. As a safeguard, this is disabled. |
| 677 | unset SCRATCHDEV |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 678 | [ -n "$SCRATCHDEV" ] && \ |
| 679 | { |
| 680 | cat ${LTPROOT}/runtest/fsx >> ${TMP}/alltests || |
| 681 | { |
| 682 | echo "FATAL: unable to create fsx-linux tests command file" |
| 683 | exit 1 |
| 684 | } |
| 685 | } |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 686 | |
| 687 | # If enabled, execute only test cases that match the PATTERN |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 688 | if [ -n "$TAG_RESTRICT_STRING" ] |
| 689 | then |
| 690 | mv -f ${TMP}/alltests ${TMP}/alltests.orig |
| 691 | grep $TAG_RESTRICT_STRING ${TMP}/alltests.orig > ${TMP}/alltests #Not worth checking return codes for this case |
subrata_modak | bc833d3 | 2007-07-25 10:12:02 +0000 | [diff] [blame] | 692 | fi |
subrata_modak | 2f6c981 | 2009-08-14 17:07:48 +0000 | [diff] [blame] | 693 | |
| 694 | # Blacklist or skip tests if a SKIPFILE was specified with -S |
Naresh Kamboju | fe857cb | 2017-12-20 18:33:57 +0530 | [diff] [blame] | 695 | if [ -n "${SKIPFILE}" ]; then |
| 696 | for test_name in $(awk '{print $1}' "${SKIPFILE}"); do |
| 697 | case "${test_name}" in \#*) continue;; esac |
| 698 | sed -i "/\<${test_name}\>/c\\${test_name} exit 32;" alltests |
subrata_modak | 2f6c981 | 2009-08-14 17:07:48 +0000 | [diff] [blame] | 699 | done |
| 700 | fi |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 701 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 702 | # check for required users and groups |
Cyril Hrubis | b88fa5b | 2013-06-25 15:50:08 +0200 | [diff] [blame] | 703 | ${LTPROOT}/IDcheck.sh || \ |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 704 | { |
| 705 | echo "WARNING: required users and groups not present" |
| 706 | echo "WARNING: some test cases may fail" |
| 707 | } |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 708 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 709 | # display versions of installed software |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 710 | [ -z "$QUIET_MODE" ] && \ |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 711 | { |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 712 | ${LTPROOT}/ver_linux || \ |
| 713 | { |
| 714 | echo "WARNING: unable to display versions of software installed" |
| 715 | exit 1 |
| 716 | } |
| 717 | } |
| 718 | |
Harald Weppner | 8bdf0a0 | 2014-03-03 14:10:07 -0800 | [diff] [blame] | 719 | set_block_device |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 720 | |
Xiaoguang Wang | 5b42a1e | 2013-12-12 19:10:58 +0800 | [diff] [blame] | 721 | # here even if the user don't specify a big block device, we |
| 722 | # also don't create the big block device. |
| 723 | if [ -z "$BIG_DEVICE" ]; then |
| 724 | echo "no big block device was specified on commandline." |
| 725 | echo "Tests which require a big block device are disabled." |
| 726 | echo "You can specify it with option -z" |
| 727 | else |
Xiaoguang Wang | cb1a4ae | 2014-04-15 19:33:21 +0800 | [diff] [blame] | 728 | export LTP_BIG_DEV=$BIG_DEVICE |
| 729 | if [ -z "$BIG_DEVICE_FS_TYPE" ]; then |
| 730 | export LTP_BIG_DEV_FS_TYPE="ext2" |
| 731 | else |
| 732 | export LTP_BIG_DEV_FS_TYPE=$BIG_DEVICE_FS_TYPE |
| 733 | fi |
subrata_modak | d9fb386 | 2008-12-29 11:25:36 +0000 | [diff] [blame] | 734 | fi |
| 735 | |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 736 | if [ $RUN_REPEATED -gt 1 ]; then # You need to specify at least more than 1 sequential run, else it runs default |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 737 | echo "PAN will run these test cases $RUN_REPEATED times....." |
| 738 | echo "Test Tags will be Prepended with ITERATION NO.s....." |
| 739 | inc=1 |
| 740 | sed -e '/^$/ d' -e 's/^[ ,\t]*//' -e '/^#/ d' < ${TMP}/alltests > ${TMP}/alltests.temp ##This removes all newlines, leading spaces, tabs, # |
| 741 | sed 's/^[0-9,a-z,A-Z]*/'"$inc"'_ITERATION_&/' < ${TMP}/alltests.temp > ${TMP}/alltests ## .temp is kept as Base file |
| 742 | while [ $inc -lt $RUN_REPEATED ] ; do |
| 743 | inc=`expr $inc + 1` |
| 744 | sed 's/^[0-9,a-z,A-Z]*/'"$inc"'_ITERATION_&/' < ${TMP}/alltests.temp >> ${TMP}/alltests #Keep appending with Iteration No.s |
| 745 | done |
subrata_modak | 8c13833 | 2008-01-28 11:19:32 +0000 | [diff] [blame] | 746 | fi |
| 747 | |
Zorro Lang | 8aa2102 | 2016-09-26 21:19:49 +0800 | [diff] [blame] | 748 | if [ "$RANDOMRUN" != "0" ]; then |
| 749 | sort -R ${TMP}/alltests -o ${TMP}/alltests |
| 750 | fi |
| 751 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 752 | [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test start time: $(date)" ; } |
Petr Vorel | 8283520 | 2017-08-22 15:33:47 +0200 | [diff] [blame] | 753 | PAN_COMMAND="${LTPROOT}/bin/ltp-pan $QUIET_MODE $NO_KMSG -e -S $INSTANCES $DURATION -a $$ \ |
Xiaoguang Wang | 5f71cf9 | 2014-09-23 15:59:43 +0800 | [diff] [blame] | 754 | -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE $TCONFCMDFILE" |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 755 | echo "COMMAND: $PAN_COMMAND" |
| 756 | if [ ! -z "$TAG_RESTRICT_STRING" ] ; then |
| 757 | echo "INFO: Restricted to $TAG_RESTRICT_STRING" |
robbiew | 7d43d77 | 2005-02-07 20:07:30 +0000 | [diff] [blame] | 758 | fi |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 759 | #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 760 | |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 761 | ## Display the Output/Log/Failed/HTML file names here |
Anders Roxell | 4691f01 | 2013-09-03 09:42:35 +0200 | [diff] [blame] | 762 | printf "LOG File: " |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 763 | echo $LOGFILE | cut -b4- |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 764 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 765 | if [ "$OUTPUTFILE" ]; then |
Anders Roxell | 4691f01 | 2013-09-03 09:42:35 +0200 | [diff] [blame] | 766 | printf "OUTPUT File: " |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 767 | echo $OUTPUTFILE | cut -b4- |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 768 | fi |
| 769 | |
Anders Roxell | 4691f01 | 2013-09-03 09:42:35 +0200 | [diff] [blame] | 770 | printf "FAILED COMMAND File: " |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 771 | echo $FAILCMDFILE | cut -b4- |
| 772 | |
Xiaoguang Wang | 5f71cf9 | 2014-09-23 15:59:43 +0800 | [diff] [blame] | 773 | printf "TCONF COMMAND File: " |
| 774 | echo $TCONFCMDFILE | cut -b4- |
| 775 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 776 | if [ "$HTMLFILE" ]; then |
| 777 | echo "HTML File: $HTMLFILE" |
| 778 | fi |
| 779 | |
| 780 | echo "Running tests......." |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 781 | test_start_time=$(date) |
subrata_modak | 724098e | 2009-03-19 08:49:18 +0000 | [diff] [blame] | 782 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 783 | # User wants testing with Kernel Fault Injection |
| 784 | if [ $INJECT_KERNEL_FAULT ] ; then |
| 785 | #See if Debugfs is mounted, and |
| 786 | #Fault Injection Framework available through Debugfs |
Garrett Cooper | cb66da5 | 2012-04-03 22:09:42 -0700 | [diff] [blame] | 787 | use_faultinjection=true |
| 788 | for debug_subdir in \ |
| 789 | fail_io_timeout \ |
| 790 | fail_make_request \ |
| 791 | fail_page_alloc \ |
| 792 | failslab \ |
| 793 | ; do |
| 794 | if [ -d "/sys/kernel/debug/$debug_subdir" ] |
| 795 | then |
| 796 | use_faultinjection=true |
| 797 | break |
| 798 | fi |
| 799 | done |
| 800 | if $use_faultinjection; then |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 801 | #If atleast one of the Framework is available |
| 802 | #Go ahead to Inject Fault & Create required |
| 803 | #Command Files for LTP run |
| 804 | echo Running tests with Fault Injection Enabled in the Kernel... |
Garrett Cooper | cb66da5 | 2012-04-03 22:09:42 -0700 | [diff] [blame] | 805 | awk -v LOOPS=$INJECT_FAULT_LOOPS_PER_TEST \ |
| 806 | -v PERCENTAGE=$INJECT_KERNEL_FAULT_PERCENTAGE \ |
| 807 | -f ${LTPROOT}/bin/create_kernel_faults_in_loops_and_probability.awk \ |
| 808 | ${TMP}/alltests > ${TMP}/alltests.tmp |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 809 | cp ${TMP}/alltests.tmp ${TMP}/alltests |
| 810 | rm -rf ${TMP}/alltests.tmp |
| 811 | else |
| 812 | echo Fault Injection not enabled in the Kernel.. |
| 813 | echo Running tests normally... |
| 814 | fi |
| 815 | fi |
| 816 | |
| 817 | ## Valgrind Check will work only when Kernel Fault Injection is not expected, |
| 818 | ## We do not want to test Faults when valgrind is running |
| 819 | if [ $VALGRIND_CHECK ]; then |
| 820 | if [ ! $INJECT_KERNEL_FAULT ]; then |
| 821 | which valgrind || VALGRIND_CHECK_TYPE=XYZ |
| 822 | case $VALGRIND_CHECK_TYPE in |
Garrett Cooper | 3920fd1 | 2012-04-03 19:47:16 -0700 | [diff] [blame] | 823 | [1-3]) |
| 824 | awk -v CHECK_LEVEL=$VALGRIND_CHECK_TYPE \ |
| 825 | -f ${LTPROOT}/bin/create_valgrind_check.awk \ |
| 826 | ${TMP}/alltests $VALGRIND_CHECK_TYPE > \ |
| 827 | ${TMP}/alltests.tmp |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 828 | cp ${TMP}/alltests.tmp ${TMP}/alltests |
Garrett Cooper | 3920fd1 | 2012-04-03 19:47:16 -0700 | [diff] [blame] | 829 | rm -rf ${TMP}/alltests.tmp |
| 830 | ;; |
| 831 | *) |
| 832 | echo "Invalid Memory Check Type, or, Valgrind is not available" |
| 833 | ;; |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 834 | esac |
| 835 | fi |
| 836 | fi |
| 837 | |
Subrata Modak | bd9d440 | 2010-05-12 22:03:21 +0530 | [diff] [blame] | 838 | if [ $ALT_DMESG_OUT -eq 1 ] ; then |
| 839 | #We want to print dmesg output for each test,lets do the trick inside the script |
| 840 | echo Enabling dmesg output logging for each test... |
Garrett Cooper | 6603012 | 2012-04-03 20:22:14 -0700 | [diff] [blame] | 841 | awk -v DMESG_DIR=$DMESG_DIR \ |
| 842 | -f ${LTPROOT}/bin/create_dmesg_entries_for_each_test.awk \ |
| 843 | ${TMP}/alltests > ${TMP}/alltests.tmp |
Subrata Modak | bd9d440 | 2010-05-12 22:03:21 +0530 | [diff] [blame] | 844 | cp ${TMP}/alltests.tmp ${TMP}/alltests |
| 845 | rm -rf ${TMP}/alltests.tmp |
| 846 | fi |
subrata_modak | 724098e | 2009-03-19 08:49:18 +0000 | [diff] [blame] | 847 | # Some tests need to run inside the "bin" directory. |
| 848 | cd "${LTPROOT}/testcases/bin" |
Petr Vorel | 8283520 | 2017-08-22 15:33:47 +0200 | [diff] [blame] | 849 | "${LTPROOT}/bin/ltp-pan" $QUIET_MODE $NO_KMSG -e -S $INSTANCES $DURATION -a $$ -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE $TCONFCMDFILE |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 850 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 851 | if [ $? -eq 0 ]; then |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 852 | echo "INFO: ltp-pan reported all tests PASS" |
| 853 | VALUE=0 |
| 854 | export LTP_EXIT_VALUE=0; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 855 | else |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 856 | echo "INFO: ltp-pan reported some tests FAIL" |
| 857 | VALUE=1 |
| 858 | export LTP_EXIT_VALUE=1; |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 859 | fi |
subrata_modak | 724098e | 2009-03-19 08:49:18 +0000 | [diff] [blame] | 860 | cd .. |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 861 | echo "LTP Version: $version_date" |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 862 | |
Subrata Modak | e3bc375 | 2010-07-03 23:32:27 +0530 | [diff] [blame] | 863 | # $DMESG_DIR is used to cache messages obtained from dmesg after a test run. |
| 864 | # Proactively reap all of the 0-byte files in $DMESG_DIR as they have zero value |
| 865 | # and only clutter up the filesystem. |
| 866 | |
| 867 | if [ $ALT_DMESG_OUT -eq 1 ] ; then |
| 868 | if ! find "$DMESG_DIR" -size 0 -exec rm {} + ; then |
| 869 | echo "cd to $DMESG_DIR failed: $?" |
| 870 | fi |
| 871 | if [ -n "$(ls "$DMESG_DIR")" ] ; then |
| 872 | echo "Kernel messages were generated for LTP tests $version_date" |
| 873 | else |
| 874 | echo "No Kernel messages were generated for LTP tests $version_date" |
| 875 | fi |
| 876 | fi |
| 877 | |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 878 | if [ "$ALT_HTML_OUT" -eq 1 ] ; then #User wants the HTML output to be created, it then needs to be generated |
| 879 | export LTP_VERSION=$version_date |
Jungsu Sohn | 0b08cf1 | 2016-10-26 15:29:41 -0700 | [diff] [blame] | 880 | export TEST_START_TIME="$test_start_time" |
| 881 | export TEST_END_TIME="$(date)" |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 882 | OUTPUT_DIRECTORY=`echo $OUTPUTFILE | cut -c4-` |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 883 | LOGS_DIRECTORY="$LTPROOT/results" |
| 884 | export TEST_OUTPUT_DIRECTORY="$LTPROOT/output" |
| 885 | export TEST_LOGS_DIRECTORY=$LOGS_DIRECTORY |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 886 | echo "Generating HTML Output.....!!" |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 887 | ( perl $LTPROOT/bin/genhtml.pl $LTPROOT/bin/html_report_header.txt test_start test_end test_output execution_status $OUTPUT_DIRECTORY > $HTMLFILE; ) |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 888 | echo "Generated HTML Output.....!!" |
| 889 | echo "Location: $HTMLFILE"; |
| 890 | |
subrata_modak | e47fb35 | 2007-11-25 17:03:49 +0000 | [diff] [blame] | 891 | fi |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 892 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 893 | if [ "$ALT_EMAIL_OUT" -eq 1 ] ; then ## User wants reports to be e-mailed |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 894 | if [ [ ! "$HTMLFILE_NAME" ] -o [ ! "$OUTPUTFILE_NAME" ] -o [ ! "$LOGFILE_NAME" ] ] ; then |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 895 | ##User does not have output/logs/html-output, nothing to be mailed in this situation |
| 896 | echo "Nothing to be mailed here...." |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 897 | else |
subrata_modak | 4393821 | 2008-05-19 08:48:46 +0000 | [diff] [blame] | 898 | TAR_FILE_NAME=LTP_RUN_$version_date$DEFAULT_FILE_NAME_GENERATION_TIME.tar |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 899 | if [ "$HTMLFILE_NAME" ] ; then ## HTML file Exists |
| 900 | if [ "$ALT_HTML_OUT" -ne 1 ] ; then ## The HTML file path is absolute and not $LTPROOT/output |
| 901 | mkdir -p $LTPROOT/output ## We need to create this Directory |
| 902 | cp $HTMLFILE_NAME $LTPROOT/output/ |
| 903 | fi |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 904 | fi |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 905 | if [ "$OUTPUTFILE_NAME" ] ; then ## Output file exists |
| 906 | if [ "$ALT_DIR_OUT" -ne 1 ] ; then ## The Output file path is absolute and not $LTPROOT/output |
| 907 | mkdir -p $LTPROOT/output ## We need to create this Directory |
| 908 | cp $OUTPUTFILE_NAME $LTPROOT/output/ |
| 909 | fi |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 910 | fi |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 911 | if [ "$LOGFILE_NAME" ] ; then ## Log file exists |
| 912 | if [ "$ALT_DIR_RES" -ne 1 ] ; then ## The Log file path is absolute and not $LTPROOT/results |
| 913 | mkdir -p $LTPROOT/results ## We need to create this Directory |
| 914 | cp $LOGFILE_NAME $LTPROOT/results/ |
| 915 | fi |
| 916 | fi |
| 917 | if [ -d $LTPROOT/output ] ; then |
| 918 | tar -cf ./$TAR_FILE_NAME $LTPROOT/output |
| 919 | if [ $? -eq 0 ]; then |
| 920 | echo "Created TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/output" |
| 921 | else |
| 922 | echo "Cannot Create TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/output" |
| 923 | fi |
| 924 | fi |
| 925 | if [ -d $LTPROOT/results ] ; then |
| 926 | tar -uf ./$TAR_FILE_NAME $LTPROOT/results |
| 927 | if [ $? -eq 0 ]; then |
| 928 | echo "Updated TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/results" |
| 929 | else |
| 930 | echo "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/results" |
| 931 | fi |
| 932 | fi |
| 933 | if [ -e $LTPROOT/nohup.out ] ; then ## If User would have Chosen nohup to do ltprun |
| 934 | tar -uf ./$TAR_FILE_NAME $LTPROOT/nohup.out |
| 935 | if [ $? -eq 0 ]; then |
| 936 | echo "Updated TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/nohup.out" |
| 937 | else |
| 938 | echo "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/nohup.out" |
| 939 | fi |
| 940 | fi |
| 941 | gzip ./$TAR_FILE_NAME ## gzip this guy |
| 942 | if [ $? -eq 0 ]; then |
| 943 | echo "Gunzipped TAR File: ./$TAR_FILE_NAME" |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 944 | else |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 945 | echo "Cannot Gunzip TAR File: ./$TAR_FILE_NAME" |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 946 | fi |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 947 | if [ -e /usr/bin/mutt ] ; then ## This is a better mail client than others |
| 948 | echo "Starting mailing reports to: $EMAIL_TO, file: ./$TAR_FILE_NAME.gz" |
| 949 | mutt -a ./$TAR_FILE_NAME.gz -s "LTP Reports on $test_start_time" $EMAIL_TO < /dev/null |
| 950 | if [ $? -eq 0 ]; then |
| 951 | echo "Reports Successfully mailed to: $EMAIL_TO" |
| 952 | else |
| 953 | echo "Reports cannot be mailed to: $EMAIL_TO" |
| 954 | fi |
| 955 | else ## Use our Ageold mail program |
| 956 | echo "Starting mailing reports to: $EMAIL_TO, file: ./$TAR_FILE_NAME.gz" |
| 957 | uuencode ./$TAR_FILE_NAME.gz $TAR_FILE_NAME.gz | mail $EMAIL_TO -s "LTP Reports on $test_start_time" |
| 958 | if [ $? -eq 0 ]; then |
| 959 | echo "Reports Successfully mailed to: $EMAIL_TO" |
| 960 | else |
| 961 | echo "Reports cannot be mailed to: $EMAIL_TO" |
| 962 | fi |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 963 | fi |
subrata_modak | 08dde6f | 2007-11-28 11:02:51 +0000 | [diff] [blame] | 964 | fi |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 965 | fi |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 966 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 967 | [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test end time: $(date)" ; } |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 968 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 969 | [ "$GENLOAD" -eq 1 ] && { killall -9 genload >/dev/null 2>&1; } |
| 970 | [ "$NETPIPE" -eq 1 ] && { killall -9 NPtcp >/dev/null 2>&1; } |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 971 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 972 | [ "$ALT_DIR_OUT" -eq 1 ] || [ "$ALT_DIR_RES" -eq 1 ] && \ |
| 973 | { |
| 974 | cat <<-EOF >&1 |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 975 | |
Markos Chandras | 1132866 | 2012-03-06 10:28:59 +0000 | [diff] [blame] | 976 | ############################################################### |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 977 | |
Markos Chandras | 1132866 | 2012-03-06 10:28:59 +0000 | [diff] [blame] | 978 | Done executing testcases. |
mreed10 | 9169642 | 2006-05-03 19:07:22 +0000 | [diff] [blame] | 979 | LTP Version: $version_date |
Markos Chandras | 1132866 | 2012-03-06 10:28:59 +0000 | [diff] [blame] | 980 | ############################################################### |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 981 | |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 982 | EOF |
| 983 | } |
| 984 | exit $VALUE |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 985 | } |
| 986 | |
Ramesh YR | 0a78f23 | 2013-04-16 09:31:28 +0800 | [diff] [blame] | 987 | create_block() |
| 988 | { |
DAN LI | 189c441 | 2013-09-10 10:53:34 +0800 | [diff] [blame] | 989 | #create a block device |
Cyril Hrubis | 7eb77fb | 2017-02-08 12:01:47 +0100 | [diff] [blame] | 990 | dd if=/dev/zero of=${TMP}/test.img bs=1024 count=262144 >/dev/null 2>&1 |
Ramesh YR | 0a78f23 | 2013-04-16 09:31:28 +0800 | [diff] [blame] | 991 | if [ $? -ne 0 ]; then |
| 992 | echo "Failed to create loopback device image, please check disk space and re-run" |
| 993 | return 1 |
| 994 | else |
| 995 | ##search for an unused loop dev |
| 996 | LOOP_DEV=$(losetup -f) |
| 997 | if [ $? -ne 0 ]; then |
| 998 | echo "no unused loop device is found" |
| 999 | return 1 |
| 1000 | else |
| 1001 | ##attach the created file to loop dev. |
Cyril Hrubis | b88fa5b | 2013-06-25 15:50:08 +0200 | [diff] [blame] | 1002 | losetup $LOOP_DEV ${TMP}/test.img |
Ramesh YR | 0a78f23 | 2013-04-16 09:31:28 +0800 | [diff] [blame] | 1003 | if [ $? -ne 0 ]; then |
| 1004 | echo "losetup failed to create block device" |
| 1005 | return 1 |
Ramesh YR | 0a78f23 | 2013-04-16 09:31:28 +0800 | [diff] [blame] | 1006 | fi |
Cyril Hrubis | c381f58 | 2013-08-08 18:19:35 +0200 | [diff] [blame] | 1007 | DEVICE=$LOOP_DEV |
| 1008 | return 0 |
Ramesh YR | 0a78f23 | 2013-04-16 09:31:28 +0800 | [diff] [blame] | 1009 | fi |
| 1010 | fi |
| 1011 | } |
| 1012 | |
Harald Weppner | 8bdf0a0 | 2014-03-03 14:10:07 -0800 | [diff] [blame] | 1013 | set_block_device() |
| 1014 | { |
| 1015 | if [ -z "$DEVICE" ]; then |
| 1016 | create_block |
| 1017 | if [ $? -ne 0 ]; then |
| 1018 | echo "no block device was specified on commandline." |
| 1019 | echo "Block device could not be created using loopback device" |
| 1020 | echo "Tests which require block device are disabled." |
| 1021 | echo "You can specify it with option -b" |
| 1022 | else |
Jan Stancek | 977bdf2 | 2015-01-20 14:35:49 +0100 | [diff] [blame] | 1023 | export LTP_DEV=$DEVICE |
Harald Weppner | 8bdf0a0 | 2014-03-03 14:10:07 -0800 | [diff] [blame] | 1024 | fi |
| 1025 | else |
Jan Stancek | 977bdf2 | 2015-01-20 14:35:49 +0100 | [diff] [blame] | 1026 | export LTP_DEV=$DEVICE |
Harald Weppner | 8bdf0a0 | 2014-03-03 14:10:07 -0800 | [diff] [blame] | 1027 | fi |
| 1028 | } |
| 1029 | |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 1030 | cleanup() |
| 1031 | { |
Ramesh YR | 0a78f23 | 2013-04-16 09:31:28 +0800 | [diff] [blame] | 1032 | [ "$LOOP_DEV" ] && losetup -d $LOOP_DEV |
yaberauneya | 6d41cc3 | 2010-01-28 16:24:16 +0000 | [diff] [blame] | 1033 | rm -rf ${TMP} |
plars | 4a120e8 | 2004-09-02 18:56:06 +0000 | [diff] [blame] | 1034 | } |
| 1035 | |
Harald Weppner | 8bdf0a0 | 2014-03-03 14:10:07 -0800 | [diff] [blame] | 1036 | |
| 1037 | LTP_SCRIPT="$(basename $0)" |
| 1038 | |
Cyril Hrubis | e8776ea | 2014-03-24 13:32:01 +0100 | [diff] [blame] | 1039 | if [ "$LTP_SCRIPT" = "runltp" ]; then |
Harald Weppner | 8bdf0a0 | 2014-03-03 14:10:07 -0800 | [diff] [blame] | 1040 | trap "cleanup" 0 |
| 1041 | setup |
| 1042 | main "$@" |
| 1043 | fi |