blob: 751607d73b70947545a46385f17be85168b490f0 [file] [log] [blame]
Thomas Vachuskaf9c84362015-04-15 11:20:45 -07001#!/bin/bash
2#-------------------------------------------------------------------------------
3# System Test Coordinator
4#-------------------------------------------------------------------------------
5
Boyuan Yan1c27bc72019-02-15 19:22:19 +00006# If specifiy another env init script, load it.
7params=()
8index=0
9for 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
18done
19
Yuta HIGUCHI6fc9fbd2016-06-16 21:41:13 -070020. $ONOS_ROOT/tools/build/envDefaults
21
Ray Milkey4818bc32018-04-20 10:16:21 -070022VER=${STC_VERSION:-2.5}
Thomas Vachuska9ac244b2017-03-20 16:03:33 -070023MVN_JAR=org/onosproject/onos-stc/$VER/onos-stc-$VER.jar
24JAR=${MAVEN_REPO:-$HOME/.m2/repository}/$MVN_JAR
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070025SCENARIOS=$ONOS_ROOT/tools/test/scenarios
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070026
Thomas Vachuska426d3562016-06-02 19:36:51 -070027# Download the STC binary if needed
28if [ ! -f $JAR ]; then
29 printf "Downloading STC binary..."
Thomas Vachuska9ac244b2017-03-20 16:03:33 -070030 mkdir -p /tmp/stc $(dirname $JAR)
Thomas Vachuskafffab4b2020-01-23 11:46:00 -080031 curl https://repo1.maven.org/maven2/$MVN_JAR > $JAR
Thomas Vachuska426d3562016-06-02 19:36:51 -070032 [ -f $JAR ] && printf "Done.\n"
33fi
34
Thomas Vachuska177ece62015-06-26 00:18:21 -070035DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y"
36
Boyuan Yan1c27bc72019-02-15 19:22:19 +000037scenario=${params[0]:-smoke}
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070038
Thomas Vachuska69e76232018-02-20 14:09:29 -080039if [ $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
43fi
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070044
Brian O'Connor3683f4d2015-09-16 17:44:30 -070045# Remove the test name from the list of parameters, if one is specified
Thomas Vachuska50ec1af2015-06-02 00:42:52 -070046[ $# -ge 1 ] && shift
47
Brian O'Connor3683f4d2015-09-16 17:44:30 -070048# If stcColor is not set, we will enable color if this is an interactive session
49[ -t 1 ] && interactive=true || interactive=false
Thomas Vachuska7c5b6532015-11-02 14:50:33 -080050[ -t 1 ] && notInteractive=false || notInteractive=true
Thomas Vachuska50ec1af2015-06-02 00:42:52 -070051
Brian O'Connor3683f4d2015-09-16 17:44:30 -070052# Run stc
Thomas Vachuska1b403a52015-08-26 11:30:48 -070053[ -z "$stcDebug" ] && DEBUG_OPTS=""
Thomas Vachuskaa3029cf2016-08-23 16:47:46 -070054stcTitle=${stcTitle:-} stcColor=${stcColor:-$interactive} stcDumpLogs=${stcDumpLogs:-$notInteractive} \
Boyuan Yan1c27bc72019-02-15 19:22:19 +000055 java $DEBUG_OPTS -jar $JAR $scenario "${params[*]}"