Index: ltp-full-20120903/runltp =================================================================== --- ltp-full-20120903.orig/runltp +++ ltp-full-20120903/runltp @@ -76,7 +76,7 @@ setup() echo "FATAL: unable to change directory to $(dirname $0)" exit 1 } - export LTPROOT=${PWD} + export LTPROOT=/usr/libexec/ltp export TMPBASE="/tmp" export PATH="${PATH}:${LTPROOT}/testcases/bin" @@ -230,7 +230,7 @@ main() /*) FAILCMDFILE="-C $OPTARG" ;; *) - FAILCMDFILE="-C $LTPROOT/output/$OPTARG" + FAILCMDFILE="-C $TMPBASE/output/$OPTARG" ALT_DIR_OUT=1 ;; esac ;; @@ -298,7 +298,7 @@ main() /*) HTMLFILE="$OPTARG";; *) - HTMLFILE="$LTPROOT/output/$OPTARG";; + HTMLFILE="$TMPBASE/output/$OPTARG";; esac ALT_DIR_OUT=1 ALT_HTML_OUT=1;; @@ -319,7 +319,7 @@ main() /*) DMESG_DIR="$OPTARG-dmesg-output-`echo $$-``date +%X | tr -d ' '`";; *) - DMESG_DIR="$LTPROOT/output/$OPTARG-dmesg-output-`echo $$-``date +%X | tr -d ' '`";; + DMESG_DIR="$TMPBASE/output/$OPTARG-dmesg-output-`echo $$-``date +%X | tr -d ' '`";; esac mkdir -p $DMESG_DIR ALT_DMESG_OUT=1;; @@ -329,7 +329,7 @@ main() /*) LOGFILE="-l $OPTARG" ;; *) - LOGFILE="-l $LTPROOT/results/$OPTARG" + LOGFILE="-l $TMPBASE/results/$OPTARG" ALT_DIR_RES=1 ;; esac ;; @@ -384,7 +384,7 @@ main() /*) OUTPUTFILE="-o $OPTARG";; *) - OUTPUTFILE="-o $LTPROOT/output/$OPTARG" + OUTPUTFILE="-o $TMPBASE/output/$OPTARG" ALT_DIR_OUT=1 ;; esac ;; @@ -431,7 +431,7 @@ main() ## 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" + LOGFILE="-l $TMPBASE/results/LTP_RUN_ON-$LOGFILE_NAME.log" ALT_DIR_RES=1 PRETTY_PRT=" -p " fi @@ -443,14 +443,14 @@ main() 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=$DEFAULT_FILE_NAME_GENERATION_TIME - FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" + FAILCMDFILE="-C $TMPBASE/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 - FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" + FAILCMDFILE="-C $TMPBASE/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" fi else ## User Fortunately wanted a Output file FAILED_FILE_NAME=`basename $OUTPUTFILE_NAME` ## Extract output file name and use it to construct Failed file name - FAILCMDFILE="-C $LTPROOT/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" + FAILCMDFILE="-C $TMPBASE/output/LTP_RUN_ON-$FAILED_FILE_NAME.failed" fi fi @@ -459,11 +459,11 @@ main() ## 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=$DEFAULT_FILE_NAME_GENERATION_TIME - OUTPUTFILE="-o $LTPROOT/output/LTP_RUN_ON-$OUTPUTFILE_NAME.output" + OUTPUTFILE="-o $TMPBASE/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 HTMLFILE_NAME=`basename $OUTPUTFILE_NAME` - HTMLFILE="$LTPROOT/output/$HTMLFILE_NAME.html" + HTMLFILE="$TMPBASE/output/$HTMLFILE_NAME.html" fi fi fi @@ -471,12 +471,12 @@ main() # If we need, create the output directory [ "$ALT_DIR_OUT" -eq 1 ] && \ { - [ ! -d $LTPROOT/output ] && \ + [ ! -d $TMPBASE/output ] && \ { - echo "INFO: creating $LTPROOT/output directory" - mkdir -p $LTPROOT/output || \ + echo "INFO: creating $TMPBASE/output directory" + mkdir -p $TMPBASE/output || \ { - echo "ERROR: failed to create $LTPROOT/output" + echo "ERROR: failed to create $TMPBASE/output" exit 1 } } @@ -484,12 +484,12 @@ main() # If we need, create the results directory [ "$ALT_DIR_RES" -eq 1 ] && \ { - echo "INFO: creating $LTPROOT/results directory" - [ ! -d $LTPROOT/results ] && \ + echo "INFO: creating $TMPBASE/results directory" + [ ! -d $TMPBASE/results ] && \ { - mkdir -p $LTPROOT/results || \ + mkdir -p $TMPBASE/results || \ { - echo "ERROR: failed to create $LTPROOT/results" + echo "ERROR: failed to create $TMPBASE/results" exit 1 } } @@ -867,8 +867,8 @@ main() export TEST_START_TIME=$test_start_time export TEST_END_TIME=$(date) OUTPUT_DIRECTORY=`echo $OUTPUTFILE | cut -c4-` - LOGS_DIRECTORY="$LTPROOT/results" - export TEST_OUTPUT_DIRECTORY="$LTPROOT/output" + LOGS_DIRECTORY="$TMPBASE/results" + export TEST_OUTPUT_DIRECTORY="$TMPBASE/output" export TEST_LOGS_DIRECTORY=$LOGS_DIRECTORY echo "Generating HTML Output.....!!" ( perl $LTPROOT/bin/genhtml.pl $LTPROOT/bin/html_report_header.txt test_start test_end test_output execution_status $OUTPUT_DIRECTORY > $HTMLFILE; ) @@ -884,37 +884,37 @@ main() else 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 - cp $HTMLFILE_NAME $LTPROOT/output/ + if [ "$ALT_HTML_OUT" -ne 1 ] ; then ## The HTML file path is absolute and not $TMPBASE/output + mkdir -p $TMPBASE/output ## We need to create this Directory + cp $HTMLFILE_NAME $TMPBASE/output/ fi fi if [ "$OUTPUTFILE_NAME" ] ; then ## Output file exists - if [ "$ALT_DIR_OUT" -ne 1 ] ; then ## The Output file path is absolute and not $LTPROOT/output - mkdir -p $LTPROOT/output ## We need to create this Directory - cp $OUTPUTFILE_NAME $LTPROOT/output/ + if [ "$ALT_DIR_OUT" -ne 1 ] ; then ## The Output file path is absolute and not $TMPBASE/output + mkdir -p $TMPBASE/output ## We need to create this Directory + cp $OUTPUTFILE_NAME $TMPBASE/output/ fi fi if [ "$LOGFILE_NAME" ] ; then ## Log file exists - if [ "$ALT_DIR_RES" -ne 1 ] ; then ## The Log file path is absolute and not $LTPROOT/results - mkdir -p $LTPROOT/results ## We need to create this Directory - cp $LOGFILE_NAME $LTPROOT/results/ + if [ "$ALT_DIR_RES" -ne 1 ] ; then ## The Log file path is absolute and not $TMPBASE/results + mkdir -p $TMPBASE/results ## We need to create this Directory + cp $LOGFILE_NAME $TMPBASE/results/ fi fi - if [ -d $LTPROOT/output ] ; then - tar -cf ./$TAR_FILE_NAME $LTPROOT/output + if [ -d $TMPBASE/output ] ; then + tar -cf ./$TAR_FILE_NAME $TMPBASE/output if [ $? -eq 0 ]; then - echo "Created TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/output" + echo "Created TAR File: ./$TAR_FILE_NAME successfully, added $TMPBASE/output" else - echo "Cannot Create TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/output" + echo "Cannot Create TAR File: ./$TAR_FILE_NAME for adding $TMPBASE/output" fi fi - if [ -d $LTPROOT/results ] ; then - tar -uf ./$TAR_FILE_NAME $LTPROOT/results + if [ -d $TMPBASE/results ] ; then + tar -uf ./$TAR_FILE_NAME $TMPBASE/results if [ $? -eq 0 ]; then - echo "Updated TAR File: ./$TAR_FILE_NAME successfully, added $LTPROOT/results" + echo "Updated TAR File: ./$TAR_FILE_NAME successfully, added $TMPBASE/results" else - echo "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $LTPROOT/results" + echo "Cannot Update TAR File: ./$TAR_FILE_NAME for adding $TMPBASE/results" fi fi if [ -e $LTPROOT/nohup.out ] ; then ## If User would have Chosen nohup to do ltprun