1#!/usr/bin/env bash 2# This script is used to deflake inherently flaky tsan tests. 3# It is invoked from lit tests as: 4# %deflake mybinary 5# which is then substituted by lit to: 6# $(dirname %s)/deflake.bash mybinary 7# The script runs the target program up to 10 times, 8# until it fails (i.e. produces a race report). 9 10for i in $(seq 1 10); do 11 OUT=`$@ 2>&1` 12 if [[ $? != 0 ]]; then 13 echo "$OUT" 14 exit 0 15 fi 16done 17exit 1 18