Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # System Test Coordinator |
| 4 | #------------------------------------------------------------------------------- |
| 5 | |
Thomas Vachuska | 426d356 | 2016-06-02 19:36:51 -0700 | [diff] [blame] | 6 | VER=${STC_VERSION:-2.0} |
| 7 | JAR=~/.m2/repository/org/onosproject/onos-stc/$VER/onos-stc-$VER.jar |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 8 | SCENARIOS=$ONOS_ROOT/tools/test/scenarios |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 9 | |
Thomas Vachuska | 426d356 | 2016-06-02 19:36:51 -0700 | [diff] [blame] | 10 | # Download the STC binary if needed |
| 11 | if [ ! -f $JAR ]; then |
| 12 | printf "Downloading STC binary..." |
| 13 | aux=/tmp/stc-$$.log |
| 14 | mvn dependency:get -Dartifact=org.onosproject:onos-stc:$VER -Dtransitive=false -B >$aux || fgrep '[ERROR]' $aux |
| 15 | rm -f $aux |
| 16 | [ -f $JAR ] && printf "Done.\n" |
| 17 | fi |
| 18 | |
Thomas Vachuska | 177ece6 | 2015-06-26 00:18:21 -0700 | [diff] [blame] | 19 | DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y" |
| 20 | |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 21 | scenario=${1:-smoke} |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 22 | |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 23 | [ ! -f $scenario ] && scenario=$SCENARIOS/$scenario |
| 24 | [ ! -f $scenario ] && scenario=$scenario.xml |
| 25 | [ ! -f $scenario ] && echo "Scenario $scenario file not found" && exit 1 |
| 26 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 27 | # 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] | 28 | [ $# -ge 1 ] && shift |
| 29 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 30 | # If stcColor is not set, we will enable color if this is an interactive session |
| 31 | [ -t 1 ] && interactive=true || interactive=false |
Thomas Vachuska | 7c5b653 | 2015-11-02 14:50:33 -0800 | [diff] [blame] | 32 | [ -t 1 ] && notInteractive=false || notInteractive=true |
Thomas Vachuska | 50ec1af | 2015-06-02 00:42:52 -0700 | [diff] [blame] | 33 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 34 | # Run stc |
Thomas Vachuska | 1b403a5 | 2015-08-26 11:30:48 -0700 | [diff] [blame] | 35 | [ -z "$stcDebug" ] && DEBUG_OPTS="" |
Thomas Vachuska | 7c5b653 | 2015-11-02 14:50:33 -0800 | [diff] [blame] | 36 | stcColor=${stcColor:-$interactive} stcDumpLogs=${stcDumpLogs:-$notInteractive} \ |
| 37 | java $DEBUG_OPTS -jar $JAR $scenario "$@" |