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