On Wed, 2008-05-14 at 17:25 -0700, Garrett Cooper wrote:
> On Wed, May 14, 2008 at 5:50 AM, Subrata Modak
> <[EMAIL PROTECTED]> wrote:
> On Wed, 2008-05-14 at 17:57 +0530, Rishikesh K. Rajak wrote:
> > On Wed, 2008-05-14 at 17:31 +0530, Subrata Modak wrote:
> > > Hi,
> > >
> > > I was thinking why not enable LTP to generate the OUTPUT
> and the LOG
> > > files as default. Let me know the pros and cons of this. I
> have created
> > > the attached patch for implementing the same:
> >
> > HI Subrata,
> >
> > Thanks for patch. But, just i was thinking it would be a
> better idea
> > to leave to the user, where and in which format he wants to
> create
> > result file. Just an idea.
>
>
> Hi Rishi,
>
> Thanks for your comment. This patch (and the consequent
> enhancement)
> does not take away user freedom to generate his/her own away
> of creating
> output and log files. He/she can still use the options -l and
> -o to
> generate the same. What this patch provides is to create a
> output and
> log file only when the user has not mentioned them on ltp run.
>
> The idea of creating default output/log is from a user only,
> who felt
> that it is LTP“s drawback of not generating so.
>
> Regards--
> Subrata
>
>
> >
> > - Rishi
> > >
> > > Signed-off-by: Subrata Modak <[EMAIL PROTECTED]>
> > >
> > > Regards--
> > > Subrata
>
>
> Pro: You have your output all the time, so no more going "oops! I
> forgot to specify that -o / -l option!"
> Con: As we all know, many embedded systems have a limited amount of
> space, be it physical or virtual, s.t. more logs will clog up a
> running embedded system faster. This is especially true because tar
> uncompressed is used instead of with some form of compression (bzip2,
> cpio, gzip, etc).
>
True. So, i think, we can skip generating the output file (under
ltp/output by default), which actually rakes up huge space. Let the user
specify this.
But we can go ahead in generating a log file (under ltp/results) by
default, as, log file contains just a line summary of PASS/FAIL for each
test case, and occupies very less space. This really will come handy in
situation where the user had really oopss.......s..ed, discovering at
the midst of the run, as he has forgot to specifiy the options at
runtime. A handy default logfile will really simplify the job. What do
you say ? Patch attached.
Regards--
Subrata
> Why can't the user specify that they want logs instead of forcing the
> rest of the users to conform to this behavior? Then again
> using /dev/null or /dev/std{err|out} would work too I suppose...
>
> -Garrett
--- runltp.orig 2008-05-14 17:22:56.000000000 +0530
+++ runltp 2008-05-15 12:43:09.000000000 +0530
@@ -175,6 +175,7 @@ main()
local MEMSIZE=0
local DURATION=""
local CMDFILEADDR=""
+ local FAILCMDFILE=""
local LOGFILE_NAME=""
local LOGFILE=""
local OUTPUTFILE_NAME=""
@@ -185,6 +186,7 @@ main()
local SCENFILES=""
local TAG_RESTRICT_STRING=""
local PAN_COMMAND=""
+ local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
version_date=`head -n 1 $LTPROOT/ChangeLog`
while getopts a:c:C:d:D:f:ehi:g:l:m:Nno:pqr:s:t:T:vw:x: arg
@@ -376,6 +378,14 @@ main()
\?) usage;;
esac
done
+
+ ## It would be nice to create a default log file even if the user has not mentioned
+ if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name
+ LOGFILE_NAME=$DEFAULT_FILE_NAME_GENERATION_TIME
+ LOGFILE="-l $LTPROOT/results/LTP_RUN_ON-$LOGFILE_NAME.log"
+ ALT_DIR_RES=1
+ PRETTY_PRT=" -p "
+ fi
## It would be nice if a Failed File is compulsorily created (gives User better Idea of Tests that failed)
@@ -383,7 +393,7 @@ main()
ALT_DIR_OUT=1
if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about Output File name either
if [ ! "$LOGFILE" ]; then ## User has not mentioned about Log File name either
- FAILED_FILE_NAME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
+ FAILED_FILE_NAME=$DEFAULT_FILE_NAME_GENERATION_TIME
FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed"
else ## User Fortunately wanted a log file,
FAILED_FILE_NAME=`basename $LOGFILE_NAME` ## Extract log file name and use it to construct Failed file name
@@ -399,7 +409,7 @@ main()
QUIET_MODE="" ## Suppressing this guy as it will prevent generation of proper output
## which the HTML parser will require
if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about the Outputfile name, then we need to definitely generate one
- OUTPUTFILE_NAME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
+ OUTPUTFILE_NAME=$DEFAULT_FILE_NAME_GENERATION_TIME
OUTPUTFILE="-o $LTPROOT/output/LTP_RUN_ON-$OUTPUTFILE_NAME.output"
ALT_DIR_OUT=1
if [ ! "$HTMLFILE" ] ; then ## User has not mentioned HTML File name, We need to create one
@@ -620,6 +630,24 @@ main()
fi
fi
#$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output
+
+ ## Display the Output/Log/Failed/HTML file names here
+ echo -e "LOG File: \c"
+ echo $LOGFILE | cut -b4-
+
+ if [ "$OUTPUTFILE" ]; then
+ echo -e "OUTPUT File: \c"
+ echo $OUTPUTFILE | cut -b4-
+ fi
+
+ echo -e "FAILED COMMAND File: \c"
+ echo $FAILCMDFILE | cut -b4-
+
+ if [ "$HTMLFILE" ]; then
+ echo "HTML File: $HTMLFILE"
+ fi
+
+ echo "Running tests......."
test_start_time=$(date)
${LTPROOT}/pan/pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE
@@ -654,7 +682,7 @@ main()
##User does not have output/logs/html-output, nothing to be mailed in this situation
echo "Nothing to be mailed here...."
else
- TAR_FILE_NAME=LTP_RUN_$version_date`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`.tar
+ TAR_FILE_NAME=LTP_RUN_$version_date$DEFAULT_FILE_NAME_GENERATION_TIME.tar
if [ "$HTMLFILE_NAME" ] ; then ## HTML file Exists
if [ "$ALT_HTML_OUT" -ne 1 ] ; then ## The HTML file path is absolute and not $LTPROOT/output
mkdir -p $LTPROOT/output ## We need to create this Directory
@@ -735,8 +763,6 @@ main()
###############################################################"
Done executing testcases."
- log result(s) is in $LTPROOT/results directory"
- output/failed result(s) in $LTPROOT/output directory [If you did not provide Absolute Path]
LTP Version: $version_date
###############################################################"
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list