2 ################################################################################
4 ## Copyright (c) International Business Machines Corp., 2001 ##
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 the tests in the LTP test suite
25 # Authors: Manoj Iyer - manjo@mail.utexas.edu
26 # Robbe Williamson - robbiew@us.ibm.com
28 # History: Oct 07 2003 - Modified - Manoj Iyer
30 # - clean up on script exit
31 # - error checking etc.
33 # Oct 08 2003 - Modified - Manoj Iyer
34 # - fixed bug in creating results directory
35 # - all checks should be enlclosed in " " to avoid bash error
36 # - exit with error if pan is not found in pan directory
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,
45 # Jul 23 2007 - Modified - Ricardo Salveti de Araujo
46 # - added flag to get the command file that has all failed tests
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
53 # Sep 14 2007 - Modified - Ricardo Salveti de Araujo
54 # - cleaning and removing duplicated code
56 # Oct 27 2007 - Modified - Ricardo Salveti de Araujo and Subrata Modak
57 # - better ways to integrate "ltp/tools/genload/stress" with "ltp/runltp"
58 # Nov 24 2007 - Modified - Subrata Modak
59 # - Added a new option to generate output in HTML format also. Also retaining
60 # the original test format
61 # Nov 28 2007 - Modified - Subrata Modak
62 # - Added a new option to mail back LTP reports
63 # May 19 2008 - Modified - Subrata Modak
64 # - Added capability for default Log file generation
68 # May 12 2004 - Modified Alastair McKinstry
69 # - changed directory, file locations for ltp package
71 #################################################################################
79 echo "FATAL: unable to change directory to $(dirname $0)"
82 export LTPROOT
=/usr
/lib
/debian-test
/tests
/linux
83 export LTPTOOLS
=/usr
/lib
/debian-test
/tools
84 export RESULTSDIR
=/var
/cache
/ltp
/results
86 export PATH
="${PATH}:${LTPROOT}/testcases/bin"
88 [ -d $LTPROOT/testcases
/bin
] ||
90 echo "FATAL: Test suite not installed correctly"
91 echo "INFO: as root user type 'make ; make install'"
95 [ -e $LTPTOOLS/pan
] ||
97 echo "FATAL: Test suite driver 'pan' not found"
98 echo "INFO: as root user type 'make ; make install'"
105 zcat
/usr
/share
/doc
/ltp-tools
/changelog.gz |
head -n 1
113 usage: ./${0##*/} [ -a EMAIL_TO ] [ -c NUM_PROCS ] [ -C FAILCMDFILE ] [ -d TMPDIR ]
114 [ -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG ] -e [ -f CMDFILES(,...) ] [ -g HTMLFILE]
115 [ -i NUM_PROCS ] [ -l LOGFILE ] [ -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG ]
116 -N -n [ -o OUTPUTFILE ] -p -q [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ]
117 -v [ -w CMDFILEADDR ] [ -x INSTANCES ] [ -b DEVICE ] [-B DEVICE_FS_TYPE]
119 -a EMAIL_TO EMAIL all your Reports to this E-mail Address
120 -c NUM_PROCS Run LTP under additional background CPU load
121 [NUM_PROCS = no. of processes creating the CPU Load by spinning over sqrt()
122 (Defaults to 1 when value)]
123 -C FAILCMDFILE Command file with all failed test cases.
124 -d TMPDIR Directory where temporary files will be created.
125 -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG
126 Run LTP under additional background Load on Secondary Storage (Seperate by comma)
127 [NUM_PROCS = no. of processes creating Storage Load by spinning over write()]
128 [NUM_FILES = Write() to these many files (Defaults to 1 when value 0 or undefined)]
129 [NUM_BYTES = write these many bytes (defaults to 1GB, when value 0 or undefined)]
130 [CLEAN_FLAG = unlink file to which random data written, when value 1]
131 -e Prints the date of the current LTP release
132 -f CMDFILES Execute user defined list of testcases (separate with ',')
133 -g HTMLFILE Create an additional HTML output format
134 -h Help. Prints all available options.
135 -i NUM_PROCS Run LTP under additional background Load on IO Bus
136 [NUM_PROCS = no. of processes creating IO Bus Load by spinning over sync()]
137 -l LOGFILE Log results of test in a logfile.
138 -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG
139 Run LTP under additional background Load on Main memory (Seperate by comma)
140 [NUM_PROCS = no. of processes creating main Memory Load by spinning over malloc()]
141 [CHUNKS = malloc these many chunks (default is 1 when value 0 or undefined)]
142 [BYTES = malloc CHUNKS of BYTES bytes (default is 256MB when value 0 or undefined) ]
143 [HANGUP_FLAG = hang in a sleep loop after memory allocated, when value 1]
144 -N Run all the networking tests.
145 -n Run LTP with network traffic in background.
146 -o OUTPUTFILE Redirect test output to a file.
147 -p Human readable format logfiles.
148 -q Print less verbose output to screen.
149 -r LTPROOT Fully qualified path where testsuite is installed.
150 -s PATTERN Only run test cases which match PATTERN.
151 -t DURATION Execute the testsuite for given duration. Examples:
156 -T REPETITION Execute the testsuite for REPETITION no. of times
157 -v Print more verbose output to screen.
158 -w CMDFILEADDR Uses wget to get the user's list of testcases.
159 -x INSTANCES Run multiple instances of this testsuite.
160 -b DEVICE Some tests require an unmounted block device
162 -B DEVICE_FS_TYPE The file system of test block devices.
165 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 local ALT_EMAIL_OUT
=0
183 local VERBOSE_MODE
=""
190 local LOGFILE_NAME
=""
192 local OUTPUTFILE_NAME
=""
194 local HTMLFILE_NAME
=""
198 local TAG_RESTRICT_STRING
=""
200 version_date
=`zcat /usr/share/doc/ltp-tools/changelog.gz | head -n 1 `
201 local DEFAULT_FILE_NAME_GENERATION_TIME
=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
203 while getopts a
:c
:C
:d
:D
:f
:ehi
:g
:l
:m
:Nno
:pqr
:s
:t
:T
:vw
:x
:b
:B
: arg
208 NUM_PROCS
=$
(($OPTARG))
209 if [ "$NUM_PROCS" -eq 0 ]; then
210 # User Did not Define the Value ,or, User Defined Zero,
211 # hence, prevent from creating infinite processes
214 $LTPROOT/testcases
/bin
/genload
--cpu $NUM_PROCS >/dev
/null
2>&1 &
220 FAILCMDFILE
="-C $OPTARG" ;;
222 FAILCMDFILE
="-C $RESULTSDIR/$OPTARG"
226 d
) # convert the user path to absolute path.
227 export TMPBASE
=`cd \`dirname ${OPTARG}\
`; pwd`/`basename ${OPTARG}` ;;
229 D
) NUM_PROCS
=1; NUM_FILES
=1; NUM_BYTES
=$
((1024 * 1024 * 1024)); CLEAN_FLAG
=0
230 ARGUMENT_LIST
=$OPTARG
231 TOTAL_ARGUMENTS
=1 # Initial Assume
232 for ARGUMENT
in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop
234 case $TOTAL_ARGUMENTS in
235 1) NUM_PROCS
="$ARGUMENT" ;;
236 2) NUM_FILES
="$ARGUMENT" ;;
237 3) NUM_BYTES
="$ARGUMENT" ;;
238 4) CLEAN_FLAG
="$ARGUMENT" ;;
240 TOTAL_ARGUMENTS
=`expr $TOTAL_ARGUMENTS + 1`
242 # just to get the default values if the user passed 0
243 if [ "$NUM_PROCS" -eq 0 ]; then
246 if [ "$NUM_FILES" -eq 0 ]; then
249 if [ "$NUM_BYTES" -eq 0 ]; then
250 NUM_BYTES
=$
((1024 * 1024 * 1024))
252 if [ "$CLEAN_FLAG" -ne 1 ]; then
255 if [ "$CLEAN_FLAG" -eq 1 ]; then
256 # Do not unlink file in this case
257 $LTPROOT/testcases
/bin
/genload
--hdd $NUM_PROCS --hdd-files \
258 $NUM_FILES --hdd-bytes $NUM_BYTES >/dev
/null
2>&1 &
261 $LTPROOT/testcases
/bin
/genload
--hdd $NUM_PROCS --hdd-files \
262 $NUM_FILES --hdd-bytes $NUM_BYTES --hdd-noclean >/dev
/null
2>&1 &
266 e
) # Print out the version of LTP
269 f
) # Execute user defined set of testcases.
270 # Can be more then one file, just separate it with ',', like:
271 # -f nfs,commands,/tmp/testfile
273 g
) HTMLFILE_NAME
="$OPTARG"
278 HTMLFILE
="$RESULTSDIR/$OPTARG";;
285 NUM_PROCS
=$
(($OPTARG))
286 if [ "$NUM_PROCS" -eq 0 ]; then
287 # User Did not Define the Value ,or, User Defined Zero,
288 # hence, prevent from creating infinite processes
291 $LTPROOT/testcases
/bin
/genload
--io $NUM_PROCS >/dev
/null
2>&1 &
295 LOGFILE_NAME
="$OPTARG"
298 LOGFILE
="-l $OPTARG" ;;
300 LOGFILE
="-l $RESULTSDIR/$OPTARG"
304 m
) NUM_PROCS
=1; CHUNKS
=1; BYTES
=$
((256 * 1024 * 1024)); HANGUP_FLAG
=0
305 ARGUMENT_LIST
=$OPTARG
306 TOTAL_ARGUMENTS
=1 # Initial Assume
307 for ARGUMENT
in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop
309 case $TOTAL_ARGUMENTS in
310 1) NUM_PROCS
="$ARGUMENT" ;;
311 2) CHUNKS
="$ARGUMENT" ;;
312 3) BYTES
="$ARGUMENT" ;;
313 4) HANGUP_FLAG
="$ARGUMENT" ;;
315 TOTAL_ARGUMENTS
=`expr $TOTAL_ARGUMENTS + 1`
317 # just to get the default values if the user passed 0
318 if [ "$NUM_PROCS" -eq 0 ]; then
321 if [ "$CHUNKS" -eq 0 ]; then
324 if [ "$BYTES" -eq 0 ]; then
325 BYTES
=$
((256 * 1024 * 1024))
327 if [ "$HANGUP_FLAG" -ne 1 ]; then
330 if [ "$HANGUP_FLAG" -eq 1 ]; then
331 # Hang in a Sleep loop after memory allocated
332 $LTPROOT/testcases
/bin
/genload
--vm $NUM_PROCS --vm-chunks \
333 $CHUNKS --vm-bytes $BYTES --vm-hang >/dev
/null
2>&1 &
335 # Otherwise Do not Hangup
336 $LTPROOT/testcases
/bin
/genload
--vm $NUM_PROCS --vm-chunks \
337 $CHUNKS --vm-bytes $BYTES >/dev
/null
2>&1 &
344 $LTPROOT/testcases
/bin
/netpipe.sh
347 o
) OUTPUTFILE_NAME
="$OPTARG"
350 OUTPUTFILE
="-o $OPTARG";;
352 OUTPUTFILE
="-o $RESULTSDIR/$OPTARG"
356 p
) PRETTY_PRT
=" -p ";;
358 q
) QUIET_MODE
=" -q ";;
362 s
) TAG_RESTRICT_STRING
=$OPTARG;;
364 t
) # In case you want to specify the time
365 # to run from the command line
366 # (2m = two minutes, 2h = two hours, etc)
367 DURATION
="-t $OPTARG" ;;
369 T
) # In case you want the testcases to runsequentially RUN_REPEATED times
370 RUN_REPEATED
=$OPTARG;;
374 w
) CMDFILEADDR
=$OPTARG;;
376 x
) # number of ltp's to run
378 WARNING: The use of -x can cause unpredictable failures, as a
379 result of concurrently running multiple tests designed
380 to be ran exclusively.
381 Pausing for 10 seconds..."
384 INSTANCES
="-x $OPTARG";;
386 B
) DEVICE_FS_TYPE
=$OPTARG;;
391 ## It would be nice to create a default log file even if the user has not mentioned
392 if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name
393 LOGFILE_NAME
=$DEFAULT_FILE_NAME_GENERATION_TIME
394 LOGFILE
="-l $LTPROOT/results/LTP_RUN_ON-$LOGFILE_NAME.log"
399 ## It would be nice if a Failed File is compulsorily created (gives User better Idea of Tests that failed)
401 if [ ! "$FAILCMDFILE" ]; then ## User has not mentioned about Failed File name
403 if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about Output File name either
404 if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name either
405 FAILCMDFILE
="-C $RESULTSDIR/LTP_RUN_ON-$FAILED_FILE_NAME.failed"
406 FAILED_FILE_NAME
=$DEFAULT_FILE_NAME_GENERATION_TIME
407 else ## User Fortunately wanted a log file,
408 FAILED_FILE_NAME
=`basename ${LOGFILE_NAME}` ## Extract log file name and use it to construct Failed file name
409 FAILCMDFILE
="-C $RESULTSDIR/LTP_RUN_ON-$FAILED_FILE_NAME.failed"
411 else ## User Fortunately wanted a Output file
412 FAILED_FILE_NAME
=`basename $OUTPUTFILE_NAME` ## Extract output file name and use it to construct Failed file name
413 FAILCMDFILE
="-C $RESULTSDIR/LTP_RUN_ON-$FAILED_FILE_NAME.failed"
417 if [ "$ALT_HTML_OUT" -eq 1 ] ; then ## User wants the HTML version of the output
418 QUIET_MODE
="" ## Suppressing this guy as it will prevent generation of proper output
419 ## which the HTML parser will require
420 if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about the Outputfile name, then we need to definitely generate one
421 OUTPUTFILE
="-o $RESULTSDIR/LTP_RUN_ON-$OUTPUTFILE_NAME.output"
422 OUTPUTFILE_NAME
=$DEFAULT_FILE_NAME_GENERATION_TIME
424 if [ ! "$HTMLFILE" ] ; then ## User has not mentioned HTML File name, We need to create one
425 HTMLFILE_NAME
=`basename $OUTPUTFILE_NAME`
426 HTMLFILE
="$RESULTSDIR/$HTMLFILE_NAME.html"
431 # If we need, create the output directory
432 [ "$ALT_DIR_OUT" -eq 1 ] && \
434 echo "INFO: creating $RESULTSDIR directory"
435 [ ! -d $RESULTSDIR ] && \
437 mkdir
-p $RESULTSDIR || \
439 echo "ERROR: failed to create $RESULTSDIR"
444 # If we need, create the results directory
445 [ "$ALT_DIR_RES" -eq 1 ] && \
447 echo "INFO: creating $RESULTSDIR directory"
448 [ ! -d $RESULTSDIR ] && \
450 mkdir
-p $RESULTSDIR || \
452 echo "ERROR: failed to create $RESULTSDIR"
458 # Added -m 777 for tests that call tst_tmpdir() and try to
459 # write to it as user nobody
460 mkdir
-m 777 -p $TMPBASE || \
462 echo "FATAL: Unable to make temporary directory $TMPBASE"
465 # use mktemp to create "safe" temporary directories
466 export TMPTEMPLATE
="${TMPBASE}/ltp-XXXXXXXXXX"
467 TMP
=`mktemp -d $TMPTEMPLATE` || \
469 echo "FATAL: Unable to make temporary directory: $TMP"
473 # To be evoked by tst_tmpdir()
474 # write to it as user nobody
479 echo "unable to chmod 777 $TMP ... aborting"
485 echo "could not cd ${TMP} ... exiting"
489 ! [ -z $INSTANCES ] && \
491 INSTANCES
="$INSTANCES -O ${TMP}"
494 [ "$RUN_NETEST" -eq 1 ] && \
496 [ -z "$RHOST" ] ||
[ -z "$PASSWD" ] && \
501 "INFO: Enter RHOST = 'name of the remote host machine'"
506 [ -z "$PASSWD" ] && \
510 "INFO: Enter PASSWD = 'root passwd of the remote host machine'"
515 export PASSWD
=$PASSWD
516 echo "WARNING: security of $RHOST may be compromised"
520 # If user does not provide a command file select a default set of testcases
522 if [ -z "$CMDFILES" ] && [ -z "$CMDFILEADDR" ]
526 INFO: no command files were provided, using default,
527 system calls, memory management, IPC, scheduler
528 direct io, file system, math and pty tests will
533 for SCENFILES
in ${LTPROOT}/runtest
/syscalls \
534 ${LTPROOT}/runtest
/fs \
535 ${LTPROOT}/runtest
/fsx \
536 ${LTPROOT}/runtest
/dio \
537 ${LTPROOT}/runtest
/io \
538 ${LTPROOT}/runtest
/mm \
539 ${LTPROOT}/runtest
/ipc \
540 ${LTPROOT}/runtest
/sched \
541 ${LTPROOT}/runtest
/math \
542 ${LTPROOT}/runtest
/nptl \
543 ${LTPROOT}/runtest
/pty \
544 ${LTPROOT}/runtest
/containers \
545 ${LTPROOT}/runtest
/fs_bind \
546 ${LTPROOT}/runtest
/controllers \
547 ${LTPROOT}/runtest
/filecaps \
548 ${LTPROOT}/runtest
/fcntl-locktests \
549 ${LTPROOT}/runtest
/connectors \
550 ${LTPROOT}/runtest
/admin_tools \
551 ${LTPROOT}/runtest
/timers \
552 ${LTPROOT}/runtest
/power_management_tests \
553 ${LTPROOT}/runtest
/numa \
554 ${LTPROOT}/runtest
/hugetlb \
555 ${LTPROOT}/runtest
/commands \
556 ${LTPROOT}/runtest
/hyperthreading
558 [ -e "$SCENFILES" ] || \
560 echo "FATAL: missing scenario file $SCENFILES"
564 cat $SCENFILES >> ${TMP}/alltests || \
566 echo "FATAL: unable to create command file"
572 [ -n "$CMDFILES" ] && \
574 for SCENFILES
in `echo "$CMDFILES" | sed 's/,/\n/g'`
576 [ -f "$SCENFILES" ] || SCENFILES
="$LTPROOT/runtest/$SCENFILES"
577 cat "$SCENFILES" >> ${TMP}/alltests || \
579 echo "FATAL: unable to create command file"
585 [ -n "$CMDFILEADDR" ] && \
587 wget
-q "${CMDFILEADDR}" -O ${TMP}/wgetcmdfile
588 if [ $?
-ne 0 ]; then
589 echo "FATAL: error while getting the command file with wget (address $CMDFILEADDR)"
592 cat "${TMP}/wgetcmdfile" >> ${TMP}/alltests || \
594 echo "FATAL: unable to create command file"
599 [ "$RUN_NETEST" -eq 1 ] && \
601 for SCENFILES
in ${LTPROOT}/runtest
/tcp_cmds \
602 ${LTPROOT}/runtest
/multicast \
603 ${LTPROOT}/runtest
/rpc \
604 ${LTPROOT}/runtest
/nfs
606 [ -e "$SCENFILES" ] || \
608 echo "FATAL: missing scenario file $SCENFILES"
612 cat "$SCENFILES" >> ${TMP}/alltests || \
614 echo "FATAL: unable to create command file"
620 # The fsx-linux tests use the SCRATCHDEV environment variable as a location
621 # that can be reformatted and run on. Set SCRATCHDEV if you want to run
622 # these tests. As a safeguard, this is disabled.
624 [ -n "$SCRATCHDEV" ] && \
626 cat ${LTPROOT}/runtest
/fsx
>> ${TMP}/alltests ||
628 echo "FATAL: unable to create fsx-linux tests command file"
633 # If enabled, execute only test cases that match the PATTERN
634 if [ -n "$TAG_RESTRICT_STRING" ]
636 mv -f ${TMP}/alltests
${TMP}/alltests.orig
637 grep $TAG_RESTRICT_STRING ${TMP}/alltests.orig
> ${TMP}/alltests
#Not worth checking return codes for this case
640 # check for required users and groups
641 ${LTPROOT}/IDcheck.sh
&>/dev
/null || \
643 echo "WARNING: required users and groups not present"
644 echo "WARNING: some test cases may fail"
647 # display versions of installed software
648 [ -z "$QUIET_MODE" ] && \
650 ${LTPTOOLS}/ver_linux || \
652 echo "WARNING: unable to display versions of software installed"
657 if [ -n "$DEVICE" ]; then
658 sed -i "s|DEVICE|$DEVICE|" ${TMP}/alltests
660 echo "remove test cases which require the block device."
661 echo "You can specified it by oprion -b"
662 sed -i "/DEVICE/d" ${TMP}/alltests
665 if [ $?
-ne 0 ]; then
666 echo "FATAL: error during prcessing alltests file by sed"
670 if [ -n "$DEVICE" ]; then
671 mnt_pnt
=`mktemp -d --tmpdir=${TMP} mnt_pnt.XXXXXX`
672 if [ -n "$DEVICE_FS_TYPE" ]; then
673 mount
-t $DEVICE_FS_TYPE $DEVICE $mnt_pnt
675 mount
$DEVICE $mnt_pnt
678 if [ $?
-ne 0 ]; then
679 echo "FATAL: can't mount block device $DEVICE."
683 if [ -z "$DEVICE_FS_TYPE" ]; then
684 DEVICE_FS_TYPE
=`cat /proc/mounts | awk "{if (\\\$1 == \"$DEVICE\") print \\\$3; }"`
685 echo "determine file system $DEVICE_FS_TYPE on block device $DEVICE"
689 if [ $?
-ne 0 ]; then
690 echo "FATAL: can't umount $DEVICE"
696 if [ -n "$DEVICE" ]; then
697 sed -i "s|DEVICE_FS_TYPE|$DEVICE_FS_TYPE|" ${TMP}/alltests
700 if [ $?
-ne 0 ]; then
701 echo "FATAL: error during prcessing alltests file by sed"
705 if [ $RUN_REPEATED -gt 1 ]; then # You need to specify at least more than 1 sequential run, else it runs default
706 echo "PAN will run these test cases $RUN_REPEATED times....."
707 echo "Test Tags will be Prepended with ITERATION NO.s....."
709 sed -e '/^$/ d' -e 's/^[ ,\t]*//' -e '/^#/ d' < ${TMP}/alltests
> ${TMP}/alltests.temp
##This removes all newlines, leading spaces, tabs, #
710 sed 's/^[0-9,a-z,A-Z]*/'"$inc"'_ITERATION_&/' < ${TMP}/alltests.temp
> ${TMP}/alltests
## .temp is kept as Base file
711 while [ $inc -lt $RUN_REPEATED ] ; do
713 sed 's/^[0-9,a-z,A-Z]*/'"$inc"'_ITERATION_&/' < ${TMP}/alltests.temp
>> ${TMP}/alltests
#Keep appending with Iteration No.s
717 [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test start time: $(date)" ; }
718 PAN_COMMAND
="${LTPTOOLS}/pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
719 -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE"
720 if [ ! -z "$VERBOSE_MODE" ] ; then
721 echo "COMMAND: $PAN_COMMAND"
722 if [ ! -z "$TAG_RESTRICT_STRING" ] ; then
723 echo "INFO: Restricted to $TAG_RESTRICT_STRING"
726 #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output
728 ## Display the Output/Log/Failed/HTML file names here
729 echo -e "LOG File: \c"
730 echo $LOGFILE | cut
-b4-
732 if [ "$OUTPUTFILE" ]; then
733 echo -e "OUTPUT File: \c"
734 echo $OUTPUTFILE | cut
-b4-
737 echo -e "FAILED COMMAND File: \c"
738 echo $FAILCMDFILE | cut
-b4-
740 if [ "$HTMLFILE" ]; then
741 echo "HTML File: $HTMLFILE"
744 echo "Running tests......."
745 test_start_time
=$
(date)
746 ${LTPTOOLS}/pan
$QUIET_MODE -e -S $INSTANCES $DURATION -a $$
-n $$
$PRETTY_PRT -f ${TMP}/alltests
$LOGFILE $OUTPUTFILE $FAILCMDFILE
748 if [ $?
-eq 0 ]; then
749 echo "INFO: pan reported all tests PASS"
751 export LTP_EXIT_VALUE
=0;
753 echo "INFO: pan reported some tests FAIL"
755 export LTP_EXIT_VALUE
=1;
757 echo "LTP Version: $version_date"
759 if [ "$ALT_HTML_OUT" -eq 1 ] ; then #User wants the HTML output to be created, it then needs to be generated
760 export LTP_VERSION
=$version_date
761 export TEST_START_TIME
=$test_start_time
762 export TEST_END_TIME
=$
(date)
763 OUTPUT_DIRECTORY
=`echo $OUTPUTFILE | cut -c4-`
764 LOGS_DIRECTORY
="$RESULTSDIR"
765 export TEST_OUTPUT_DIRECTORY
="$RESULTSDIR"
766 export TEST_LOGS_DIRECTORY
=$LOGS_DIRECTORY
767 echo "Generating HTML Output.....!!"
768 ( perl
$LTPROOT/tools
/genhtml.pl
$LTPROOT/tools
/html_report_header.txt test_start test_end test_output execution_status
$OUTPUT_DIRECTORY > $HTMLFILE; )
769 echo "Generated HTML Output.....!!"
770 echo "Location: $HTMLFILE";
774 if [ "$ALT_EMAIL_OUT" -eq 1 ] ; then ## User wants reports to be e-mailed
775 if [ [ ! "$HTMLFILE_NAME" ] -o [ ! "$OUTPUTFILE_NAME" ] -o [ ! "$LOGFILE_NAME" ] ] ; then
776 ##User does not have output/logs/html-output, nothing to be mailed in this situation
777 echo "Nothing to be mailed here...."
779 TAR_FILE_NAME
=LTP_RUN_
$version_date$DEFAULT_FILE_NAME_GENERATION_TIME.
tar
780 if [ "$HTMLFILE_NAME" ] ; then ## HTML file Exists
781 if [ "$ALT_HTML_OUT" -ne 1 ] ; then ## The HTML file path is absolute and not $RESULTSDIR
782 mkdir
-p $RESULTSDIR ## We need to create this Directory
783 cp $HTMLFILE_NAME $RESULTSDIR/
786 if [ "$OUTPUTFILE_NAME" ] ; then ## Output file exists
787 if [ "$ALT_DIR_OUT" -ne 1 ] ; then ## The Output file path is absolute and not $RESULTSDIR
788 mkdir
-p $RESULTSDIR ## We need to create this Directory
789 cp $OUTPUTFILE_NAME $RESULTSDIR/
792 if [ "$LOGFILE_NAME" ] ; then ## Log file exists
793 if [ "$ALT_DIR_RES" -ne 1 ] ; then ## The Log file path is absolute and not $RESULTSDIR
794 mkdir
-p $RESULTSDIR ## We need to create this Directory
795 cp $LOGFILE_NAME $RESULTSDIR/
798 if [ -d $RESULTSDIR ] ; then
799 tar -cf .
/$TAR_FILE_NAME $RESULTSDIR
800 if [ $?
-eq 0 ]; then
801 echo "Created TAR File: ./$TAR_FILE_NAME successfully, added $RESULTSDIR"
803 echo "Cannot Create TAR File: ./$TAR_FILE_NAME for adding $RESULTSDIR"
806 if [ -d $RESULTSDIR ] ; then
807 tar -uf .
/$TAR_FILE_NAME $RESULTSDIR
808 if [ $?
-eq 0 ]; then
809 echo "Updated TAR File: ./$TAR_FILE_NAME successfully, added $RESULTSDIR"
811 echo "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $RESULTSDIR"
814 if [ -e $LTPROOT/nohup.out
] ; then ## If User would have Chosen nohup to do ltprun
815 tar -uf .
/$TAR_FILE_NAME $LTPROOT/nohup.out
816 if [ $?
-eq 0 ]; then
817 echo "Updated TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/nohup.out"
819 echo "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/nohup.out"
822 gzip .
/$TAR_FILE_NAME ## gzip this guy
823 if [ $?
-eq 0 ]; then
824 echo "Gunzipped TAR File: ./$TAR_FILE_NAME"
826 echo "Cannot Gunzip TAR File: ./$TAR_FILE_NAME"
828 if [ -e /usr
/bin
/mutt
] ; then ## This is a better mail client than others
829 echo "Starting mailing reports to: $EMAIL_TO, file: ./$TAR_FILE_NAME.gz"
830 mutt
-a .
/$TAR_FILE_NAME.gz
-s "LTP Reports on $test_start_time" $EMAIL_TO < /dev
/null
831 if [ $?
-eq 0 ]; then
832 echo "Reports Successfully mailed to: $EMAIL_TO"
834 echo "Reports cannot be mailed to: $EMAIL_TO"
836 else ## Use our Ageold mail program
837 echo "Starting mailing reports to: $EMAIL_TO, file: ./$TAR_FILE_NAME.gz"
838 uuencode .
/$TAR_FILE_NAME.gz
$TAR_FILE_NAME.gz |
mail $EMAIL_TO -s "LTP Reports on $test_start_time"
839 if [ $?
-eq 0 ]; then
840 echo "Reports Successfully mailed to: $EMAIL_TO"
842 echo "Reports cannot be mailed to: $EMAIL_TO"
848 [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test end time: $(date)" ; }
850 [ "$GENLOAD" -eq 1 ] && { killall
-9 genload
>/dev
/null
2>&1; }
851 [ "$NETPIPE" -eq 1 ] && { killall
-9 NPtcp
>/dev
/null
2>&1; }
853 [ "$ALT_DIR_OUT" -eq 1 ] ||
[ "$ALT_DIR_RES" -eq 1 ] && \
857 ###############################################################"
859 Done executing testcases."
860 log result(s) is in $RESULTSDIR directory"
861 output/failed result(s) in $RESULTSDIR directory [If you did not provide Absolute Path]
862 LTP Version: $version_date
863 ###############################################################"