Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # System Test Coordinator |
| 4 | #------------------------------------------------------------------------------- |
| 5 | |
Boyuan Yan | 1c27bc7 | 2019-02-15 19:22:19 +0000 | [diff] [blame] | 6 | # If specifiy another env init script, load it. |
| 7 | params=() |
| 8 | index=0 |
| 9 | for i in $@; do |
| 10 | key=`echo $i | awk -F '=' '{print $1}'` |
| 11 | if [ "$key" == "-ENV_DEFAULT" ]; then |
| 12 | val=`echo $i | awk -F '=' '{print $2}'` |
| 13 | source $val |
| 14 | else |
| 15 | params[$index]=$i |
| 16 | let index+=1 |
| 17 | fi |
| 18 | done |
| 19 | |
Yuta HIGUCHI | 6fc9fbd | 2016-06-16 21:41:13 -0700 | [diff] [blame] | 20 | . $ONOS_ROOT/tools/build/envDefaults |
| 21 | |
Ray Milkey | 4818bc3 | 2018-04-20 10:16:21 -0700 | [diff] [blame] | 22 | VER=${STC_VERSION:-2.5} |
Thomas Vachuska | 9ac244b | 2017-03-20 16:03:33 -0700 | [diff] [blame] | 23 | MVN_JAR=org/onosproject/onos-stc/$VER/onos-stc-$VER.jar |
| 24 | JAR=${MAVEN_REPO:-$HOME/.m2/repository}/$MVN_JAR |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 25 | SCENARIOS=$ONOS_ROOT/tools/test/scenarios |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 26 | |
Thomas Vachuska | 426d356 | 2016-06-02 19:36:51 -0700 | [diff] [blame] | 27 | # Download the STC binary if needed |
| 28 | if [ ! -f $JAR ]; then |
| 29 | printf "Downloading STC binary..." |
Thomas Vachuska | 9ac244b | 2017-03-20 16:03:33 -0700 | [diff] [blame] | 30 | mkdir -p /tmp/stc $(dirname $JAR) |
Thomas Vachuska | 7d29dca | 2020-01-23 11:46:00 -0800 | [diff] [blame] | 31 | curl https://repo1.maven.org/maven2/$MVN_JAR > $JAR |
Thomas Vachuska | 426d356 | 2016-06-02 19:36:51 -0700 | [diff] [blame] | 32 | [ -f $JAR ] && printf "Done.\n" |
| 33 | fi |
| 34 | |
Thomas Vachuska | 177ece6 | 2015-06-26 00:18:21 -0700 | [diff] [blame] | 35 | DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y" |
| 36 | |
Boyuan Yan | 1c27bc7 | 2019-02-15 19:22:19 +0000 | [diff] [blame] | 37 | scenario=${params[0]:-smoke} |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 38 | |
Thomas Vachuska | 69e7623 | 2018-02-20 14:09:29 -0800 | [diff] [blame] | 39 | if [ $scenario != "-?" -a $scenario != "-h" -a $scenario != "--help" ]; then |
| 40 | [ ! -f $scenario ] && scenario=$SCENARIOS/$scenario |
| 41 | [ ! -f $scenario ] && scenario=$scenario.xml |
| 42 | [ ! -f $scenario ] && echo "Scenario $scenario file not found" && exit 1 |
| 43 | fi |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 44 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 45 | # 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] | 46 | [ $# -ge 1 ] && shift |
| 47 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 48 | # If stcColor is not set, we will enable color if this is an interactive session |
| 49 | [ -t 1 ] && interactive=true || interactive=false |
Thomas Vachuska | 7c5b653 | 2015-11-02 14:50:33 -0800 | [diff] [blame] | 50 | [ -t 1 ] && notInteractive=false || notInteractive=true |
Thomas Vachuska | 50ec1af | 2015-06-02 00:42:52 -0700 | [diff] [blame] | 51 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 52 | # Run stc |
Thomas Vachuska | 1b403a5 | 2015-08-26 11:30:48 -0700 | [diff] [blame] | 53 | [ -z "$stcDebug" ] && DEBUG_OPTS="" |
Thomas Vachuska | a3029cf | 2016-08-23 16:47:46 -0700 | [diff] [blame] | 54 | stcTitle=${stcTitle:-} stcColor=${stcColor:-$interactive} stcDumpLogs=${stcDumpLogs:-$notInteractive} \ |
Boyuan Yan | 1c27bc7 | 2019-02-15 19:22:19 +0000 | [diff] [blame] | 55 | java $DEBUG_OPTS -jar $JAR $scenario "${params[*]}" |