Thomas Vachuska | 9efd6b3 | 2016-07-13 15:44:32 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # Loops the System Test Coordinator invocations while success/until failure. |
| 4 | #------------------------------------------------------------------------------- |
| 5 | |
Thomas Vachuska | 4d5310c | 2016-07-14 12:48:39 -0700 | [diff] [blame] | 6 | count=0 |
| 7 | unset doSetup doTeardown |
| 8 | |
| 9 | # Scan arguments for user/password or other options... |
| 10 | while getopts c:st o; do |
| 11 | case "$o" in |
| 12 | c) count=$OPTARG;; |
| 13 | s) doSetup=true;; |
| 14 | t) toTeardown=true;; |
| 15 | esac |
| 16 | done |
| 17 | let OPC=$OPTIND-1 |
| 18 | shift $OPC |
| 19 | |
| 20 | if [ -n "$doSetup" ]; then |
| 21 | printf "Setting up...\n" |
| 22 | stc setup || exit 1 |
| 23 | fi |
| 24 | |
Thomas Vachuska | 9efd6b3 | 2016-07-13 15:44:32 -0700 | [diff] [blame] | 25 | let run=1 |
Thomas Vachuska | 4d5310c | 2016-07-14 12:48:39 -0700 | [diff] [blame] | 26 | while [ $count -le 0 -o $run -le $count ]; do |
Thomas Vachuska | 9efd6b3 | 2016-07-13 15:44:32 -0700 | [diff] [blame] | 27 | printf "\033]0;%s\007" "STC Run #$run" |
| 28 | printf "Starting run %d...\n" $run |
Thomas Vachuska | 4d5310c | 2016-07-14 12:48:39 -0700 | [diff] [blame] | 29 | for scenario in "${@:-smoke}"; do |
| 30 | printf "Running scenario %s...\n" $scenario |
| 31 | stc $scenario |
| 32 | done |
Thomas Vachuska | 9efd6b3 | 2016-07-13 15:44:32 -0700 | [diff] [blame] | 33 | status=$? |
| 34 | printf "Finished run %d...\n" $run |
Thomas Vachuska | 4d5310c | 2016-07-14 12:48:39 -0700 | [diff] [blame] | 35 | [ $status -ne 0 ] && exit $status |
Thomas Vachuska | 9efd6b3 | 2016-07-13 15:44:32 -0700 | [diff] [blame] | 36 | let run=run+1 |
| 37 | done |
Thomas Vachuska | 4d5310c | 2016-07-14 12:48:39 -0700 | [diff] [blame] | 38 | |
| 39 | if [ -n "$doTeardown" ]; then |
| 40 | printf "Tearing down...\n" |
| 41 | stc teardown || exit 1 |
| 42 | fi |