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/pan
/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.
88 -v Print more verbose output to screen.
90 example: ./${0##*/} -i 1024 -m 128 -p -q -l /tmp/resultlog.$$ -d ${PWD}
100 local CMDFILE
="ltplite"
105 local VERBOSE_MODE
=""
114 local TAG_RESTRICT_STRING
=""
117 while getopts c
:d
:hi
:l
:m
:No
:pqr
:v arg
120 NUM_PROCS
=$
(($OPTARG))
121 $LTPROOT/testcases
/bin
/genload
--cpu $NUM_PROCS >/dev
/null
2>&1 &
124 d
) # append $$ to TMP, as it is recursively
125 # removed at end of script.
127 TMP
="${TMPBASE}/ltp-$$"
128 export TMPDIR
="$TMP";;
133 BYTESIZE
=$
(($OPTARG * 1024 * 1024))
134 $LTPROOT/testcases
/bin
/genload
--io 1 >/dev
/null
2>&1 &
135 $LTPROOT/testcases
/bin
/genload
--hdd 0 --hdd-bytes $BYTESIZE \
141 echo "INFO: creating $LTPROOT/results directory"
142 [ ! -d $LTPROOT/results
] && \
144 mkdir
-p $LTPROOT/results || \
146 echo "ERROR: failed to create $LTPROOT/results"
152 LOGFILE
="-l $OPTARG" ;;
154 LOGFILE
="-l $LTPROOT/results/$OPTARG"
159 MEMSIZE
=$
(($OPTARG * 1024 * 1024))
160 $LTPROOT/testcases
/bin
/genload
--vm 0 --vm-bytes $MEMSIZE \
166 o
) OUTPUTFILE
="-o $OPTARG" ;;
168 p
) PRETTY_PRT
=" -p ";;
170 q
) QUIET_MODE
=" -q ";;
183 echo "FATAL: Unable to make temporary directory $TMP"
189 echo "could not cd ${TMP} ... exiting"
193 # Run Networking tests ?
195 [ "$RUN_NETEST" -eq 1 ] && \
197 [ -z "$RHOST" ] ||
[ -z "$PASSWD" ] && \
202 "INFO: Enter RHOST = 'name of the remote host machine'"
207 [ -z "$PASSWD" ] && \
211 "INFO: Enter PASSWD = 'root passwd of the remote host machine'"
216 export PASSWD
=$PASSWD
217 echo "WARNING: security of $RHOST may be compromised"
221 # If user does not provide a command file select a default set of testcases
223 if [ -f $CMDFILE ] || \
224 CMDFILE
="$LTPROOT/runtest/$CMDFILE"
226 cat $CMDFILE > ${TMP}/alltests || \
228 echo "FATAL: Unable to create command file"
233 [ "$RUN_NETEST" -eq 1 ] && \
235 for SCENFILES
in ${LTPROOT}/runtest
/tcp_cmds \
236 ${LTPROOT}/runtest
/multicast \
237 ${LTPROOT}/runtest
/rpc \
238 ${LTPROOT}/runtest
/nfs
240 [ -e "$SCENFILES" ] || \
242 echo "FATAL: missing scenario file $SCENFILES"
246 cat $SCENFILES >> ${TMP}/alltests || \
248 echo "FATAL: unable to create command file"
254 # The fsx-linux tests use the SCRATCHDEV environment variable as a location
255 # that can be reformatted and run on. Set SCRATCHDEV if you want to run
256 # these tests. As a safeguard, this is disabled.
258 [ -n "$SCRATCHDEV" ] && \
260 cat ${LTPROOT}/runtest
/fsx
>> ${TMP}/alltests ||
262 echo "FATAL: unable to create fsx-linux tests command file"
267 # check for required users and groups
268 ${LTPROOT}/IDcheck.sh
&>/dev
/null || \
270 echo "WARNING: required users and groups not present"
271 echo "WARNING: some test cases may fail"
276 # display versions of installed software
277 [ -z "$QUIET_MODE" ] && \
279 ${LTPROOT}/ver_linux || \
281 echo "WARNING: unable to display versions of software installed"
286 [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test start time: $(date)" ; }
287 PAN_COMMAND
="${LTPROOT}/pan/ltp-pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
288 -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE"
289 if [ ! -z "$VERBOSE_MODE" ] ; then
290 echo "COMMAND: $PAN_COMMAND"
291 if [ ! -z "$TAG_RESTRICT_STRING" ] ; then
292 echo "INFO: Restricted to $TAG_RESTRICT_STRING"
295 #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output
296 # Some tests need to run inside the "bin" directory.
297 cd "${LTPROOT}/testcases/bin"
298 ${LTPROOT}/pan
/ltp-pan
$QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
299 -n $$
$PRETTY_PRT -f ${TMP}/alltests
$LOGFILE $OUTPUTFILE
301 if [ $?
-eq 0 ]; then
302 echo "INFO: ltp-pan reported all tests PASS"
305 echo "INFO: ltp-pan reported some tests FAIL"
309 [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test end time: $(date)" ; }
311 [ "$GENLOAD" -eq 1 ] && { killall
-9 genload
; }
312 [ "$NETPIPE" -eq 1 ] && { killall
-9 NPtcp
; }
314 [ "$ALT_DIR" -eq 1 ] && \
318 ###############################################################"
320 Done executing testcases."
321 result log is in the $LTPROOT/results directory"
323 ###############################################################"