Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # System Test Coordinator |
| 4 | #------------------------------------------------------------------------------- |
| 5 | |
Yuta HIGUCHI | 6fc9fbd | 2016-06-16 21:41:13 -0700 | [diff] [blame] | 6 | . $ONOS_ROOT/tools/build/envDefaults |
| 7 | |
Ray Milkey | 4818bc3 | 2018-04-20 10:16:21 -0700 | [diff] [blame^] | 8 | VER=${STC_VERSION:-2.5} |
Thomas Vachuska | 9ac244b | 2017-03-20 16:03:33 -0700 | [diff] [blame] | 9 | MVN_JAR=org/onosproject/onos-stc/$VER/onos-stc-$VER.jar |
| 10 | JAR=${MAVEN_REPO:-$HOME/.m2/repository}/$MVN_JAR |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 11 | SCENARIOS=$ONOS_ROOT/tools/test/scenarios |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 12 | |
Thomas Vachuska | 426d356 | 2016-06-02 19:36:51 -0700 | [diff] [blame] | 13 | # Download the STC binary if needed |
| 14 | if [ ! -f $JAR ]; then |
| 15 | printf "Downloading STC binary..." |
Thomas Vachuska | 9ac244b | 2017-03-20 16:03:33 -0700 | [diff] [blame] | 16 | mkdir -p /tmp/stc $(dirname $JAR) |
| 17 | curl http://repo1.maven.org/maven2/$MVN_JAR > $JAR |
Thomas Vachuska | 426d356 | 2016-06-02 19:36:51 -0700 | [diff] [blame] | 18 | [ -f $JAR ] && printf "Done.\n" |
| 19 | fi |
| 20 | |
Thomas Vachuska | 177ece6 | 2015-06-26 00:18:21 -0700 | [diff] [blame] | 21 | DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y" |
| 22 | |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 23 | scenario=${1:-smoke} |
Thomas Vachuska | f9c8436 | 2015-04-15 11:20:45 -0700 | [diff] [blame] | 24 | |
Thomas Vachuska | 69e7623 | 2018-02-20 14:09:29 -0800 | [diff] [blame] | 25 | if [ $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 |
| 29 | fi |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 30 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 31 | # 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] | 32 | [ $# -ge 1 ] && shift |
| 33 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 34 | # If stcColor is not set, we will enable color if this is an interactive session |
| 35 | [ -t 1 ] && interactive=true || interactive=false |
Thomas Vachuska | 7c5b653 | 2015-11-02 14:50:33 -0800 | [diff] [blame] | 36 | [ -t 1 ] && notInteractive=false || notInteractive=true |
Thomas Vachuska | 50ec1af | 2015-06-02 00:42:52 -0700 | [diff] [blame] | 37 | |
Brian O'Connor | 3683f4d | 2015-09-16 17:44:30 -0700 | [diff] [blame] | 38 | # Run stc |
Thomas Vachuska | 1b403a5 | 2015-08-26 11:30:48 -0700 | [diff] [blame] | 39 | [ -z "$stcDebug" ] && DEBUG_OPTS="" |
Thomas Vachuska | a3029cf | 2016-08-23 16:47:46 -0700 | [diff] [blame] | 40 | stcTitle=${stcTitle:-} stcColor=${stcColor:-$interactive} stcDumpLogs=${stcDumpLogs:-$notInteractive} \ |
Thomas Vachuska | 7c5b653 | 2015-11-02 14:50:33 -0800 | [diff] [blame] | 41 | java $DEBUG_OPTS -jar $JAR $scenario "$@" |