blob: 134a9852a71a9fe44dda79ae070c23f6f319933c [file] [log] [blame]
plars4a120e82004-09-02 18:56:06 +00001#!/bin/sh
2################################################################################
3## ##
4## Copyright (c) International Business Machines Corp., 2001 ##
5## ##
6## This program is free software; you can redistribute it and#or modify ##
7## it under the terms of the GNU General Public License as published by ##
8## the Free Software Foundation; either version 2 of the License, or ##
9## (at your option) any later version. ##
10## ##
11## This program is distributed in the hope that it will be useful, but ##
12## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
13## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
14## for more details. ##
15## ##
16## You should have received a copy of the GNU General Public License ##
17## along with this program; if not, write to the Free Software ##
18## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ##
19## ##
20################################################################################
21# File: runltp
22#
23# Description: This script can be used to the tests in the LTP test suite
24#
25# Authors: Manoj Iyer - manjo@mail.utexas.edu
26# Robbe Williamson - robbiew@us.ibm.com
27#
28# History: Oct 07 2003 - Modified - Manoj Iyer
29# - use functions
30# - clean up on script exit
31# - error checking etc.
32#
33# Oct 08 2003 - Modified - Manoj Iyer
34# - fixed bug in creating results directory
subrata_modaka1fd64b2007-04-11 11:24:49 +000035# - all checks should be enlclosed in " " to avoid bash error
plars4a120e82004-09-02 18:56:06 +000036# - exit with error if pan is not found in pan directory
subrata_modakbc833d32007-07-25 10:12:02 +000037#
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_modak6838ec32007-09-14 10:10:12 +000047#
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_modak5d7deea2007-09-15 13:51:36 +000053# Sep 14 2007 - Modified - Ricardo Salveti de Araujo
54# - cleaning and removing duplicated code
55#
subrata_modake099b2a2007-10-29 12:22:01 +000056# Oct 27 2007 - Modified - Ricardo Salveti de Araujo and Subrata Modak
57# - better ways to integrate "ltp/tools/genload/stress" with "ltp/runltp"
58#
subrata_modak6838ec32007-09-14 10:10:12 +000059#################################################################################
subrata_modakbc833d32007-07-25 10:12:02 +000060
plars4a120e82004-09-02 18:56:06 +000061
62
63setup()
64{
65 cd `dirname $0` || \
66 {
67 echo "FATAL: unable to change directory to $(dirname $0)"
68 exit 1
69 }
70 export LTPROOT=${PWD}
71 export TMPBASE="/tmp"
72 export TMP="${TMPBASE}/ltp-$$"
subrata_modak4a57fe82007-09-24 06:40:12 +000073 export TMPDIR="${TMP}"
plars4a120e82004-09-02 18:56:06 +000074 export PATH="${PATH}:${LTPROOT}/testcases/bin"
75
76 [ -d $LTPROOT/testcases/bin ] ||
77 {
78 echo "FATAL: Test suite not installed correctly"
79 echo "INFO: as root user type 'make ; make install'"
80 exit 1
81 }
82
83 [ -e $LTPROOT/pan/pan ] ||
84 {
85 echo "FATAL: Test suite driver 'pan' not found"
86 echo "INFO: as root user type 'make ; make install'"
87 exit 1
88 }
89}
90
mreed1091696422006-05-03 19:07:22 +000091version_of_ltp()
92{
subrata_modaka1fd64b2007-04-11 11:24:49 +000093 head -n 1 $LTPROOT/ChangeLog
94 exit 0
mreed1091696422006-05-03 19:07:22 +000095}
plars4a120e82004-09-02 18:56:06 +000096
97usage()
98{
99 cat <<-EOF >&2
100
subrata_modake099b2a2007-10-29 12:22:01 +0000101 usage: ./${0##*/} [ -c NUM_PROCS ] [ -C FAILCMDFILE ] [ -d TMPDIR ]
102 [ -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG ] -e [ -f CMDFILES(,...) ]
103 [ -i NUM_PROCS ] [ -l LOGFILE ] [ -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG ]
104 -N -n [ -o OUTPUTFILE ] -p -q [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ]
105 -v [ -w CMDFILEADDR ] [ -x INSTANCES ]
plars4a120e82004-09-02 18:56:06 +0000106
subrata_modake099b2a2007-10-29 12:22:01 +0000107 -c NUM_PROCS Run LTP under additional background CPU load
108 [NUM_PROCS = no. of processes creating the CPU Load by spinning over sqrt()
109 (Defaults to 1 when value)]
subrata_modakbc833d32007-07-25 10:12:02 +0000110 -C FAILCMDFILE Command file with all failed test cases.
plars4a120e82004-09-02 18:56:06 +0000111 -d TMPDIR Directory where temporary files will be created.
subrata_modake099b2a2007-10-29 12:22:01 +0000112 -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG
113 Run LTP under additional background Load on Secondary Storage (Seperate by comma)
114 [NUM_PROCS = no. of processes creating Storage Load by spinning over write()]
115 [NUM_FILES = Write() to these many files (Defaults to 1 when value 0 or undefined)]
116 [NUM_BYTES = write these many bytes (defaults to 1GB, when value 0 or undefined)]
117 [CLEAN_FLAG = unlink file to which random data written, when value 1]
mreed1091696422006-05-03 19:07:22 +0000118 -e Prints the date of the current LTP release
subrata_modakbc833d32007-07-25 10:12:02 +0000119 -f CMDFILES Execute user defined list of testcases (separate with ',')
plars4a120e82004-09-02 18:56:06 +0000120 -h Help. Prints all available options.
subrata_modake099b2a2007-10-29 12:22:01 +0000121 -i NUM_PROCS Run LTP under additional background Load on IO Bus
122 [NUM_PROCS = no. of processes creating IO Bus Load by spinning over sync()]
plars4a120e82004-09-02 18:56:06 +0000123 -l LOGFILE Log results of test in a logfile.
subrata_modake099b2a2007-10-29 12:22:01 +0000124 -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG
125 Run LTP under additional background Load on Main memory (Seperate by comma)
126 [NUM_PROCS = no. of processes creating main Memory Load by spinning over malloc()]
127 [CHUNKS = malloc these many chunks (default is 1 when value 0 or undefined)]
128 [BYTES = malloc CHUNKS of BYTES bytes (default is 256MB when value 0 or undefined) ]
129 [HANGUP_FLAG = hang in a sleep loop after memory allocated, when value 1]
plars4a120e82004-09-02 18:56:06 +0000130 -N Run all the networking tests.
131 -n Run LTP with network traffic in background.
132 -o OUTPUTFILE Redirect test output to a file.
133 -p Human readable format logfiles.
134 -q Print less verbose output to screen.
135 -r LTPROOT Fully qualified path where testsuite is installed.
subrata_modaka1fd64b2007-04-11 11:24:49 +0000136 -s PATTERN Only run test cases which match PATTERN.
plars4a120e82004-09-02 18:56:06 +0000137 -t DURATION Execute the testsuite for given duration. Examples:
138 -t 60s = 60 seconds
139 -t 45m = 45 minutes
140 -t 24h = 24 hours
141 -t 2d = 2 days
robbiew7d43d772005-02-07 20:07:30 +0000142 -v Print more verbose output to screen.
subrata_modakbc833d32007-07-25 10:12:02 +0000143 -w CMDFILEADDR Uses wget to get the user's list of testcases.
plars4a120e82004-09-02 18:56:06 +0000144 -x INSTANCES Run multiple instances of this testsuite.
145
subrata_modake099b2a2007-10-29 12:22:01 +0000146 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}
plars4a120e82004-09-02 18:56:06 +0000147
plars4a120e82004-09-02 18:56:06 +0000148
149 EOF
150exit 0
151}
152
plars4a120e82004-09-02 18:56:06 +0000153main()
154{
subrata_modakbc833d32007-07-25 10:12:02 +0000155 local CMDFILES=""
plars4a120e82004-09-02 18:56:06 +0000156 local PRETTY_PRT=""
subrata_modak5d7deea2007-09-15 13:51:36 +0000157 local ALT_DIR_OUT=0
158 local ALT_DIR_RES=0
plars4a120e82004-09-02 18:56:06 +0000159 local RUN_NETEST=0
160 local QUIET_MODE=""
robbiew7d43d772005-02-07 20:07:30 +0000161 local VERBOSE_MODE=""
plars4a120e82004-09-02 18:56:06 +0000162 local NETPIPE=0
163 local GENLOAD=0
164 local MEMSIZE=0
165 local DURATION=""
subrata_modakbc833d32007-07-25 10:12:02 +0000166 local CMDFILEADDR=""
plars4a120e82004-09-02 18:56:06 +0000167 local LOGFILE=""
168 local SCENFILES=""
robbiew7d43d772005-02-07 20:07:30 +0000169 local TAG_RESTRICT_STRING=""
170 local PAN_COMMAND=""
mreed1091696422006-05-03 19:07:22 +0000171 version_date=`head -n 1 $LTPROOT/ChangeLog`
plars4a120e82004-09-02 18:56:06 +0000172
subrata_modake099b2a2007-10-29 12:22:01 +0000173 while getopts c:C:d:D:f:ehi:l:m:Nno:pqr:s:t:vw:x: arg
plars4a120e82004-09-02 18:56:06 +0000174 do case $arg in
175 c)
subrata_modake099b2a2007-10-29 12:22:01 +0000176 NUM_PROCS=$(($OPTARG))
177 if [ "$NUM_PROCS" -eq 0 ]; then
178 # User Did not Define the Value ,or, User Defined Zero,
179 # hence, prevent from creating infinite processes
180 NUM_PROCS=1
181 fi
plars4a120e82004-09-02 18:56:06 +0000182 $LTPROOT/testcases/bin/genload --cpu $NUM_PROCS >/dev/null 2>&1 &
183 GENLOAD=1 ;;
subrata_modakbc833d32007-07-25 10:12:02 +0000184
subrata_modak5d7deea2007-09-15 13:51:36 +0000185 C)
subrata_modak6838ec32007-09-14 10:10:12 +0000186 case $OPTARG in
187 /*)
188 FAILCMDFILE="-C $OPTARG" ;;
189 *)
190 FAILCMDFILE="-C $LTPROOT/output/$OPTARG"
subrata_modak5d7deea2007-09-15 13:51:36 +0000191 ALT_DIR_OUT=1 ;;
subrata_modak6838ec32007-09-14 10:10:12 +0000192 esac ;;
plars4a120e82004-09-02 18:56:06 +0000193
194 d) # append $$ to TMP, as it is recursively
195 # removed at end of script.
subrata_modak4a57fe82007-09-24 06:40:12 +0000196 export TMPBASE=$OPTARG
197 export TMP="${TMPBASE}/ltp-$$"
robbiew538bc1a2005-03-11 19:26:14 +0000198 export TMPDIR="$TMP";;
subrata_modake099b2a2007-10-29 12:22:01 +0000199
200 D) NUM_PROCS=1; NUM_FILES=1; NUM_BYTES=$((1024 * 1024 * 1024)); CLEAN_FLAG=0
201 ARGUMENT_LIST=$(($OPTARG))
202 TOTAL_ARGUMENTS=1 # Initial Assume
203 for ARGUMENT in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop
204 do
205 case $TOTAL_ARGUMENTS in
206 1) NUM_PROCS="$ARGUMENT" ;;
207 2) NUM_FILES="$ARGUMENT" ;;
208 3) NUM_BYTES="$ARGUMENT" ;;
209 4) CLEAN_FLAG="$ARGUMENT" ;;
210 esac
211 TOTAL_ARGUMENTS=`expr $TOTAL_ARGUMENTS + 1`
212 done
213 # just to get the default values if the user passed 0
214 if [ "$NUM_PROCS" -eq 0 ]; then
215 NUM_PROCS=1
216 fi
217 if [ "$NUM_FILES" -eq 0 ]; then
218 NUM_FILES=1
219 fi
220 if [ "$NUM_BYTES" -eq 0 ]; then
221 NUM_BYTES=$((1024 * 1024 * 1024))
222 fi
223 if [ "$CLEAN_FLAG" -ne 1 ]; then
224 CLEAN_FLAG=0
225 fi
226 if [ "$CLEAN_FLAG" -eq 1 ]; then
227 # Do not unlink file in this case
228 $LTPROOT/testcases/bin/genload --hdd $NUM_PROCS --hdd-files \
229 $NUM_FILES --hdd-bytes $NUM_BYTES >/dev/null 2>&1 &
230 else
231 # Cleanup otherwise
232 $LTPROOT/testcases/bin/genload --hdd $NUM_PROCS --hdd-files \
233 $NUM_FILES --hdd-bytes $NUM_BYTES --hdd-noclean >/dev/null 2>&1 &
234 fi
235 GENLOAD=1;;
236
mreed1091696422006-05-03 19:07:22 +0000237 e) # Print out the version of LTP
238 version_of_ltp
239 ;;
plars4a120e82004-09-02 18:56:06 +0000240 f) # Execute user defined set of testcases.
subrata_modakbc833d32007-07-25 10:12:02 +0000241 # Can be more then one file, just separate it with ',', like:
242 # -f nfs,commands,/tmp/testfile
243 CMDFILES=$OPTARG;;
plars4a120e82004-09-02 18:56:06 +0000244
245 h) usage;;
246
subrata_modake099b2a2007-10-29 12:22:01 +0000247 i)
248 NUM_PROCS=$(($OPTARG))
249 if [ "$NUM_PROCS" -eq 0 ]; then
250 # User Did not Define the Value ,or, User Defined Zero,
251 # hence, prevent from creating infinite processes
252 NUM_PROCS=1
253 fi
254 $LTPROOT/testcases/bin/genload --io $NUM_PROCS >/dev/null 2>&1 &
plars4a120e82004-09-02 18:56:06 +0000255 GENLOAD=1 ;;
256
257 l)
subrata_modak6838ec32007-09-14 10:10:12 +0000258 LOGFILE_NAME="$OPTARG"
plars4a120e82004-09-02 18:56:06 +0000259 case $OPTARG in
subrata_modak5d7deea2007-09-15 13:51:36 +0000260 /*)
plars4a120e82004-09-02 18:56:06 +0000261 LOGFILE="-l $OPTARG" ;;
262 *)
263 LOGFILE="-l $LTPROOT/results/$OPTARG"
subrata_modak5d7deea2007-09-15 13:51:36 +0000264 ALT_DIR_RES=1 ;;
plars4a120e82004-09-02 18:56:06 +0000265 esac ;;
266
subrata_modake099b2a2007-10-29 12:22:01 +0000267 m) NUM_PROCS=1; CHUNKS=1; BYTES=$((256 * 1024 * 1024)); HANGUP_FLAG=0
268 ARGUMENT_LIST=$(($OPTARG))
269 TOTAL_ARGUMENTS=1 # Initial Assume
270 for ARGUMENT in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop
271 do
272 case $TOTAL_ARGUMENTS in
273 1) NUM_PROCS="$ARGUMENT" ;;
274 2) CHUNKS="$ARGUMENT" ;;
275 3) BYTES="$ARGUMENT" ;;
276 4) HANGUP_FLAG="$ARGUMENT" ;;
277 esac
278 TOTAL_ARGUMENTS=`expr $TOTAL_ARGUMENTS + 1`
279 done
280 # just to get the default values if the user passed 0
281 if [ "$NUM_PROCS" -eq 0 ]; then
282 NUM_PROCS=1
283 fi
284 if [ "$CHUNKS" -eq 0 ]; then
285 CHUNKS=1
286 fi
287 if [ "$BYTES" -eq 0 ]; then
288 BYTES=$((256 * 1024 * 1024))
289 fi
290 if [ "$HANGUP_FLAG" -ne 1 ]; then
291 HANGUP_FLAG=0
292 fi
293 if [ "$HANGUP_FLAG" -eq 1 ]; then
294 # Hang in a Sleep loop after memory allocated
295 $LTPROOT/testcases/bin/genload --vm $NUM_PROCS --vm-chunks \
296 $CHUNKS --vm-bytes $BYTES --vm-hang >/dev/null 2>&1 &
297 else
298 # Otherwise Do not Hangup
299 $LTPROOT/testcases/bin/genload --vm $NUM_PROCS --vm-chunks \
300 $CHUNKS --vm-bytes $BYTES >/dev/null 2>&1 &
301 fi
plars4a120e82004-09-02 18:56:06 +0000302 GENLOAD=1;;
303
304 N) RUN_NETEST=1;;
305
306 n)
307 $LTPROOT/testcases/bin/netpipe.sh
308 NETPIPE=1;;
309
subrata_modak6838ec32007-09-14 10:10:12 +0000310 o) OUTPUTFILE_NAME="$OPTARG"
subrata_modak6838ec32007-09-14 10:10:12 +0000311 case $OPTARG in
312 /*)
313 OUTPUTFILE="-o $OPTARG";;
314 *)
315 OUTPUTFILE="-o $LTPROOT/output/$OPTARG"
subrata_modak5d7deea2007-09-15 13:51:36 +0000316 ALT_DIR_OUT=1 ;;
subrata_modak6838ec32007-09-14 10:10:12 +0000317 esac ;;
plars4a120e82004-09-02 18:56:06 +0000318
319 p) PRETTY_PRT=" -p ";;
320
321 q) QUIET_MODE=" -q ";;
322
323 r) LTPROOT=$OPTARG;;
324
robbiew7d43d772005-02-07 20:07:30 +0000325 s) TAG_RESTRICT_STRING=$OPTARG;;
326
plars4a120e82004-09-02 18:56:06 +0000327 t) # In case you want to specify the time
328 # to run from the command line
329 # (2m = two minutes, 2h = two hours, etc)
330 DURATION="-t $OPTARG" ;;
331
robbiew7d43d772005-02-07 20:07:30 +0000332 v) VERBOSE_MODE=1;;
subrata_modakbc833d32007-07-25 10:12:02 +0000333
334 w) CMDFILEADDR=$OPTARG;;
robbiew7d43d772005-02-07 20:07:30 +0000335
plars4a120e82004-09-02 18:56:06 +0000336 x) # number of ltp's to run
337 cat <<-EOF >&1
338 WARNING: The use of -x can cause unpredictable failures, as a
339 result of concurrently running multiple tests designed
340 to be ran exclusively.
341 Pausing for 10 seconds..."
342 EOF
343 sleep 10
344 INSTANCES="-x $OPTARG -O ${TMP}";;
345
346 \?) usage;;
347 esac
348 done
subrata_modak6838ec32007-09-14 10:10:12 +0000349
350 ## It would be nice if a Failed File is compulsorily created (gives User better Idea of Tests that failed)
351
352 if [ ! "$FAILCMDFILE" ]; then ## User has not mentioned about Failed File name
353 echo Inside Failed File Name not Mentioned
subrata_modak5d7deea2007-09-15 13:51:36 +0000354 ALT_DIR_OUT=1
subrata_modak6838ec32007-09-14 10:10:12 +0000355 if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about Output File name either
356 if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name either
357 FAILED_FILE_NAME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
358 FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed"
subrata_modak6838ec32007-09-14 10:10:12 +0000359 else ## User Fortunately wanted a log file,
360 FAILED_FILE_NAME=`basename $LOGFILE_NAME` ## Extract log file name and use it to construct Failed file name
361 FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed"
subrata_modak6838ec32007-09-14 10:10:12 +0000362 fi
363 else ## User Fortunately wanted a Output file
364 FAILED_FILE_NAME=`basename $OUTPUTFILE_NAME` ## Extract output file name and use it to construct Failed file name
365 FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed"
subrata_modak6838ec32007-09-14 10:10:12 +0000366 fi
367 fi
subrata_modaka1fd64b2007-04-11 11:24:49 +0000368
subrata_modak5d7deea2007-09-15 13:51:36 +0000369 # If we need, create the output directory
370 [ "$ALT_DIR_OUT" -eq 1 ] && \
371 {
372 echo "INFO: creating $LTPROOT/output directory"
373 [ ! -d $LTPROOT/output ] && \
374 {
375 mkdir -p $LTPROOT/output || \
376 {
377 echo "ERROR: failed to create $LTPROOT/output"
378 exit 1
379 }
380 }
381 }
382 # If we need, create the results directory
383 [ "$ALT_DIR_RES" -eq 1 ] && \
384 {
385 echo "INFO: creating $LTPROOT/results directory"
386 [ ! -d $LTPROOT/results ] && \
387 {
388 mkdir -p $LTPROOT/results || \
389 {
390 echo "ERROR: failed to create $LTPROOT/results"
391 exit 1
392 }
393 }
394 }
395
subrata_modaka1fd64b2007-04-11 11:24:49 +0000396 # Added -m 777 for tests that call tst_tmpdir() and try to
397 # write to it as user nobody
398 mkdir -m 777 -p $TMP || \
plars4a120e82004-09-02 18:56:06 +0000399 {
robbiew7d43d772005-02-07 20:07:30 +0000400 echo "FATAL: Unable to make temporary directory $TMP"
plars4a120e82004-09-02 18:56:06 +0000401 exit 1
402 }
403
404 cd $TMP || \
405 {
406 echo "could not cd ${TMP} ... exiting"
407 exit 1
408 }
409
410 [ "$RUN_NETEST" -eq 1 ] && \
411 {
412 [ -z "$RHOST" ] || [ -z "$PASSWD" ] && \
413 {
414 [ -z "$RHOST" ] && \
415 {
416 echo \
417 "INFO: Enter RHOST = 'name of the remote host machine'"
418 echo -n "-> "
419 read RHOST
420 }
421
422 [ -z "$PASSWD" ] && \
423 {
424 echo " "
425 echo \
426 "INFO: Enter PASSWD = 'root passwd of the remote host machine'"
427 echo -n "-> "
428 read PASSWD
429 }
430 export RHOST=$RHOST
431 export PASSWD=$PASSWD
432 echo "WARNING: security of $RHOST may be compromised"
433 }
434 }
435
436 # If user does not provide a command file select a default set of testcases
437 # to execute.
subrata_modakbc833d32007-07-25 10:12:02 +0000438 if [ -z "$CMDFILES" ] && [ -z "$CMDFILEADDR" ]
plars4a120e82004-09-02 18:56:06 +0000439 then
subrata_modakbc833d32007-07-25 10:12:02 +0000440 cat <<-EOF >&1
plars4a120e82004-09-02 18:56:06 +0000441
442 INFO: no command files were provided, using default,
443 system calls, memory management, IPC, scheduler
444 direct io, file system, math and pty tests will
445 now be executed
446
447 EOF
448
subrata_modakbc833d32007-07-25 10:12:02 +0000449 for SCENFILES in ${LTPROOT}/runtest/syscalls ${LTPROOT}/runtest/fs \
plars4a120e82004-09-02 18:56:06 +0000450 ${LTPROOT}/runtest/fsx ${LTPROOT}/runtest/dio \
451 ${LTPROOT}/runtest/mm ${LTPROOT}/runtest/ipc \
452 ${LTPROOT}/runtest/sched ${LTPROOT}/runtest/math \
subrata_modak0c5f9702007-04-26 11:02:47 +0000453 ${LTPROOT}/runtest/nptl ${LTPROOT}/runtest/pty \
454 ${LTPROOT}/runtest/containers
plars4a120e82004-09-02 18:56:06 +0000455 do
456 [ -a "$SCENFILES" ] || \
457 {
458 echo "FATAL: missing scenario file $SCENFILES"
459 exit 1
460 }
461
462 cat $SCENFILES >> ${TMP}/alltests || \
463 {
464 echo "FATAL: unable to create command file"
465 exit 1
466 }
467 done
subrata_modakbc833d32007-07-25 10:12:02 +0000468 fi
469
470 [ -n "$CMDFILES" ] && \
471 {
472 for SCENFILES in `echo "$CMDFILES" | sed 's/,/\n/g'`
473 do
474 [ -f "$SCENFILES" ] || SCENFILES="$LTPROOT/runtest/$SCENFILES"
475 cat "$SCENFILES" >> ${TMP}/alltests || \
476 {
477 echo "FATAL: unable to create command file"
478 exit 1
479 }
480 done
481 }
482
483 [ -n "$CMDFILEADDR" ] && \
484 {
485 wget -q "${CMDFILEADDR}" -O ${TMP}/wgetcmdfile
486 if [ $? -ne 0 ]; then
487 echo "FATAL: error while getting the command file with wget (address $CMDFILEADDR)"
488 exit 1
489 fi
490 cat "${TMP}/wgetcmdfile" >> ${TMP}/alltests || \
plars4a120e82004-09-02 18:56:06 +0000491 {
subrata_modakbc833d32007-07-25 10:12:02 +0000492 echo "FATAL: unable to create command file"
plars4a120e82004-09-02 18:56:06 +0000493 exit 1
494 }
subrata_modakbc833d32007-07-25 10:12:02 +0000495 }
496
plars4a120e82004-09-02 18:56:06 +0000497 [ "$RUN_NETEST" -eq 1 ] && \
498 {
499 for SCENFILES in ${LTPROOT}/runtest/tcp_cmds \
500 ${LTPROOT}/runtest/multicast \
501 ${LTPROOT}/runtest/rpc \
502 ${LTPROOT}/runtest/nfs
503 do
504 [ -a "$SCENFILES" ] || \
505 {
506 echo "FATAL: missing scenario file $SCENFILES"
507 exit 1
508 }
509
subrata_modakbc833d32007-07-25 10:12:02 +0000510 cat "$SCENFILES" >> ${TMP}/alltests || \
plars4a120e82004-09-02 18:56:06 +0000511 {
512 echo "FATAL: unable to create command file"
513 exit 1
514 }
515 done
516 }
subrata_modakbc833d32007-07-25 10:12:02 +0000517
plars4a120e82004-09-02 18:56:06 +0000518 # The fsx-linux tests use the SCRATCHDEV environment variable as a location
519 # that can be reformatted and run on. Set SCRATCHDEV if you want to run
520 # these tests. As a safeguard, this is disabled.
521 unset SCRATCHDEV
522 [ -n "$SCRATCHDEV" ] && \
523 {
524 cat ${LTPROOT}/runtest/fsx >> ${TMP}/alltests ||
525 {
526 echo "FATAL: unable to create fsx-linux tests command file"
527 exit 1
528 }
529 }
subrata_modakbc833d32007-07-25 10:12:02 +0000530
531 # If enabled, execute only test cases that match the PATTERN
532 if [ -n "$TAG_RESTRICT_STRING" ]
533 then
534 mv -f ${TMP}/alltests ${TMP}/alltests.orig
535 grep $TAG_RESTRICT_STRING ${TMP}/alltests.orig > ${TMP}/alltests #Not worth checking return codes for this case
536 fi
plars4a120e82004-09-02 18:56:06 +0000537
538 # check for required users and groups
539 ${LTPROOT}/IDcheck.sh &>/dev/null || \
540 {
541 echo "WARNING: required users and groups not present"
542 echo "WARNING: some test cases may fail"
543 }
robbiew7d43d772005-02-07 20:07:30 +0000544
plars4a120e82004-09-02 18:56:06 +0000545 # display versions of installed software
546 [ -z "$QUIET_MODE" ] && \
547 {
548 ${LTPROOT}/ver_linux || \
549 {
550 echo "WARNING: unable to display versions of software installed"
551 exit 1
552 }
553 }
554
555 [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test start time: $(date)" ; }
robbiew7d43d772005-02-07 20:07:30 +0000556 PAN_COMMAND="${LTPROOT}/pan/pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
subrata_modakbc833d32007-07-25 10:12:02 +0000557 -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE"
robbiew7d43d772005-02-07 20:07:30 +0000558 if [ ! -z "$VERBOSE_MODE" ] ; then
559 echo "COMMAND: $PAN_COMMAND"
560 if [ ! -z "$TAG_RESTRICT_STRING" ] ; then
561 echo "INFO: Restricted to $TAG_RESTRICT_STRING"
562 fi
563 fi
564 #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output
plars4a120e82004-09-02 18:56:06 +0000565 ${LTPROOT}/pan/pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
subrata_modakbc833d32007-07-25 10:12:02 +0000566 -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE
plars4a120e82004-09-02 18:56:06 +0000567
568 if [ $? -eq 0 ]; then
569 echo "INFO: pan reported all tests PASS"
570 VALUE=0
571 else
572 echo "INFO: pan reported some tests FAIL"
573 VALUE=1
574 fi
mreed1091696422006-05-03 19:07:22 +0000575 echo "LTP Version: $version_date"
576
plars4a120e82004-09-02 18:56:06 +0000577 [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test end time: $(date)" ; }
578
subrata_modake099b2a2007-10-29 12:22:01 +0000579 [ "$GENLOAD" -eq 1 ] && { killall -9 genload >/dev/null 2>&1; }
580 [ "$NETPIPE" -eq 1 ] && { killall -9 NPtcp >/dev/null 2>&1; }
plars4a120e82004-09-02 18:56:06 +0000581
subrata_modak5d7deea2007-09-15 13:51:36 +0000582 [ "$ALT_DIR_OUT" -eq 1 ] || [ "$ALT_DIR_RES" -eq 1 ] && \
plars4a120e82004-09-02 18:56:06 +0000583 {
584 cat <<-EOF >&1
585
586 ###############################################################"
587
588 Done executing testcases."
subrata_modak6838ec32007-09-14 10:10:12 +0000589 log result(s) is in $LTPROOT/results directory"
590 output/failed result(s) in $LTPROOT/output directory [If you did not provide Absolute Path]
mreed1091696422006-05-03 19:07:22 +0000591 LTP Version: $version_date
plars4a120e82004-09-02 18:56:06 +0000592 ###############################################################"
593
594 EOF
595 }
596 exit $VALUE
597}
598
599cleanup()
600{
601 rm -rf ${TMP}
602}
603
604trap "cleanup" 0
605setup
606main "$@"