[PATCH] tsan: automatically deflake flaky tests
Dmitry Vyukov
dvyukov at google.com
Mon May 26 07:34:07 PDT 2014
Hi kcc, samsonov,
Add a script that is used to deflake inherently flaky tsan tests.
It is invoked from lit tests as:
$(dirname %s)/deflake.bash %run %t %s
The script runs the target program up to 10 times,
until it produces the necessary output.
If/when it LGTM, I will add it to other tests as well.
http://reviews.llvm.org/D3913
Files:
test/tsan/deflake.bash
test/tsan/simple_race.c
Index: test/tsan/simple_race.c
===================================================================
--- test/tsan/simple_race.c
+++ test/tsan/simple_race.c
@@ -1,4 +1,4 @@
-// RUN: %clang_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clang_tsan -O1 %s -o %t && $(dirname %s)/deflake.bash %run %t %s
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
Index: test/tsan/deflake.bash
===================================================================
--- test/tsan/deflake.bash
+++ test/tsan/deflake.bash
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+# This script is used to deflake inherently flaky tsan tests.
+# It is invoked from lit tests as:
+# $(dirname %s)/deflake.bash %run %t %s
+# The script runs the target program up to 10 times,
+# until it produces the necessary output.
+
+for i in $(seq 1 10); do
+ echo TRY $i
+ not $1 2>&1 | FileCheck $2 && exit 0
+done
+exit 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3913.9809.patch
Type: text/x-patch
Size: 900 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140526/e8e1310a/attachment.bin>
More information about the llvm-commits
mailing list