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:

Signed-off-by: Subrata Modak <[EMAIL PROTECTED]>

Regards--
Subrata
--- runltp.orig	2008-05-14 17:22:56.000000000 +0530
+++ runltp	2008-05-14 17:11:58.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,14 +378,29 @@ 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 to create a default output file even if the user has not mentioned
+    if [ ! "$OUTPUTFILE" ]; then                             ## User has not mentioned about Output File name
+       OUTPUTFILE_NAME=$DEFAULT_FILE_NAME_GENERATION_TIME
+       OUTPUTFILE="-o $LTPROOT/output/LTP_RUN_ON-$OUTPUTFILE_NAME.output"
+       ALT_DIR_OUT=1
+    fi
+
     ## It would be nice if a Failed File is compulsorily created (gives User better Idea of Tests that failed)  
 
     if [ ! "$FAILCMDFILE" ]; then                            ## User has not mentioned about Failed File name
          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 +416,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 +637,18 @@ 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-
+    echo -e "OUTPUT File: \c"
+    echo $OUTPUTFILE | cut -b4-
+    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 +683,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 +764,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

Reply via email to