blob: 677d29c39102c39bc19e9baf8380ab4ebb8a90fb [file] [log] [blame]
Thomas Vachuska9efd6b32016-07-13 15:44:32 -07001#!/bin/bash
2#-------------------------------------------------------------------------------
3# Loops the System Test Coordinator invocations while success/until failure.
4#-------------------------------------------------------------------------------
5
Thomas Vachuska4d5310c2016-07-14 12:48:39 -07006count=0
7unset doSetup doTeardown
8
9# Scan arguments for user/password or other options...
10while getopts c:st o; do
11 case "$o" in
12 c) count=$OPTARG;;
13 s) doSetup=true;;
14 t) toTeardown=true;;
15 esac
16done
17let OPC=$OPTIND-1
18shift $OPC
19
20if [ -n "$doSetup" ]; then
21 printf "Setting up...\n"
22 stc setup || exit 1
23fi
24
Thomas Vachuska978902a2016-08-31 11:05:17 -070025# Iterate the specified number of times, or indefinitely if count not given
Thomas Vachuska9efd6b32016-07-13 15:44:32 -070026let run=1
Thomas Vachuska4d5310c2016-07-14 12:48:39 -070027while [ $count -le 0 -o $run -le $count ]; do
Thomas Vachuska67f13052016-08-19 12:10:42 -070028 export stcTitle="STC Run #$run; "
Thomas Vachuska9efd6b32016-07-13 15:44:32 -070029 printf "Starting run %d...\n" $run
Thomas Vachuska978902a2016-08-31 11:05:17 -070030
31 # If we're running on a borrowed cell, refresh the reservation
32 [ "$ONOS_CELL" = "borrow" ] && onos-cell $ONOS_CELL 120 >/dev/null
33
34 # Iterate over all listed scenarios
Thomas Vachuska4d5310c2016-07-14 12:48:39 -070035 for scenario in "${@:-smoke}"; do
Thomas Vachuska8cc53182016-11-14 13:06:54 -080036 if [[ $scenario =~ ^[0-9]*$ ]]; then
37 printf "Waiting %d seconds...\n" $scenario
38 sleep $scenario
39 else
40 printf "Running scenario %s...\n" $scenario
41 stc $scenario
42 fi
Thomas Vachuska4d5310c2016-07-14 12:48:39 -070043 done
Thomas Vachuska9efd6b32016-07-13 15:44:32 -070044 status=$?
Thomas Vachuska978902a2016-08-31 11:05:17 -070045
Thomas Vachuska9efd6b32016-07-13 15:44:32 -070046 printf "Finished run %d...\n" $run
Thomas Vachuska4d5310c2016-07-14 12:48:39 -070047 [ $status -ne 0 ] && exit $status
Thomas Vachuska9efd6b32016-07-13 15:44:32 -070048 let run=run+1
49done
Thomas Vachuska4d5310c2016-07-14 12:48:39 -070050
51if [ -n "$doTeardown" ]; then
52 printf "Tearing down...\n"
53 stc teardown || exit 1
54fi