diff --git a/bin/coreutil.sh b/bin/coreutil.sh index d9b44da..5124cbf 100644 --- a/bin/coreutil.sh +++ b/bin/coreutil.sh @@ -195,13 +195,13 @@ readonly -f TTTF_fixPropsVars # $1 is the filename to read # return 0 in success case # return 1 if an invalid preambl was read; -# results are returned in global variables variantCount, variantList, timeout +# results are returned in global variables variantCount, variantList, timeout, exclusive function TTTF_evalPreambl { isDebug && printDebug "$FUNCNAME $1" if [[ ! -r $1 ]]; then printErrorAndExit "${FUNCNAME} : Can not open file=$1 for read" ${errRt} fi - variantCount=""; variantList="" + variantCount=""; variantList=""; timeout=''; exclusive='' declare -i lineno=1 { local varname= @@ -257,6 +257,13 @@ function TTTF_evalPreambl { fi isVerbose && printVerbose "timeout='${timeout}'" ;; + exclusive ) + if ! eval "exclusive=${value}"; then + printError "${FUNCNAME} : Invalid value in file=$1 line=$lineno '$preamblLine'" + return 1 + fi + isVerbose && printVerbose "exclusive='${exclusive}'" + ;; * ) #other property or variable printError "${FUNCNAME} : Invalid preambl varname='$varname' in file $1 line=$lineno '$preamblLine'" diff --git a/bin/man.sh b/bin/man.sh index 7c253ca..258fd8b 100644 --- a/bin/man.sh +++ b/bin/man.sh @@ -145,7 +145,8 @@ function manpage () { No spaces are allowed between name '=' and value. The assignement requires the same quoting as a reqular bash assignement. The assignment can use a continuation line if the line ends with an escaped newline character (backlslash before newline) The continuation line must also start with #-- - The preamble may define the variants of the test artifact and in case of a test case, the timeout value for the test case. + The preamble may define the variants of the test artifact and in case of a test case, the timeout value and + boolean property exclusiveExecution for the test case. ## Test Collection, Test Case and Test Suite variants ===================================================== @@ -173,7 +174,13 @@ function manpage () { Each test Case can define an individual test Case timeout. This can be done in the Test Case File Preamble like: #--timeout=600 - The individual test case timeout is used if the value is greater than TTPR_timeout or if the value is greater than $defaultTimeout. + The individual test case timeout is used if the value is greater than TTPR_timeout (if exists) or if the value is greater than $defaultTimeout. + + ## Test Case exclusive execution property + ========================================= + If the preamble contains a line + #--exclusiveExecution=true + the test case is always executed as a single case and no parallel execution is done. ## Reserved Variable Name Ranges =============================== diff --git a/bin/suite.sh b/bin/suite.sh index 3236743..ea512e2 100755 --- a/bin/suite.sh +++ b/bin/suite.sh @@ -57,8 +57,8 @@ trap errorTrapFunc ERR #check if one of the global vars is used in user code checkGlobalVarsUsed() { - if isExisting 'variantCount' || isExisting 'variantList' || isExisting 'timeout'; then - printErrorAndExit "On of variables variantCount, variantList or timeout is used in suite user code suite $TTRO_suite" $errSuiteError + if isExisting 'variantCount' || isExisting 'variantList' || isExisting 'timeout' || isExisting 'exclusive'; then + printErrorAndExit "On of variables variantCount, variantList, timeout or exclusive is used in suite user code suite $TTRO_suite" $errSuiteError fi } @@ -237,18 +237,20 @@ declare -a TTTI_caseVariantPathes=() #the case path of all case variants declare -a TTTI_caseVariantIds=() #the variant id of all cases declare -a TTTI_caseVariantWorkdirs=() #the workdir of each variant declare -a TTTI_casePreambErrors=() #true if case has peambl error +declare -a TTTI_caseExclusiveExecution=() #if true the case requires exclusive execution declare -ai TTTI_caseTimeout=() #the individual timeout declare -i TTTI_noCaseVariants=0 #the overall number of case variants -declare variantCount='' variantList='' timeout='' TTTI_preamblError='' +declare variantCount='' variantList='' timeout='' exclusive='' TTTI_preamblError='' for ((TTTI_i=0; TTTI_i&1 | tee -i "${cworkdir}/${TEST_LOG}" & @@ -674,12 +685,14 @@ startNewJobs() { TTTI_tendTime[$freeSlot]=$((TTTI_now+jobTimeout)) TTTI_ttimeout[$freeSlot]="$jobTimeout" TTTI_tcaseWorkDir[$freeSlot]="$cworkdir" + TTTI_texclusiveExecution[$freeSlot]="$caseExclusiveExecution" TTTI_jobIndex=$((TTTI_jobIndex+1)) if [[ ( $TTTI_interruptReceived -gt 0 ) || ( $TTTI_jobIndex -ge $TTTI_noCaseVariants ) ]]; then TTTI_nextJobIndexToStart='' else TTTI_nextJobIndexToStart="$TTTI_jobIndex" fi + if checkExclusiveRequest; then TTTI_currentParralelJobsEffective=1; else TTTI_currentParralelJobsEffective="$TTTI_currentParralelJobs"; fi done } #/startNewJobs @@ -689,11 +702,31 @@ startNewJobs() { checkSystemLoad() { : } + +# check whether exclusive execution is active +# return true if so +checkExclusiveRequest() { + if [[ -n $TTTI_nextJobIndexToStart ]]; then + if [[ -n ${TTTI_caseExclusiveExecution[$TTTI_nextJobIndexToStart]} ]]; then + isDebug && printDebug "next job to start $TTTI_nextJobIndexToStart requires exclusive execution" + return 0 + fi + fi + local i + for ((i=0; i