blob: 5361c24c5e75b1112c534bbad4578bf7f2fde304 [file] [log] [blame]
Thomas Vachuskaf9c84362015-04-15 11:20:45 -07001#!/bin/bash
2#-------------------------------------------------------------------------------
3# System Test Coordinator
4#-------------------------------------------------------------------------------
5
Yuta HIGUCHI6fc9fbd2016-06-16 21:41:13 -07006. $ONOS_ROOT/tools/build/envDefaults
7
Thomas Vachuskaf8d71b02017-02-28 22:36:45 +00008VER=${STC_VERSION:-2.3}
Thomas Vachuska9ac244b2017-03-20 16:03:33 -07009MVN_JAR=org/onosproject/onos-stc/$VER/onos-stc-$VER.jar
10JAR=${MAVEN_REPO:-$HOME/.m2/repository}/$MVN_JAR
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070011SCENARIOS=$ONOS_ROOT/tools/test/scenarios
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070012
Thomas Vachuska426d3562016-06-02 19:36:51 -070013# Download the STC binary if needed
14if [ ! -f $JAR ]; then
15 printf "Downloading STC binary..."
Thomas Vachuska9ac244b2017-03-20 16:03:33 -070016 mkdir -p /tmp/stc $(dirname $JAR)
17 curl http://repo1.maven.org/maven2/$MVN_JAR > $JAR
Thomas Vachuska426d3562016-06-02 19:36:51 -070018 [ -f $JAR ] && printf "Done.\n"
19fi
20
Thomas Vachuska177ece62015-06-26 00:18:21 -070021DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y"
22
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070023scenario=${1:-smoke}
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070024
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070025[ ! -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'Connor3683f4d2015-09-16 17:44:30 -070029# Remove the test name from the list of parameters, if one is specified
Thomas Vachuska50ec1af2015-06-02 00:42:52 -070030[ $# -ge 1 ] && shift
31
Brian O'Connor3683f4d2015-09-16 17:44:30 -070032# If stcColor is not set, we will enable color if this is an interactive session
33[ -t 1 ] && interactive=true || interactive=false
Thomas Vachuska7c5b6532015-11-02 14:50:33 -080034[ -t 1 ] && notInteractive=false || notInteractive=true
Thomas Vachuska50ec1af2015-06-02 00:42:52 -070035
Brian O'Connor3683f4d2015-09-16 17:44:30 -070036# Run stc
Thomas Vachuska1b403a52015-08-26 11:30:48 -070037[ -z "$stcDebug" ] && DEBUG_OPTS=""
Thomas Vachuskaa3029cf2016-08-23 16:47:46 -070038stcTitle=${stcTitle:-} stcColor=${stcColor:-$interactive} stcDumpLogs=${stcDumpLogs:-$notInteractive} \
Thomas Vachuska7c5b6532015-11-02 14:50:33 -080039 java $DEBUG_OPTS -jar $JAR $scenario "$@"