public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] Change the function of runltp command line option -s
@ 2012-10-15  5:39 jin.li
  2012-10-15  5:39 ` [LTP] [PATCH] runltp: Change -s option to select single case instead of matched name string of case jin.li
  0 siblings, 1 reply; 4+ messages in thread
From: jin.li @ 2012-10-15  5:39 UTC (permalink / raw)
  To: jin.li, ltp-list; +Cc: haotian.zhang

Hi Caspar,

I made some improvement about runltp script. Please help me to review it.

Thanks,

Jin

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] runltp: Change -s option to select single case instead of matched name string of case
  2012-10-15  5:39 [LTP] Change the function of runltp command line option -s jin.li
@ 2012-10-15  5:39 ` jin.li
  2012-10-16  2:35   ` Wanlong Gao
  2012-10-16  3:46   ` Caspar Zhang
  0 siblings, 2 replies; 4+ messages in thread
From: jin.li @ 2012-10-15  5:39 UTC (permalink / raw)
  To: jin.li, ltp-list; +Cc: haotian.zhang

From: Jin Li <jin.li@windriver.com>

The scenario group file can be used if a set of related test cases need executing
at one time. Therefore, it's better to use runltp -s to select single test case.

Also, it is not a good practice to bind the option format of runltp with the implementation
of runltp internal code.Say the test case ar should be invoked in this way:

./runltp -s ar

instead of

./runltp -s "^ar "

Signed-off-by: Jin Li <jin.li@windriver.com>
---
 runltp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/runltp b/runltp
index f95c17b..7788275 100755
--- a/runltp
+++ b/runltp
@@ -150,7 +150,7 @@ usage()
     -p              Human readable format logfiles. 
     -q              Print less verbose output to screen.
     -r LTPROOT      Fully qualified path where testsuite is installed.
-    -s PATTERN      Only run test cases which match PATTERN.
+    -s TESTCASE     Only run single test case.
     -S SKIPFILE     Skip tests specified in SKIPFILE
     -t DURATION     Execute the testsuite for given duration. Examples:
                       -t 60s = 60 seconds
@@ -203,7 +203,7 @@ main()
     local HTMLFILE=""
     local DMESG_DIR=""
     local EMAIL_TO=""
-    local TAG_RESTRICT_STRING=""
+    local TESTCASE=""
     local PAN_COMMAND=""
     local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
 
@@ -394,7 +394,7 @@ main()
     
         r)  LTPROOT=$OPTARG;;
     
-        s)  TAG_RESTRICT_STRING=$OPTARG;;
+        s)  TESTCASE=$OPTARG;;
 
 	S)  case $OPTARG in
             /*)
@@ -647,11 +647,11 @@ main()
          }
     }
 
-    # If enabled, execute only test cases that match the PATTERN
-    if [ -n "$TAG_RESTRICT_STRING" ]
+    # If enabled, execute single test cases
+    if [ -n "$TESTCASE" ]
     then
         mv -f ${TMP}/alltests ${TMP}/alltests.orig
-	    grep $TAG_RESTRICT_STRING ${TMP}/alltests.orig > ${TMP}/alltests #Not worth checking return codes for this case
+	    grep "^$TESTCASE " ${TMP}/alltests.orig > ${TMP}/alltests #Not worth checking return codes for this case
     fi
 
     # Blacklist or skip tests if a SKIPFILE was specified with -S
@@ -743,8 +743,8 @@ main()
     PAN_COMMAND="${LTPROOT}/bin/ltp-pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
     -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE"
     echo "COMMAND:    $PAN_COMMAND"
-    if [ ! -z "$TAG_RESTRICT_STRING" ] ; then
-      echo "INFO: Restricted to $TAG_RESTRICT_STRING"
+    if [ ! -z "$TESTCASE" ] ; then
+      echo "INFO: Run single test case $TESTCASE"
     fi
     #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output
     
-- 
1.7.11


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH] runltp: Change -s option to select single case instead of matched name string of case
  2012-10-15  5:39 ` [LTP] [PATCH] runltp: Change -s option to select single case instead of matched name string of case jin.li
@ 2012-10-16  2:35   ` Wanlong Gao
  2012-10-16  3:46   ` Caspar Zhang
  1 sibling, 0 replies; 4+ messages in thread
From: Wanlong Gao @ 2012-10-16  2:35 UTC (permalink / raw)
  To: jin.li; +Cc: ltp-list, haotian.zhang

On 10/15/2012 01:39 PM, jin.li@windriver.com wrote:
> From: Jin Li <jin.li@windriver.com>
> 
> The scenario group file can be used if a set of related test cases need executing
> at one time. Therefore, it's better to use runltp -s to select single test case.
> 
> Also, it is not a good practice to bind the option format of runltp with the implementation
> of runltp internal code.Say the test case ar should be invoked in this way:
> 
> ./runltp -s ar
> 
> instead of
> 
> ./runltp -s "^ar "

I don't think yours is better than matching with a PATTERN, so I vote to the original implementation.

Thanks,
Wanlong Gao

> 
> Signed-off-by: Jin Li <jin.li@windriver.com>
> ---
>  runltp | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/runltp b/runltp
> index f95c17b..7788275 100755
> --- a/runltp
> +++ b/runltp
> @@ -150,7 +150,7 @@ usage()
>      -p              Human readable format logfiles. 
>      -q              Print less verbose output to screen.
>      -r LTPROOT      Fully qualified path where testsuite is installed.
> -    -s PATTERN      Only run test cases which match PATTERN.
> +    -s TESTCASE     Only run single test case.
>      -S SKIPFILE     Skip tests specified in SKIPFILE
>      -t DURATION     Execute the testsuite for given duration. Examples:
>                        -t 60s = 60 seconds
> @@ -203,7 +203,7 @@ main()
>      local HTMLFILE=""
>      local DMESG_DIR=""
>      local EMAIL_TO=""
> -    local TAG_RESTRICT_STRING=""
> +    local TESTCASE=""
>      local PAN_COMMAND=""
>      local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
>  
> @@ -394,7 +394,7 @@ main()
>      
>          r)  LTPROOT=$OPTARG;;
>      
> -        s)  TAG_RESTRICT_STRING=$OPTARG;;
> +        s)  TESTCASE=$OPTARG;;
>  
>  	S)  case $OPTARG in
>              /*)
> @@ -647,11 +647,11 @@ main()
>           }
>      }
>  
> -    # If enabled, execute only test cases that match the PATTERN
> -    if [ -n "$TAG_RESTRICT_STRING" ]
> +    # If enabled, execute single test cases
> +    if [ -n "$TESTCASE" ]
>      then
>          mv -f ${TMP}/alltests ${TMP}/alltests.orig
> -	    grep $TAG_RESTRICT_STRING ${TMP}/alltests.orig > ${TMP}/alltests #Not worth checking return codes for this case
> +	    grep "^$TESTCASE " ${TMP}/alltests.orig > ${TMP}/alltests #Not worth checking return codes for this case
>      fi
>  
>      # Blacklist or skip tests if a SKIPFILE was specified with -S
> @@ -743,8 +743,8 @@ main()
>      PAN_COMMAND="${LTPROOT}/bin/ltp-pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
>      -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE"
>      echo "COMMAND:    $PAN_COMMAND"
> -    if [ ! -z "$TAG_RESTRICT_STRING" ] ; then
> -      echo "INFO: Restricted to $TAG_RESTRICT_STRING"
> +    if [ ! -z "$TESTCASE" ] ; then
> +      echo "INFO: Run single test case $TESTCASE"
>      fi
>      #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output
>      
> 


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH] runltp: Change -s option to select single case instead of matched name string of case
  2012-10-15  5:39 ` [LTP] [PATCH] runltp: Change -s option to select single case instead of matched name string of case jin.li
  2012-10-16  2:35   ` Wanlong Gao
@ 2012-10-16  3:46   ` Caspar Zhang
  1 sibling, 0 replies; 4+ messages in thread
From: Caspar Zhang @ 2012-10-16  3:46 UTC (permalink / raw)
  To: jin.li; +Cc: ltp-list, haotian.zhang

On 10/15/2012 01:39 PM, jin.li@windriver.com wrote:
> From: Jin Li <jin.li@windriver.com>
>
> The scenario group file can be used if a set of related test cases need executing
> at one time. Therefore, it's better to use runltp -s to select single test case.

This sounds not that convincible to me... Yes, group file can be used in 
such situation, but we need to create a separate one. Using pattern 
match would be much easier to me.

>
> Also, it is not a good practice to bind the option format of runltp with the implementation
> of runltp internal code.Say the test case ar should be invoked in this way:

I don't think this is a bad practice... it just behaviors like "grep" 
does, doesn't it?

>
> ./runltp -s ar
>
> instead of
>
> ./runltp -s "^ar "

So, NAK to the design :-(

You're removing the implementation of pattern match -- someone else 
might want this feature.

Comments welcomed.

Thanks,
Caspar

>
> Signed-off-by: Jin Li <jin.li@windriver.com>
> ---
>   runltp | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/runltp b/runltp
> index f95c17b..7788275 100755
> --- a/runltp
> +++ b/runltp
> @@ -150,7 +150,7 @@ usage()
>       -p              Human readable format logfiles.
>       -q              Print less verbose output to screen.
>       -r LTPROOT      Fully qualified path where testsuite is installed.
> -    -s PATTERN      Only run test cases which match PATTERN.
> +    -s TESTCASE     Only run single test case.
>       -S SKIPFILE     Skip tests specified in SKIPFILE
>       -t DURATION     Execute the testsuite for given duration. Examples:
>                         -t 60s = 60 seconds
> @@ -203,7 +203,7 @@ main()
>       local HTMLFILE=""
>       local DMESG_DIR=""
>       local EMAIL_TO=""
> -    local TAG_RESTRICT_STRING=""
> +    local TESTCASE=""
>       local PAN_COMMAND=""
>       local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
>
> @@ -394,7 +394,7 @@ main()
>
>           r)  LTPROOT=$OPTARG;;
>
> -        s)  TAG_RESTRICT_STRING=$OPTARG;;
> +        s)  TESTCASE=$OPTARG;;
>
>   	S)  case $OPTARG in
>               /*)
> @@ -647,11 +647,11 @@ main()
>            }
>       }
>
> -    # If enabled, execute only test cases that match the PATTERN
> -    if [ -n "$TAG_RESTRICT_STRING" ]
> +    # If enabled, execute single test cases
> +    if [ -n "$TESTCASE" ]
>       then
>           mv -f ${TMP}/alltests ${TMP}/alltests.orig
> -	    grep $TAG_RESTRICT_STRING ${TMP}/alltests.orig > ${TMP}/alltests #Not worth checking return codes for this case
> +	    grep "^$TESTCASE " ${TMP}/alltests.orig > ${TMP}/alltests #Not worth checking return codes for this case
>       fi
>
>       # Blacklist or skip tests if a SKIPFILE was specified with -S
> @@ -743,8 +743,8 @@ main()
>       PAN_COMMAND="${LTPROOT}/bin/ltp-pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \
>       -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE"
>       echo "COMMAND:    $PAN_COMMAND"
> -    if [ ! -z "$TAG_RESTRICT_STRING" ] ; then
> -      echo "INFO: Restricted to $TAG_RESTRICT_STRING"
> +    if [ ! -z "$TESTCASE" ] ; then
> +      echo "INFO: Run single test case $TESTCASE"
>       fi
>       #$PAN_COMMAND #Duplicated code here, because otherwise if we fail, only "PAN_COMMAND" gets output
>
>


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-16  4:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-15  5:39 [LTP] Change the function of runltp command line option -s jin.li
2012-10-15  5:39 ` [LTP] [PATCH] runltp: Change -s option to select single case instead of matched name string of case jin.li
2012-10-16  2:35   ` Wanlong Gao
2012-10-16  3:46   ` Caspar Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox