blob: cb5f32a9d7539334d09e30adfa6be4e56622f0ec [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 Vachuska426d3562016-06-02 19:36:51 -07009JAR=~/.m2/repository/org/onosproject/onos-stc/$VER/onos-stc-$VER.jar
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070010SCENARIOS=$ONOS_ROOT/tools/test/scenarios
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070011
Thomas Vachuska426d3562016-06-02 19:36:51 -070012# Download the STC binary if needed
13if [ ! -f $JAR ]; then
14 printf "Downloading STC binary..."
Thomas Vachuska1996d872017-02-27 10:23:23 -080015 mkdir -p /tmp/stc
Jon Hallfb6009d2017-02-15 16:01:17 -080016 aux=/tmp/stc/stc-$$.log
Thomas Vachuska426d3562016-06-02 19:36:51 -070017 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"
20fi
21
Thomas Vachuska177ece62015-06-26 00:18:21 -070022DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y"
23
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070024scenario=${1:-smoke}
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070025
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070026[ ! -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'Connor3683f4d2015-09-16 17:44:30 -070030# Remove the test name from the list of parameters, if one is specified
Thomas Vachuska50ec1af2015-06-02 00:42:52 -070031[ $# -ge 1 ] && shift
32
Brian O'Connor3683f4d2015-09-16 17:44:30 -070033# If stcColor is not set, we will enable color if this is an interactive session
34[ -t 1 ] && interactive=true || interactive=false
Thomas Vachuska7c5b6532015-11-02 14:50:33 -080035[ -t 1 ] && notInteractive=false || notInteractive=true
Thomas Vachuska50ec1af2015-06-02 00:42:52 -070036
Brian O'Connor3683f4d2015-09-16 17:44:30 -070037# Run stc
Thomas Vachuska1b403a52015-08-26 11:30:48 -070038[ -z "$stcDebug" ] && DEBUG_OPTS=""
Thomas Vachuskaa3029cf2016-08-23 16:47:46 -070039stcTitle=${stcTitle:-} stcColor=${stcColor:-$interactive} stcDumpLogs=${stcDumpLogs:-$notInteractive} \
Thomas Vachuska7c5b6532015-11-02 14:50:33 -080040 java $DEBUG_OPTS -jar $JAR $scenario "$@"