[compiler-rt] r277324 - [asan] Reduce flakiness of heavy recovery mode tests.

Maxim Ostapenko via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 00:24:37 PDT 2016


Author: chefmax
Date: Mon Aug  1 02:24:36 2016
New Revision: 277324

URL: http://llvm.org/viewvc/llvm-project?rev=277324&view=rev
Log:
[asan] Reduce flakiness of heavy recovery mode tests.

When we run halt_on_error-torture.cc with 10 threads and 20 iterations with halt_on_error=false:suppress_equal_pcs=false, we write 200 reports to 10.txt file and sometimes have collisions.
We have CHECK-COLLISION check that greps 'AddressSanitizer: nested bug in the same thread, aborting' message in 10.txt, but it doesn't contain this line.
If I don't redirect stderr > 10.txt 'AddressSanitizer: nested bug in the same thread, aborting' is printed to my screen as expected.
Same happens for halt_on_error_suppress_equal_pcs.cc and halt_on_error-torture.cc. This happens because of kernel bug: https://lkml.org/lkml/2014/2/17/324
Furtunately, we can fix these tests by implicitly setting O_APPEND for opened files (use >> instead of > for stderr redirection).

Differential Revision: https://reviews.llvm.org/D22921

Modified:
    compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error-signals.c
    compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error-torture.cc
    compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error_suppress_equal_pcs.cc

Modified: compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error-signals.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error-signals.c?rev=277324&r1=277323&r2=277324&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error-signals.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error-signals.c Mon Aug  1 02:24:36 2016
@@ -3,7 +3,7 @@
 // RUN: %clang_asan -fsanitize-recover=address -pthread %s -o %t
 //
 // RUN: rm -f %t.log
-// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=false %run %t 100 >%t.log 2>&1 || true
+// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=false %run %t 100 >>%t.log 2>&1 || true
 // Collision will almost always get triggered but we still need to check the unlikely case:
 // RUN: FileCheck --check-prefix=CHECK-COLLISION %s < %t.log || FileCheck --check-prefix=CHECK-NO-COLLISION %s < %t.log
 

Modified: compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error-torture.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error-torture.cc?rev=277324&r1=277323&r2=277324&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error-torture.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error-torture.cc Mon Aug  1 02:24:36 2016
@@ -2,18 +2,21 @@
 //
 // RUN: %clangxx_asan -fsanitize-recover=address -pthread %s -o %t
 //
-// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=false %run %t 1 10 >1.txt 2>&1
+// RUN: rm -f 1.txt
+// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=false %run %t 1 10 >>1.txt 2>&1
 // RUN: FileCheck %s < 1.txt
 // RUN: [ $(grep -c 'ERROR: AddressSanitizer: use-after-poison' 1.txt) -eq 10 ]
 // RUN: FileCheck --check-prefix=CHECK-NO-COLLISION %s < 1.txt
 //
 // Collisions are unlikely but still possible so we need the ||.
-// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=false %run %t 10 20 >10.txt 2>&1 || true
+// RUN: rm -f 10.txt
+// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=false %run %t 10 20 >>10.txt 2>&1 || true
 // RUN: FileCheck --check-prefix=CHECK-COLLISION %s < 10.txt || FileCheck --check-prefix=CHECK-NO-COLLISION %s < 10.txt
 //
 // Collisions are unlikely but still possible so we need the ||.
-// RUN: %env_asan_opts=halt_on_error=false %run %t 10 20 >10.txt 2>&1 || true
-// RUN: FileCheck --check-prefix=CHECK-COLLISION %s < 10.txt || FileCheck --check-prefix=CHECK-NO-COLLISION %s < 10.txt
+// RUN: rm -f 20.txt
+// RUN: %env_asan_opts=halt_on_error=false %run %t 10 20 >>20.txt 2>&1 || true
+// RUN: FileCheck --check-prefix=CHECK-COLLISION %s < 20.txt || FileCheck --check-prefix=CHECK-NO-COLLISION %s < 20.txt
 
 #include <stdio.h>
 #include <stdlib.h>

Modified: compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error_suppress_equal_pcs.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error_suppress_equal_pcs.cc?rev=277324&r1=277323&r2=277324&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error_suppress_equal_pcs.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Posix/halt_on_error_suppress_equal_pcs.cc Mon Aug  1 02:24:36 2016
@@ -6,14 +6,16 @@
 // RUN: %env_asan_opts=halt_on_error=false %run %t 2>&1 | FileCheck %s
 //
 // Check that we die after reaching different reports number threshold.
-// RUN: %env_asan_opts=halt_on_error=false not %run %t 1 > %t1.log 2>&1
+// RUN: rm -f %t1.log
+// RUN: %env_asan_opts=halt_on_error=false not %run %t 1 >> %t1.log 2>&1
 // RUN: [ $(grep -c 'ERROR: AddressSanitizer: stack-buffer-overflow' %t1.log) -eq 25 ]
 //
 // Check suppress_equal_pcs=true behavior is equal to default one.
 // RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=true %run %t 2>&1 | FileCheck %s
 //
 // Check suppress_equal_pcs=false behavior isn't equal to default one.
-// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=false %run %t > %t2.log 2>&1
+// RUN: rm -f %t2.log
+// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=false %run %t >> %t2.log 2>&1
 // RUN: [ $(grep -c 'ERROR: AddressSanitizer: stack-buffer-overflow' %t2.log) -eq 30 ]
 
 #define ACCESS_ARRAY_FIVE_ELEMENTS(array, i)     \




More information about the llvm-commits mailing list