blob: e088af723377d4b9485a1a13abfcdd20afd0b9d3 [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 Vachuska69e76232018-02-20 14:09:29 -08008VER=${STC_VERSION:-2.4}
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 Vachuska69e76232018-02-20 14:09:29 -080025if [ $scenario != "-?" -a $scenario != "-h" -a $scenario != "--help" ]; then
26 [ ! -f $scenario ] && scenario=$SCENARIOS/$scenario
27 [ ! -f $scenario ] && scenario=$scenario.xml
28 [ ! -f $scenario ] && echo "Scenario $scenario file not found" && exit 1
29fi
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070030
Brian O'Connor3683f4d2015-09-16 17:44:30 -070031# Remove the test name from the list of parameters, if one is specified
Thomas Vachuska50ec1af2015-06-02 00:42:52 -070032[ $# -ge 1 ] && shift
33
Brian O'Connor3683f4d2015-09-16 17:44:30 -070034# If stcColor is not set, we will enable color if this is an interactive session
35[ -t 1 ] && interactive=true || interactive=false
Thomas Vachuska7c5b6532015-11-02 14:50:33 -080036[ -t 1 ] && notInteractive=false || notInteractive=true
Thomas Vachuska50ec1af2015-06-02 00:42:52 -070037
Brian O'Connor3683f4d2015-09-16 17:44:30 -070038# Run stc
Thomas Vachuska1b403a52015-08-26 11:30:48 -070039[ -z "$stcDebug" ] && DEBUG_OPTS=""
Thomas Vachuskaa3029cf2016-08-23 16:47:46 -070040stcTitle=${stcTitle:-} stcColor=${stcColor:-$interactive} stcDumpLogs=${stcDumpLogs:-$notInteractive} \
Thomas Vachuska7c5b6532015-11-02 14:50:33 -080041 java $DEBUG_OPTS -jar $JAR $scenario "$@"