Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # System Test Coordinator |
| 4 | #------------------------------------------------------------------------------- |
| 5 | |
Brian O'Connor | 880dc20d | 2015-12-16 22:53:14 -0800 | [diff] [blame] | 6 | VER=1.5.0-SNAPSHOT |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 7 | JAR=~/.m2/repository/org/onosproject/onlab-stc/$VER/onlab-stc-$VER.jar |
| 8 | SCENARIOS=$ONOS_ROOT/tools/test/scenarios |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 9 | |
Thomas Vachuska | 177ece6 | 2015-06-26 00:18:21 -0700 | [diff] [blame] | 10 | DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y" |
| 11 | |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 12 | scenario=${1:-smoke} |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 13 | |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 14 | [ ! -f $scenario ] && scenario=$SCENARIOS/$scenario |
| 15 | [ ! -f $scenario ] && scenario=$scenario.xml |
| 16 | [ ! -f $scenario ] && echo "Scenario $scenario file not found" && exit 1 |
| 17 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 18 | # Remove the test name from the list of parameters, if one is specified |
Thomas Vachuska | 50ec1af | 2015-06-02 00:42:52 -0700 | [diff] [blame] | 19 | [ $# -ge 1 ] && shift |
| 20 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 21 | # If stcColor is not set, we will enable color if this is an interactive session |
| 22 | [ -t 1 ] && interactive=true || interactive=false |
Thomas Vachuska | 7c5b653 | 2015-11-02 14:50:33 -0800 | [diff] [blame] | 23 | [ -t 1 ] && notInteractive=false || notInteractive=true |
Thomas Vachuska | 50ec1af | 2015-06-02 00:42:52 -0700 | [diff] [blame] | 24 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 25 | # stc requires that ONOS_USE_SSH=true, but we will store the old value and reset it after |
| 26 | sshSet=$([ -z ${ONOS_USE_SSH+x} ]) && oldSSH=$ONOS_USE_SSH |
| 27 | export ONOS_USE_SSH=true |
| 28 | |
| 29 | # Run stc |
Thomas Vachuska | 1b403a5 | 2015-08-26 11:30:48 -0700 | [diff] [blame] | 30 | [ -z "$stcDebug" ] && DEBUG_OPTS="" |
Thomas Vachuska | 7c5b653 | 2015-11-02 14:50:33 -0800 | [diff] [blame] | 31 | stcColor=${stcColor:-$interactive} stcDumpLogs=${stcDumpLogs:-$notInteractive} \ |
| 32 | java $DEBUG_OPTS -jar $JAR $scenario "$@" |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 33 | |
| 34 | # Reset the old value of ONOS_USE_SSH |
| 35 | [ $sshSet ] && export ONOS_USE_SSH=oldSSH || unset ONOS_USE_SSH |