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..." |
Thomas Vachuska | 57835ff | 2017-02-27 10:23:23 -0800 | [diff] [blame] | 15 | mkdir -p /tmp/stc |
Jon Hall | a67dc45 | 2017-02-15 16:01:17 -0800 | [diff] [blame] | 16 | aux=/tmp/stc/stc-$$.log |
Thomas Vachuska | 426d356 | 2016-06-02 19:36:51 -0700 | [diff] [blame] | 17 | mvn dependency:get -Dartifact=org.onosproject:onos-stc:$VER -Dtransitive=false -B >$aux || fgrep '[ERROR]' $aux |
| 18 | rm -f $aux |
| 19 | [ -f $JAR ] && printf "Done.\n" |
| 20 | fi |
| 21 | |
Thomas Vachuska | 177ece6 | 2015-06-26 00:18:21 -0700 | [diff] [blame] | 22 | DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y" |
| 23 | |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 24 | scenario=${1:-smoke} |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 25 | |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 26 | [ ! -f $scenario ] && scenario=$SCENARIOS/$scenario |
| 27 | [ ! -f $scenario ] && scenario=$scenario.xml |
| 28 | [ ! -f $scenario ] && echo "Scenario $scenario file not found" && exit 1 |
| 29 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 30 | # 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] | 31 | [ $# -ge 1 ] && shift |
| 32 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 33 | # If stcColor is not set, we will enable color if this is an interactive session |
| 34 | [ -t 1 ] && interactive=true || interactive=false |
Thomas Vachuska | 7c5b653 | 2015-11-02 14:50:33 -0800 | [diff] [blame] | 35 | [ -t 1 ] && notInteractive=false || notInteractive=true |
Thomas Vachuska | 50ec1af | 2015-06-02 00:42:52 -0700 | [diff] [blame] | 36 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 37 | # Run stc |
Thomas Vachuska | 1b403a5 | 2015-08-26 11:30:48 -0700 | [diff] [blame] | 38 | [ -z "$stcDebug" ] && DEBUG_OPTS="" |
Thomas Vachuska | a3029cf | 2016-08-23 16:47:46 -0700 | [diff] [blame] | 39 | stcTitle=${stcTitle:-} stcColor=${stcColor:-$interactive} stcDumpLogs=${stcDumpLogs:-$notInteractive} \ |
Thomas Vachuska | 7c5b653 | 2015-11-02 14:50:33 -0800 | [diff] [blame] | 40 | java $DEBUG_OPTS -jar $JAR $scenario "$@" |