Merge branch 'release-2.140.113'
[feisty_meow.git] / scripts / testing / rounder.sh
1 #!/bin/bash
2
3 # sample the first argument to make sure it's not empty.
4 # we can't know if the command is really valid or not, but it at least
5 # needs to not be empty.
6 test_to_run="$1"
7
8 if [ -z "$test_to_run" ]; then
9   echo "This script requires a test or program to run as the first parameter."
10   exit 1
11 fi
12
13 trashdir="$(mktemp -d "$TMP/rounder.XXXXXX")"
14
15 echo "Running command: $*"
16 echo "Storing log files in: $trashdir"
17
18 round=0
19 while true; do
20   round=$((round+1))
21   echo ============================
22   echo round $round commencing
23   outputfile="$trashdir/run_round_${round}.log"
24 echo real cmd:
25 echo "${@}" 
26   eval "${@}" 2>&1 | tee $outputfile
27   if [ ${PIPESTATUS[0]} -ne 0 ]; then
28     echo FAILURE IN RUN $round
29     break
30   fi
31   echo round $round successful.
32 done 
33