2 ################################################################################
4 ## Copyright (c) International Business Machines Corp., 2001,2005 ##
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. ##
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. ##
16 ## You should have received a copy of the GNU General Public License ##
17 ## along with this program; if not, write to the Free Software ##
18 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ##
20 ################################################################################
23 # Description: This script can be used to run a subset the tests in the LTP test suite
24 # This script is typically used as a quick test to check an install base.
26 # Authors: Manoj Iyer - manoji@us.ibm.com
27 # Robbie Williamson - robbiew@us.ibm.com
28 # Marty Ridgeway - mridge@us.ibm.com
30 # History: Created runltplite script to run a subset of the LTP testsuite
45 echo "FATAL: unable to change directory to $(dirname $0)"
50 export TMP
="${TMPBASE}/ltp-$$"
51 export PATH
="${PATH}:${LTPROOT}/testcases/bin"
53 [ -d $LTPROOT/testcases
/bin
] ||
55 echo "FATAL: Test suite not installed correctly"
56 echo "INFO: as root user type 'make ; make install'"
60 [ -e $LTPROOT/bin
/ltp-pan
] ||
62 echo "FATAL: Test suite driver 'ltp-pan' not found"
63 echo "INFO: as root user type 'make ; make install'"
73 usage: ./${0##*/} -c [-d TMPDIR] [-i # (in Mb)]
74 [ -l LOGFILE ] [ -o OUTPUTFILE ] [ -m # (in Mb)] -N -q
77 -c NUM_PROCS Run LTP under additional background CPU load.
78 -d TMPDIR Directory where temporary files will be created.
79 -h Help. Prints all available options.
80 -i # (in Mb) Run LTP with a _min_ IO load of # Mb in background.
81 -l LOGFILE Log results of test in a logfile.
82 -m # (in Mb) Run LTP with a _min_ memory load of # Mb in background.
83 -N Run all the networking tests.
84 -o OUTPUTFILE Redirect test output to a file.
85 -p Human readable format logfiles.
86 -q Print less verbose output to screen.
87 -r LTPROOT Fully qualified path where testsuite is installed.
89 example: ./${0##*/} -i 1024 -m 128 -p -q -l /tmp/resultlog.$$ -d ${PWD}
99 local CMDFILE
="ltplite"
104 local VERBOSE_MODE
=""
113 local TAG_RESTRICT_STRING
=""
116 while getopts c
:d
:hi
:l
:m
:No
:pqr
: arg
119 NUM_PROCS
=$
(($OPTARG))
120 $LTPROOT/testcases
/bin
/genload
--cpu $NUM_PROCS >/dev
/null
2>&1 &
123 d
) # append $$ to TMP, as it is recursively
124 # removed at end of script.
126 TMP
="${TMPBASE}/ltp-$$"
127 export TMPDIR
="$TMP";;
132 BYTESIZE
=$
(($OPTARG * 1024 * 1024))
133 $LTPROOT/testcases
/bin
/genload
--io 1 >/dev
/null
2>&1 &
134 $LTPROOT/testcases
/bin
/genload
--hdd 0 --hdd-bytes $BYTESIZE \
140 [ ! -d $LTPROOT/results
] && \
142 echo "INFO: creating $LTPROOT/results directory"
143 mkdir
-p $LTPROOT/results || \
145 echo "ERROR: failed to create $LTPROOT/results"
151 LOGFILE
="-l $OPTARG" ;;
153 LOGFILE
="-l $LTPROOT/results/$OPTARG"
158 MEMSIZE
=$
(($OPTARG * 1024 * 1024))
159 $LTPROOT/testcases
/bin
/genload
--vm 0 --vm-bytes $MEMSIZE \
165 o
) OUTPUTFILE
="-o $OPTARG" ;;
167 p
) PRETTY_PRT
=" -p ";;
169 q
) QUIET_MODE
=" -q ";;
180 echo "FATAL: Unable to make temporary directory $TMP"
186 echo "could not cd ${TMP} ... exiting"
190 # Run Networking tests ?
192 [ "$RUN_NETEST" -eq 1 ] && \
194 [ -z "$RHOST" ] ||
[ -z "$PASSWD" ] && \
199 "INFO: Enter RHOST = 'name of the remote host machine'"
204 [ -z "$PASSWD" ] && \
208 "INFO: Enter PASSWD = 'root passwd of the remote host machine'"
213 export PASSWD
=$PASSWD
214 echo "WARNING: security of $RHOST may be compromised"
218 # If user does not provide a command file select a default set of testcases
220 if [ -f $CMDFILE ] || \
221 CMDFILE
="$LTPROOT/runtest/$CMDFILE"
223 cat $CMDFILE > ${TMP}/alltests || \
225 echo "FATAL: Unable to create command file"
230 [ "$RUN_NETEST" -eq 1 ] && \
232 for SCENFILES
in ${LTPROOT}/runtest
/tcp_cmds \
233 ${LTPROOT}/runtest
/multicast \
234 ${LTPROOT}/runtest
/rpc \
235 ${LTPROOT}/runtest
/nfs
237 [ -e "$SCENFILES" ] || \
239 echo "FATAL: missing scenario file $SCENFILES"
243 cat $SCENFILES >> ${TMP}/alltests || \
245 echo "FATAL: unable to create command file"
251 # The fsx-linux tests use the SCRATCHDEV environment variable as a location
252 # that can be reformatted and run on. Set SCRATCHDEV if you want to run
253 # these tests. As a safeguard, this is disabled.
255 [ -n "$SCRATCHDEV" ] && \
257 cat ${LTPROOT}/runtest
/fsx
>> ${TMP}/alltests ||
259 echo "FATAL: unable to create fsx-linux tests command file"
264 # check for required users and groups
265 ${LTPROOT}/IDcheck.sh
&>/dev
/null || \
267 echo "WARNING: required users and groups not present"
268 echo "WARNING: some test cases may fail"
273 # display versions of installed software
274 [ -z "$QUIET_MODE" ] && \
276 ${LTPROOT}/ver_linux || \
278 echo "WARNING: unable to display versions of software installed"
283 [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test start time: $(date)" ; }
284 PAN_COMMAND
="${LTPROOT}/bin/ltp-pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
285 -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE"
286 if [ ! -z "$VERBOSE_MODE" ] ; then
287 echo "COMMAND: $PAN_COMMAND"
288 if [ ! -z "$TAG_RESTRICT_STRING" ] ; then
289 echo "INFO: Restricted to $TAG_RESTRICT_STRING"
292 #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output
293 # Some tests need to run inside the "bin" directory.
294 cd "${LTPROOT}/testcases/bin"
295 ${LTPROOT}/bin
/ltp-pan
$QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
296 -n $$
$PRETTY_PRT -f ${TMP}/alltests
$LOGFILE $OUTPUTFILE
298 if [ $?
-eq 0 ]; then
299 echo "INFO: ltp-pan reported all tests PASS"
302 echo "INFO: ltp-pan reported some tests FAIL"
306 [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test end time: $(date)" ; }
308 [ "$GENLOAD" -eq 1 ] && { killall
-9 genload
; }
309 [ "$NETPIPE" -eq 1 ] && { killall
-9 NPtcp
; }
311 [ "$ALT_DIR" -eq 1 ] && \
315 ###############################################################"
317 Done executing testcases."
318 result log is in the $LTPROOT/results directory"
320 ###############################################################"