Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Siplyfy function for test step execution
Browse files Browse the repository at this point in the history
  • Loading branch information
joergboe committed Oct 9, 2019
1 parent 12048cd commit 0e3deb6
Showing 1 changed file with 23 additions and 38 deletions.
61 changes: 23 additions & 38 deletions bin/coreutil.sh
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ TTTF_executeSteps() {
local -r failureIsError="$7"
local -r supressVarName="$8"
local -r counterName="$9"


local -a commandArray=();
local TTTI_name_xyza
for TTTI_name_xyza in "$oldVarName" "$varName"; do
if isExisting "$TTTI_name_xyza"; then
Expand All @@ -476,59 +477,43 @@ TTTF_executeSteps() {
for (( TTTI_i_xyza=0; TTTI_i_xyza<TTTI_l_xyza; TTTI_i_xyza++)); do
local TTTI_step_xyza
eval "TTTI_step_xyza=\${$TTTI_name_xyza[$TTTI_i_xyza]}"
if isExistingAndTrue "$supressVarName"; then
printInfo "Suppress $script $name: $TTTI_step_xyza"
else
printInfo "Execute $script $name: $TTTI_step_xyza"
eval "$counterName=\$(($counterName+1))"
eval "$TTTI_step_xyza"
fi
if [[ -n $failureIsError && -n $TTTT_failureOccurred ]]; then
printError "Failure condition during $script $name: $TTTT_failureOccurred"
return 1
fi
if [[ -n $breakOnFailure && -n $TTTT_failureOccurred ]]; then
break 2
fi
commandArray+=( "$TTTI_step_xyza" )
done
else
local TTTI_x_xyza
for TTTI_x_xyza in ${!TTTI_name_xyza}; do
if isExistingAndTrue "$supressVarName"; then
printInfo "Suppress $script $name: $TTTI_x_xyza"
else
printInfo "Execute $script $name: $TTTI_x_xyza"
eval "$counterName=\$(($counterName+1))"
eval "${TTTI_x_xyza}"
fi
if [[ -n $failureIsError && -n $TTTT_failureOccurred ]]; then
printError "Failure condition during $script $name: $TTTT_failureOccurred"
return 1
fi
if [[ -n $breakOnFailure && -n $TTTT_failureOccurred ]]; then
break 2
fi
commandArray+=( "$TTTI_x_xyza" )
done
fi
fi
done
if isFunction "$funcname"; then
commandArray+=( "$funcname" )
fi

local cmd
local i
for ((i=0; i<${#commandArray[*]}; i++)); do
cmd="${commandArray[$i]}"
if isExistingAndTrue "$supressVarName"; then
printInfo "Suppress $script $name: $funcname"
printInfo "Suppress $script $name: $cmd"
else
printInfo "Execute $script $name: $funcname"
printInfo "Execute $script $name: $cmd"
eval "$counterName=\$(($counterName+1))"
eval "$funcname"
if [[ -n $failureIsError && -n $TTTT_failureOccurred ]]; then
printError "Failure condition during $script $name: $funcname"
return 1
fi
eval "$cmd"
fi
fi
if [[ -n $failureIsError && -n $TTTT_failureOccurred ]]; then
printError "Failure condition during $script $name: $TTTT_failureOccurred"
return 1
fi
if [[ -n $breakOnFailure && -n $TTTT_failureOccurred ]]; then
break
fi
done

TTTF_fixPropsVars

printInfo "${!counterName} $script $name steps executed"

}
readonly -f TTTF_executeSteps

Expand Down

0 comments on commit 0e3deb6

Please sign in to comment.