blob: d3a00c27886411c201b672ac9ec35dcebd0a8f7e [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 Vachuska9efd6b32016-07-13 15:44:32 -070027 printf "\033]0;%s\007" "STC Run #$run"
28 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