aboutsummaryrefslogtreecommitdiff
path: root/test/tsan/deflake.bash
diff options
context:
space:
mode:
Diffstat (limited to 'test/tsan/deflake.bash')
-rwxr-xr-xtest/tsan/deflake.bash17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/tsan/deflake.bash b/test/tsan/deflake.bash
new file mode 100755
index 000000000000..9731fa53e589
--- /dev/null
+++ b/test/tsan/deflake.bash
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+# This script is used to deflake inherently flaky tsan tests.
+# It is invoked from lit tests as:
+# %deflake mybinary
+# which is then substituted by lit to:
+# $(dirname %s)/deflake.bash mybinary
+# The script runs the target program up to 10 times,
+# until it fails (i.e. produces a race report).
+
+for i in $(seq 1 10); do
+ OUT=`$@ 2>&1`
+ if [[ $? != 0 ]]; then
+ echo "$OUT"
+ exit 0
+ fi
+done
+exit 1