diff mbox series

runltp: Miscellaneous cleanups

Message ID 20210511092926.20509-1-caojin@uniontech.com
State Accepted
Headers show
Series runltp: Miscellaneous cleanups | expand

Commit Message

Cao jin May 11, 2021, 9:29 a.m. UTC
1. typofix: then --> than
2. Drop useless HTML file name creating code, as g: mandatorily requires
   argument.
3. Make direcotry create symmetrical. There is no need to always see:

        INFO: creating $LTPROOT/results directory

   except the real creation of it. Also indent the code.

4. fix a variable misnomer

Signed-off-by: Cao jin <caojin@uniontech.com>
---
 runltp | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

Comments

Cyril Hrubis May 11, 2021, 11:37 a.m. UTC | #1
Hi!
The changes looks good to me but at the moment we are fairly late in the
release process so this will have to wait for about two weeks before it
could be applied.
Cao jin May 12, 2021, 1:32 a.m. UTC | #2
On 5/11/21 7:37 PM, Cyril Hrubis wrote:
> Hi!
> The changes looks good to me but at the moment we are fairly late in the
> release process so this will have to wait for about two weeks before it
> could be applied.
> 

I am fine with that. Thanks, Cyril.

--
Cao jin
Petr Vorel June 7, 2021, 9:17 a.m. UTC | #3
Hi Cao jin, Cyril,

> On 5/11/21 7:37 PM, Cyril Hrubis wrote:
> > Hi!
> > The changes looks good to me but at the moment we are fairly late in the
> > release process so this will have to wait for about two weeks before it
> > could be applied.


> I am fine with that. Thanks, Cyril.
I added one more typo fix (seperate => separate) and merged.

FYI: runltp is very outdated we recommend to use runltp-ng [1].
It's not upstreamed yet, properly propagating timeout issue is the latest issue
we need to solve before upstreaming it into LTP and deprecating runltp.
We hope to make it in this release.

Kind regards,
Petr

[1] https://github.com/metan-ucw/runltp-ng/
[2] https://github.com/metan-ucw/runltp-ng/issues/31
diff mbox series

Patch

diff --git a/runltp b/runltp
index 7cd0c159f..29779b853 100755
--- a/runltp
+++ b/runltp
@@ -300,7 +300,7 @@  main()
             version_of_ltp
 	    ;;
         f)  # Execute user defined set of testcases.
-            # Can be more then one file, just separate it with ',', like:
+            # Can be more than one file, just separate it with ',', like:
             # -f nfs,commands,/tmp/testfile
             CMDFILES=$OPTARG;;
 	F)	INJECT_KERNEL_FAULT=1
@@ -502,10 +502,6 @@  main()
           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
-             HTMLFILE_NAME=`basename $OUTPUTFILE_NAME`
-             HTMLFILE="$LTPROOT/output/$HTMLFILE_NAME.html"
-          fi
        fi
     fi
 
@@ -522,16 +518,17 @@  main()
             }
         }
     }
+
     # If we need, create the results directory
     [ "$ALT_DIR_RES" -eq 1 ] && \
     {
-        echo "INFO: creating $LTPROOT/results directory"
         [ ! -d $LTPROOT/results ] && \
         {
-           mkdir -p $LTPROOT/results || \
-           {
-               echo "ERROR: failed to create $LTPROOT/results"
-               exit 1
+            echo "INFO: creating $LTPROOT/results directory"
+            mkdir -p $LTPROOT/results || \
+            {
+                echo "ERROR: failed to create $LTPROOT/results"
+                exit 1
             }
         }
     }
@@ -840,12 +837,12 @@  EOF
        export LTP_VERSION=$version_date
        export TEST_START_TIME="$test_start_time"
        export TEST_END_TIME="$(date)"
-       OUTPUT_DIRECTORY=`echo $OUTPUTFILE | cut -c4-`
+       OUTPUT_FILE=`echo $OUTPUTFILE | cut -c4-`
        LOGS_DIRECTORY="$LTPROOT/results"
        export TEST_OUTPUT_DIRECTORY="$LTPROOT/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; )
+       ( perl $LTPROOT/bin/genhtml.pl $LTPROOT/bin/html_report_header.txt test_start test_end test_output execution_status $OUTPUT_FILE  > $HTMLFILE; )
        echo "Generated HTML Output.....!!"
        echo "Location: $HTMLFILE";