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
66 #################################################################################
74 echo "FATAL: unable to change directory to $(dirname $0)"
79 export PATH
="${PATH}:${LTPROOT}/testcases/bin"
81 [ -d $LTPROOT/testcases
/bin
] ||
83 echo "FATAL: Test suite not installed correctly"
84 echo "INFO: as root user type 'make ; make install'"
88 [ -e $LTPROOT/pan
/pan
] ||
90 echo "FATAL: Test suite driver 'pan' not found"
91 echo "INFO: as root user type 'make ; make install'"
98 head -n 1 $LTPROOT/ChangeLog
106 usage: ./${0##*/} [ -a EMAIL_TO ] [ -c NUM_PROCS ] [ -C FAILCMDFILE ] [ -d TMPDIR ]
107 [ -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG ] -e [ -f CMDFILES(,...) ] [ -g HTMLFILE]
108 [ -i NUM_PROCS ] [ -l LOGFILE ] [ -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG ]
109 -N -n [ -o OUTPUTFILE ] -p -q [ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ]
110 -v [ -w CMDFILEADDR ] [ -x INSTANCES ]
112 -a EMAIL_TO EMAIL all your Reports to this E-mail Address
113 -c NUM_PROCS Run LTP under additional background CPU load
114 [NUM_PROCS = no. of processes creating the CPU Load by spinning over sqrt()
115 (Defaults to 1 when value)]
116 -C FAILCMDFILE Command file with all failed test cases.
117 -d TMPDIR Directory where temporary files will be created.
118 -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG
119 Run LTP under additional background Load on Secondary Storage (Seperate by comma)
120 [NUM_PROCS = no. of processes creating Storage Load by spinning over write()]
121 [NUM_FILES = Write() to these many files (Defaults to 1 when value 0 or undefined)]
122 [NUM_BYTES = write these many bytes (defaults to 1GB, when value 0 or undefined)]
123 [CLEAN_FLAG = unlink file to which random data written, when value 1]
124 -e Prints the date of the current LTP release
125 -f CMDFILES Execute user defined list of testcases (separate with ',')
126 -g HTMLFILE Create an additional HTML output format
127 -h Help. Prints all available options.
128 -i NUM_PROCS Run LTP under additional background Load on IO Bus
129 [NUM_PROCS = no. of processes creating IO Bus Load by spinning over sync()]
130 -l LOGFILE Log results of test in a logfile.
131 -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG
132 Run LTP under additional background Load on Main memory (Seperate by comma)
133 [NUM_PROCS = no. of processes creating main Memory Load by spinning over malloc()]
134 [CHUNKS = malloc these many chunks (default is 1 when value 0 or undefined)]
135 [BYTES = malloc CHUNKS of BYTES bytes (default is 256MB when value 0 or undefined) ]
136 [HANGUP_FLAG = hang in a sleep loop after memory allocated, when value 1]
137 -N Run all the networking tests.
138 -n Run LTP with network traffic in background.
139 -o OUTPUTFILE Redirect test output to a file.
140 -p Human readable format logfiles.
141 -q Print less verbose output to screen.
142 -r LTPROOT Fully qualified path where testsuite is installed.
143 -s PATTERN Only run test cases which match PATTERN.
144 -t DURATION Execute the testsuite for given duration. Examples:
149 -T REPETITION Execute the testsuite for REPETITION no. of times
150 -v Print more verbose output to screen.
151 -w CMDFILEADDR Uses wget to get the user's list of testcases.
152 -x INSTANCES Run multiple instances of this testsuite.
154 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}
168 local ALT_EMAIL_OUT
=0
172 local VERBOSE_MODE
=""
179 local LOGFILE_NAME
=""
181 local OUTPUTFILE_NAME
=""
183 local HTMLFILE_NAME
=""
187 local TAG_RESTRICT_STRING
=""
189 local DEFAULT_FILE_NAME_GENERATION_TIME
=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
190 version_date
=`head -n 1 $LTPROOT/ChangeLog`
192 while getopts a
:c
:C
:d
:D
:f
:ehi
:g
:l
:m
:Nno
:pqr
:s
:t
:T
:vw
:x
: arg
197 NUM_PROCS
=$
(($OPTARG))
198 if [ "$NUM_PROCS" -eq 0 ]; then
199 # User Did not Define the Value ,or, User Defined Zero,
200 # hence, prevent from creating infinite processes
203 $LTPROOT/testcases
/bin
/genload
--cpu $NUM_PROCS >/dev
/null
2>&1 &
209 FAILCMDFILE
="-C $OPTARG" ;;
211 FAILCMDFILE
="-C $LTPROOT/output/$OPTARG"
215 d
) # convert the user path to absolute path.
216 export TMPBASE
=`cd \`dirname ${OPTARG}\
`; pwd`/`basename ${OPTARG}` ;;
218 D
) NUM_PROCS
=1; NUM_FILES
=1; NUM_BYTES
=$
((1024 * 1024 * 1024)); CLEAN_FLAG
=0
219 ARGUMENT_LIST
=$OPTARG
220 TOTAL_ARGUMENTS
=1 # Initial Assume
221 for ARGUMENT
in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop
223 case $TOTAL_ARGUMENTS in
224 1) NUM_PROCS
="$ARGUMENT" ;;
225 2) NUM_FILES
="$ARGUMENT" ;;
226 3) NUM_BYTES
="$ARGUMENT" ;;
227 4) CLEAN_FLAG
="$ARGUMENT" ;;
229 TOTAL_ARGUMENTS
=`expr $TOTAL_ARGUMENTS + 1`
231 # just to get the default values if the user passed 0
232 if [ "$NUM_PROCS" -eq 0 ]; then
235 if [ "$NUM_FILES" -eq 0 ]; then
238 if [ "$NUM_BYTES" -eq 0 ]; then
239 NUM_BYTES
=$
((1024 * 1024 * 1024))
241 if [ "$CLEAN_FLAG" -ne 1 ]; then
244 if [ "$CLEAN_FLAG" -eq 1 ]; then
245 # Do not unlink file in this case
246 $LTPROOT/testcases
/bin
/genload
--hdd $NUM_PROCS --hdd-files \
247 $NUM_FILES --hdd-bytes $NUM_BYTES >/dev
/null
2>&1 &
250 $LTPROOT/testcases
/bin
/genload
--hdd $NUM_PROCS --hdd-files \
251 $NUM_FILES --hdd-bytes $NUM_BYTES --hdd-noclean >/dev
/null
2>&1 &
255 e
) # Print out the version of LTP
258 f
) # Execute user defined set of testcases.
259 # Can be more then one file, just separate it with ',', like:
260 # -f nfs,commands,/tmp/testfile
262 g
) HTMLFILE_NAME
="$OPTARG"
267 HTMLFILE
="$LTPROOT/output/$OPTARG";;
274 NUM_PROCS
=$
(($OPTARG))
275 if [ "$NUM_PROCS" -eq 0 ]; then
276 # User Did not Define the Value ,or, User Defined Zero,
277 # hence, prevent from creating infinite processes
280 $LTPROOT/testcases
/bin
/genload
--io $NUM_PROCS >/dev
/null
2>&1 &
284 LOGFILE_NAME
="$OPTARG"
287 LOGFILE
="-l $OPTARG" ;;
289 LOGFILE
="-l $LTPROOT/results/$OPTARG"
293 m
) NUM_PROCS
=1; CHUNKS
=1; BYTES
=$
((256 * 1024 * 1024)); HANGUP_FLAG
=0
294 ARGUMENT_LIST
=$OPTARG
295 TOTAL_ARGUMENTS
=1 # Initial Assume
296 for ARGUMENT
in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop
298 case $TOTAL_ARGUMENTS in
299 1) NUM_PROCS
="$ARGUMENT" ;;
300 2) CHUNKS
="$ARGUMENT" ;;
301 3) BYTES
="$ARGUMENT" ;;
302 4) HANGUP_FLAG
="$ARGUMENT" ;;
304 TOTAL_ARGUMENTS
=`expr $TOTAL_ARGUMENTS + 1`
306 # just to get the default values if the user passed 0
307 if [ "$NUM_PROCS" -eq 0 ]; then
310 if [ "$CHUNKS" -eq 0 ]; then
313 if [ "$BYTES" -eq 0 ]; then
314 BYTES
=$
((256 * 1024 * 1024))
316 if [ "$HANGUP_FLAG" -ne 1 ]; then
319 if [ "$HANGUP_FLAG" -eq 1 ]; then
320 # Hang in a Sleep loop after memory allocated
321 $LTPROOT/testcases
/bin
/genload
--vm $NUM_PROCS --vm-chunks \
322 $CHUNKS --vm-bytes $BYTES --vm-hang >/dev
/null
2>&1 &
324 # Otherwise Do not Hangup
325 $LTPROOT/testcases
/bin
/genload
--vm $NUM_PROCS --vm-chunks \
326 $CHUNKS --vm-bytes $BYTES >/dev
/null
2>&1 &
333 $LTPROOT/testcases
/bin
/netpipe.sh
336 o
) OUTPUTFILE_NAME
="$OPTARG"
339 OUTPUTFILE
="-o $OPTARG";;
341 OUTPUTFILE
="-o $LTPROOT/output/$OPTARG"
345 p
) PRETTY_PRT
=" -p ";;
347 q
) QUIET_MODE
=" -q ";;
351 s
) TAG_RESTRICT_STRING
=$OPTARG;;
353 t
) # In case you want to specify the time
354 # to run from the command line
355 # (2m = two minutes, 2h = two hours, etc)
356 DURATION
="-t $OPTARG" ;;
358 T
) # In case you want the testcases to runsequentially RUN_REPEATED times
359 RUN_REPEATED
=$OPTARG;;
363 w
) CMDFILEADDR
=$OPTARG;;
365 x
) # number of ltp's to run
367 WARNING: The use of -x can cause unpredictable failures, as a
368 result of concurrently running multiple tests designed
369 to be ran exclusively.
370 Pausing for 10 seconds..."
373 INSTANCES
="-x $OPTARG";;
379 ## It would be nice to create a default log file even if the user has not mentioned
380 if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name
381 LOGFILE_NAME
=$DEFAULT_FILE_NAME_GENERATION_TIME
382 LOGFILE
="-l $LTPROOT/results/LTP_RUN_ON-$LOGFILE_NAME.log"
387 ## It would be nice if a Failed File is compulsorily created (gives User better Idea of Tests that failed)
389 if [ ! "$FAILCMDFILE" ]; then ## User has not mentioned about Failed File name
391 if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about Output File name either
392 if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name either
393 FAILED_FILE_NAME
=$DEFAULT_FILE_NAME_GENERATION_TIME
394 FAILCMDFILE
="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed"
395 else ## User Fortunately wanted a log file,
396 FAILED_FILE_NAME
=`basename $LOGFILE_NAME` ## Extract log file name and use it to construct Failed file name
397 FAILCMDFILE
="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed"
399 else ## User Fortunately wanted a Output file
400 FAILED_FILE_NAME
=`basename $OUTPUTFILE_NAME` ## Extract output file name and use it to construct Failed file name
401 FAILCMDFILE
="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed"
405 if [ "$ALT_HTML_OUT" -eq 1 ] ; then ## User wants the HTML version of the output
406 QUIET_MODE
="" ## Suppressing this guy as it will prevent generation of proper output
407 ## which the HTML parser will require
408 if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about the Outputfile name, then we need to definitely generate one
409 OUTPUTFILE_NAME
=$DEFAULT_FILE_NAME_GENERATION_TIME
410 OUTPUTFILE
="-o $LTPROOT/output/LTP_RUN_ON-$OUTPUTFILE_NAME.output"
412 if [ ! "$HTMLFILE" ] ; then ## User has not mentioned HTML File name, We need to create one
413 HTMLFILE_NAME
=`basename $OUTPUTFILE_NAME`
414 HTMLFILE
="$LTPROOT/output/$HTMLFILE_NAME.html"
419 # If we need, create the output directory
420 [ "$ALT_DIR_OUT" -eq 1 ] && \
422 echo "INFO: creating $LTPROOT/output directory"
423 [ ! -d $LTPROOT/output
] && \
425 mkdir
-p $LTPROOT/output || \
427 echo "ERROR: failed to create $LTPROOT/output"
432 # If we need, create the results directory
433 [ "$ALT_DIR_RES" -eq 1 ] && \
435 echo "INFO: creating $LTPROOT/results directory"
436 [ ! -d $LTPROOT/results
] && \
438 mkdir
-p $LTPROOT/results || \
440 echo "ERROR: failed to create $LTPROOT/results"
446 # Added -m 777 for tests that call tst_tmpdir() and try to
447 # write to it as user nobody
448 mkdir
-m 777 -p $TMPBASE || \
450 echo "FATAL: Unable to make temporary directory $TMPBASE"
453 # use mktemp to create "safe" temporary directories
454 export TMPTEMPLATE
="${TMPBASE}/ltp-XXXXXXXXXX"
455 TMP
=`mktemp -d $TMPTEMPLATE` || \
457 echo "FATAL: Unable to make temporary directory: $TMP"
461 # To be evoked by tst_tmpdir()
462 # write to it as user nobody
467 echo "unable to chmod 777 $TMP ... aborting"
473 echo "could not cd ${TMP} ... exiting"
477 ! [ -z $INSTANCES ] && \
479 INSTANCES
="$INSTANCES -O ${TMP}"
482 [ "$RUN_NETEST" -eq 1 ] && \
484 [ -z "$RHOST" ] ||
[ -z "$PASSWD" ] && \
489 "INFO: Enter RHOST = 'name of the remote host machine'"
494 [ -z "$PASSWD" ] && \
498 "INFO: Enter PASSWD = 'root passwd of the remote host machine'"
503 export PASSWD
=$PASSWD
504 echo "WARNING: security of $RHOST may be compromised"
508 # If user does not provide a command file select a default set of testcases
510 if [ -z "$CMDFILES" ] && [ -z "$CMDFILEADDR" ]
514 INFO: no command files were provided, using default,
515 system calls, memory management, IPC, scheduler
516 direct io, file system, math and pty tests will
521 for SCENFILES
in ${LTPROOT}/runtest
/syscalls \
522 ${LTPROOT}/runtest
/fs \
523 ${LTPROOT}/runtest
/fsx \
524 ${LTPROOT}/runtest
/dio \
525 ${LTPROOT}/runtest
/mm \
526 ${LTPROOT}/runtest
/ipc \
527 ${LTPROOT}/runtest
/sched \
528 ${LTPROOT}/runtest
/math \
529 ${LTPROOT}/runtest
/nptl \
530 ${LTPROOT}/runtest
/pty \
531 ${LTPROOT}/runtest
/containers \
532 ${LTPROOT}/runtest
/fs_bind \
533 ${LTPROOT}/runtest
/controllers \
534 ${LTPROOT}/runtest
/filecaps \
535 ${LTPROOT}/runtest
/fcntl-locktests \
536 ${LTPROOT}/runtest
/connectors \
537 ${LTPROOT}/runtest
/admin_tools \
538 ${LTPROOT}/runtest
/timers \
539 ${LTPROOT}/runtest
/power_management_tests \
540 ${LTPROOT}/runtest
/numa \
541 ${LTPROOT}/runtest
/hugetlb \
542 ${LTPROOT}/runtest
/commands
544 [ -e "$SCENFILES" ] || \
546 echo "FATAL: missing scenario file $SCENFILES"
550 cat $SCENFILES >> ${TMP}/alltests || \
552 echo "FATAL: unable to create command file"
558 [ -n "$CMDFILES" ] && \
560 for SCENFILES
in `echo "$CMDFILES" | sed 's/,/\n/g'`
562 [ -f "$SCENFILES" ] || SCENFILES
="$LTPROOT/runtest/$SCENFILES"
563 cat "$SCENFILES" >> ${TMP}/alltests || \
565 echo "FATAL: unable to create command file"
571 [ -n "$CMDFILEADDR" ] && \
573 wget
-q "${CMDFILEADDR}" -O ${TMP}/wgetcmdfile
574 if [ $?
-ne 0 ]; then
575 echo "FATAL: error while getting the command file with wget (address $CMDFILEADDR)"
578 cat "${TMP}/wgetcmdfile" >> ${TMP}/alltests || \
580 echo "FATAL: unable to create command file"
585 [ "$RUN_NETEST" -eq 1 ] && \
587 for SCENFILES
in ${LTPROOT}/runtest
/tcp_cmds \
588 ${LTPROOT}/runtest
/multicast \
589 ${LTPROOT}/runtest
/rpc \
590 ${LTPROOT}/runtest
/nfs
592 [ -e "$SCENFILES" ] || \
594 echo "FATAL: missing scenario file $SCENFILES"
598 cat "$SCENFILES" >> ${TMP}/alltests || \
600 echo "FATAL: unable to create command file"
606 # The fsx-linux tests use the SCRATCHDEV environment variable as a location
607 # that can be reformatted and run on. Set SCRATCHDEV if you want to run
608 # these tests. As a safeguard, this is disabled.
610 [ -n "$SCRATCHDEV" ] && \
612 cat ${LTPROOT}/runtest
/fsx
>> ${TMP}/alltests ||
614 echo "FATAL: unable to create fsx-linux tests command file"
619 # If enabled, execute only test cases that match the PATTERN
620 if [ -n "$TAG_RESTRICT_STRING" ]
622 mv -f ${TMP}/alltests
${TMP}/alltests.orig
623 grep $TAG_RESTRICT_STRING ${TMP}/alltests.orig
> ${TMP}/alltests
#Not worth checking return codes for this case
626 # check for required users and groups
627 ${LTPROOT}/IDcheck.sh
&>/dev
/null || \
629 echo "WARNING: required users and groups not present"
630 echo "WARNING: some test cases may fail"
633 # display versions of installed software
634 [ -z "$QUIET_MODE" ] && \
636 ${LTPROOT}/ver_linux || \
638 echo "WARNING: unable to display versions of software installed"
643 if [ $RUN_REPEATED -gt 1 ]; then # You need to specify at least more than 1 sequential run, else it runs default
644 echo "PAN will run these test cases $RUN_REPEATED times....."
645 echo "Test Tags will be Prepended with ITERATION NO.s....."
647 sed -e '/^$/ d' -e 's/^[ ,\t]*//' -e '/^#/ d' < ${TMP}/alltests
> ${TMP}/alltests.temp
##This removes all newlines, leading spaces, tabs, #
648 sed 's/^[0-9,a-z,A-Z]*/'"$inc"'_ITERATION_&/' < ${TMP}/alltests.temp
> ${TMP}/alltests
## .temp is kept as Base file
649 while [ $inc -lt $RUN_REPEATED ] ; do
651 sed 's/^[0-9,a-z,A-Z]*/'"$inc"'_ITERATION_&/' < ${TMP}/alltests.temp
>> ${TMP}/alltests
#Keep appending with Iteration No.s
655 [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test start time: $(date)" ; }
656 PAN_COMMAND
="${LTPROOT}/pan/pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
657 -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE"
658 if [ ! -z "$VERBOSE_MODE" ] ; then
659 echo "COMMAND: $PAN_COMMAND"
660 if [ ! -z "$TAG_RESTRICT_STRING" ] ; then
661 echo "INFO: Restricted to $TAG_RESTRICT_STRING"
664 #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output
666 ## Display the Output/Log/Failed/HTML file names here
667 echo -e "LOG File: \c"
668 echo $LOGFILE | cut
-b4-
670 if [ "$OUTPUTFILE" ]; then
671 echo -e "OUTPUT File: \c"
672 echo $OUTPUTFILE | cut
-b4-
675 echo -e "FAILED COMMAND File: \c"
676 echo $FAILCMDFILE | cut
-b4-
678 if [ "$HTMLFILE" ]; then
679 echo "HTML File: $HTMLFILE"
682 echo "Running tests......."
683 test_start_time
=$
(date)
684 ${LTPROOT}/pan
/pan
$QUIET_MODE -e -S $INSTANCES $DURATION -a $$
-n $$
$PRETTY_PRT -f ${TMP}/alltests
$LOGFILE $OUTPUTFILE $FAILCMDFILE
686 if [ $?
-eq 0 ]; then
687 echo "INFO: pan reported all tests PASS"
689 export LTP_EXIT_VALUE
=0;
691 echo "INFO: pan reported some tests FAIL"
693 export LTP_EXIT_VALUE
=1;
695 echo "LTP Version: $version_date"
697 if [ "$ALT_HTML_OUT" -eq 1 ] ; then #User wants the HTML output to be created, it then needs to be generated
698 export LTP_VERSION
=$version_date
699 export TEST_START_TIME
=$test_start_time
700 export TEST_END_TIME
=$
(date)
701 OUTPUT_DIRECTORY
=`echo $OUTPUTFILE | cut -c4-`
702 LOGS_DIRECTORY
="$LTPROOT/results"
703 export TEST_OUTPUT_DIRECTORY
="$LTPROOT/output"
704 export TEST_LOGS_DIRECTORY
=$LOGS_DIRECTORY
705 echo "Generating HTML Output.....!!"
706 ( perl
$LTPROOT/tools
/genhtml.pl
$LTPROOT/tools
/html_report_header.txt test_start test_end test_output execution_status
$OUTPUT_DIRECTORY > $HTMLFILE; )
707 echo "Generated HTML Output.....!!"
708 echo "Location: $HTMLFILE";
712 if [ "$ALT_EMAIL_OUT" -eq 1 ] ; then ## User wants reports to be e-mailed
713 if [ [ ! "$HTMLFILE_NAME" ] -o [ ! "$OUTPUTFILE_NAME" ] -o [ ! "$LOGFILE_NAME" ] ] ; then
714 ##User does not have output/logs/html-output, nothing to be mailed in this situation
715 echo "Nothing to be mailed here...."
717 TAR_FILE_NAME
=LTP_RUN_
$version_date$DEFAULT_FILE_NAME_GENERATION_TIME.
tar
718 if [ "$HTMLFILE_NAME" ] ; then ## HTML file Exists
719 if [ "$ALT_HTML_OUT" -ne 1 ] ; then ## The HTML file path is absolute and not $LTPROOT/output
720 mkdir
-p $LTPROOT/output
## We need to create this Directory
721 cp $HTMLFILE_NAME $LTPROOT/output
/
724 if [ "$OUTPUTFILE_NAME" ] ; then ## Output file exists
725 if [ "$ALT_DIR_OUT" -ne 1 ] ; then ## The Output file path is absolute and not $LTPROOT/output
726 mkdir
-p $LTPROOT/output
## We need to create this Directory
727 cp $OUTPUTFILE_NAME $LTPROOT/output
/
730 if [ "$LOGFILE_NAME" ] ; then ## Log file exists
731 if [ "$ALT_DIR_RES" -ne 1 ] ; then ## The Log file path is absolute and not $LTPROOT/results
732 mkdir
-p $LTPROOT/results
## We need to create this Directory
733 cp $LOGFILE_NAME $LTPROOT/results
/
736 if [ -d $LTPROOT/output
] ; then
737 tar -cf .
/$TAR_FILE_NAME $LTPROOT/output
738 if [ $?
-eq 0 ]; then
739 echo "Created TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/output"
741 echo "Cannot Create TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/output"
744 if [ -d $LTPROOT/results
] ; then
745 tar -uf .
/$TAR_FILE_NAME $LTPROOT/results
746 if [ $?
-eq 0 ]; then
747 echo "Updated TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/results"
749 echo "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/results"
752 if [ -e $LTPROOT/nohup.out
] ; then ## If User would have Chosen nohup to do ltprun
753 tar -uf .
/$TAR_FILE_NAME $LTPROOT/nohup.out
754 if [ $?
-eq 0 ]; then
755 echo "Updated TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/nohup.out"
757 echo "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/nohup.out"
760 gzip .
/$TAR_FILE_NAME ## gzip this guy
761 if [ $?
-eq 0 ]; then
762 echo "Gunzipped TAR File: ./$TAR_FILE_NAME"
764 echo "Cannot Gunzip TAR File: ./$TAR_FILE_NAME"
766 if [ -e /usr
/bin
/mutt
] ; then ## This is a better mail client than others
767 echo "Starting mailing reports to: $EMAIL_TO, file: ./$TAR_FILE_NAME.gz"
768 mutt
-a .
/$TAR_FILE_NAME.gz
-s "LTP Reports on $test_start_time" $EMAIL_TO < /dev
/null
769 if [ $?
-eq 0 ]; then
770 echo "Reports Successfully mailed to: $EMAIL_TO"
772 echo "Reports cannot be mailed to: $EMAIL_TO"
774 else ## Use our Ageold mail program
775 echo "Starting mailing reports to: $EMAIL_TO, file: ./$TAR_FILE_NAME.gz"
776 uuencode .
/$TAR_FILE_NAME.gz
$TAR_FILE_NAME.gz |
mail $EMAIL_TO -s "LTP Reports on $test_start_time"
777 if [ $?
-eq 0 ]; then
778 echo "Reports Successfully mailed to: $EMAIL_TO"
780 echo "Reports cannot be mailed to: $EMAIL_TO"
786 [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test end time: $(date)" ; }
788 [ "$GENLOAD" -eq 1 ] && { killall
-9 genload
>/dev
/null
2>&1; }
789 [ "$NETPIPE" -eq 1 ] && { killall
-9 NPtcp
>/dev
/null
2>&1; }
791 [ "$ALT_DIR_OUT" -eq 1 ] ||
[ "$ALT_DIR_RES" -eq 1 ] && \
795 ###############################################################"
797 Done executing testcases."
798 LTP Version: $version_date
799 ###############################################################"