blob: fa24df0ee4cfca2df8180f8f1b07a53bf7d52714 [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 Vachuska9efd6b32016-07-13 15:44:32 -070025let run=1
Thomas Vachuska4d5310c2016-07-14 12:48:39 -070026while [ $count -le 0 -o $run -le $count ]; do
Thomas Vachuska67f13052016-08-19 12:10:42 -070027 export stcTitle="STC Run #$run; "
Thomas Vachuska9efd6b32016-07-13 15:44:32 -070028 printf "Starting run %d...\n" $run
Thomas Vachuska4d5310c2016-07-14 12:48:39 -070029 for scenario in "${@:-smoke}"; do
30 printf "Running scenario %s...\n" $scenario
31 stc $scenario
32 done
Thomas Vachuska9efd6b32016-07-13 15:44:32 -070033 status=$?
34 printf "Finished run %d...\n" $run
Thomas Vachuska4d5310c2016-07-14 12:48:39 -070035 [ $status -ne 0 ] && exit $status
Thomas Vachuska9efd6b32016-07-13 15:44:32 -070036 let run=run+1
37done
Thomas Vachuska4d5310c2016-07-14 12:48:39 -070038
39if [ -n "$doTeardown" ]; then
40 printf "Tearing down...\n"
41 stc teardown || exit 1
42fi