Improvements to stc command
Add color for interactive sessions if stcColor is not set. export ONOS_USE_SSH=true for stc tests and then reset it original value Change-Id: I90d8c95efa91fbdeb97c3f33d601fef4d4bcb0f2
Showing
1 changed file
with
12 additions
and
2 deletions
| ... | @@ -15,9 +15,19 @@ scenario=${1:-smoke} | ... | @@ -15,9 +15,19 @@ scenario=${1:-smoke} |
| 15 | [ ! -f $scenario ] && scenario=$scenario.xml | 15 | [ ! -f $scenario ] && scenario=$scenario.xml |
| 16 | [ ! -f $scenario ] && echo "Scenario $scenario file not found" && exit 1 | 16 | [ ! -f $scenario ] && echo "Scenario $scenario file not found" && exit 1 |
| 17 | 17 | ||
| 18 | +# Remove the test name from the list of parameters, if one is specified | ||
| 18 | [ $# -ge 1 ] && shift | 19 | [ $# -ge 1 ] && shift |
| 19 | 20 | ||
| 20 | -[ -t 1 ] && stcColor=true || unset stcColor | 21 | +# If stcColor is not set, we will enable color if this is an interactive session |
| 22 | +[ -t 1 ] && interactive=true || interactive=false | ||
| 21 | 23 | ||
| 24 | +# stc requires that ONOS_USE_SSH=true, but we will store the old value and reset it after | ||
| 25 | +sshSet=$([ -z ${ONOS_USE_SSH+x} ]) && oldSSH=$ONOS_USE_SSH | ||
| 26 | +export ONOS_USE_SSH=true | ||
| 27 | + | ||
| 28 | +# Run stc | ||
| 22 | [ -z "$stcDebug" ] && DEBUG_OPTS="" | 29 | [ -z "$stcDebug" ] && DEBUG_OPTS="" |
| 23 | -java $DEBUG_OPTS -jar $JAR $scenario "$@" | 30 | +stcColor=${stcColor:-$interactive} java $DEBUG_OPTS -jar $JAR $scenario "$@" |
| 31 | + | ||
| 32 | +# Reset the old value of ONOS_USE_SSH | ||
| 33 | +[ $sshSet ] && export ONOS_USE_SSH=oldSSH || unset ONOS_USE_SSH | ... | ... |
-
Please register or login to post a comment