blob: 8231ee7ffc1b1faa9ddea6b671f386371e8e413c [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
36 printf "Running scenario %s...\n" $scenario
37 stc $scenario
38 done
Thomas Vachuska9efd6b32016-07-13 15:44:32 -070039 status=$?
Thomas Vachuska978902a2016-08-31 11:05:17 -070040
Thomas Vachuska9efd6b32016-07-13 15:44:32 -070041 printf "Finished run %d...\n" $run
Thomas Vachuska4d5310c2016-07-14 12:48:39 -070042 [ $status -ne 0 ] && exit $status
Thomas Vachuska9efd6b32016-07-13 15:44:32 -070043 let run=run+1
44done
Thomas Vachuska4d5310c2016-07-14 12:48:39 -070045
46if [ -n "$doTeardown" ]; then
47 printf "Tearing down...\n"
48 stc teardown || exit 1
49fi