Created
November 2, 2013 17:36
-
-
Save jugglinmike/7281434 to your computer and use it in GitHub Desktop.
Continuously re-run a process, logging failures (troubleshooting flaky integration tests)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Continuously re-run a process, logging failures | |
RUNCOUNT=0 | |
FAILCOUNT=0 | |
COMMAND=$1 | |
while [ 1 ] | |
do | |
if [ $(($RUNCOUNT % 10)) -eq 0 ] | |
then | |
echo Now starting run \#$RUNCOUNT | |
fi | |
eval $COMMAND 2> failure-${FAILCOUNT}.txt > /dev/null | |
if [ $? -ne 1 ] | |
then | |
echo Run \#$RUNCOUNT failed \(failure \#$FAILCOUNT\) at `date` | |
FAILCOUNT=$(($FAILCOUNT + 1)) | |
fi | |
RUNCOUNT=$((RUNCOUNT + 1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment