diff options
author | Zorro Lang <zlang@redhat.com> | 2016-09-26 21:19:49 +0800 |
---|---|---|
committer | Cyril Hrubis <chrubis@suse.cz> | 2016-09-27 13:22:23 +0200 |
commit | 8aa21025551c948bf1e76ea1cbad82f0dbc2633f (patch) | |
tree | 7e0f84a11f2690f5e9dd51e738a17b92936a8804 /runltp | |
parent | 1ba749bbf9a06766e35d632967d61ec22078e9f2 (diff) |
runltp: add -R option for randomize test order
Generally we write test entries into runtests/${testfile}, then
runltp reads and runs lines sequentially everytime, nearly no one
will change the test order.
Recently we find bugs by change the test order-different test
combination maybe find more bugs. So I add this new option -R to
randomize test order.
Signed-off-by: Zorro Lang <zlang@redhat.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
Diffstat (limited to 'runltp')
-rwxr-xr-x | runltp | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -153,6 +153,7 @@ usage() -p Human readable format logfiles. -q Print less verbose output to screen. -r LTPROOT Fully qualified path where testsuite is installed. + -R Randomize test order. -s PATTERN Only run test cases which match PATTERN. -S SKIPFILE Skip tests specified in SKIPFILE -t DURATION Execute the testsuite for given duration. Examples: @@ -213,12 +214,13 @@ main() local EMAIL_TO="" local TAG_RESTRICT_STRING="" local PAN_COMMAND="" + local RANDOMRUN=0 local DEFAULT_FILE_NAME_GENERATION_TIME=`date +"%Y_%m_%d-%Hh_%Mm_%Ss"` local scenfile= version_date=$(cat "$LTPROOT/Version") - while getopts a:c:C:T:d:D:f:F:ehi:I:K:g:l:m:M:Nno:pqr:s:S:t:T:w:x:b:B:z:Z: arg + while getopts a:c:C:T:d:D:f:F:ehi:I:K:g:l:m:M:Nno:pqr:Rs:S:t:T:w:x:b:B:z:Z: arg do case $arg in a) EMAIL_TO=$OPTARG ALT_EMAIL_OUT=1;; @@ -410,6 +412,8 @@ main() r) LTPROOT=$OPTARG;; + R) RANDOMRUN=1;; + s) TAG_RESTRICT_STRING=$OPTARG;; S) case $OPTARG in @@ -740,6 +744,10 @@ main() done fi + if [ "$RANDOMRUN" != "0" ]; then + sort -R ${TMP}/alltests -o ${TMP}/alltests + fi + [ ! -z "$QUIET_MODE" ] && { echo "INFO: Test start time: $(date)" ; } PAN_COMMAND="${LTPROOT}/bin/ltp-pan $QUIET_MODE -e -S $INSTANCES $DURATION -a $$ \ -n $$ $PRETTY_PRT -f ${TMP}/alltests $LOGFILE $OUTPUTFILE $FAILCMDFILE $TCONFCMDFILE" |