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