[compiler-rt] 5faeefd - [tsan] Deflake pthread_atfork_deadlock3

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed May 19 22:59:46 PDT 2021


Author: Vitaly Buka
Date: 2021-05-19T22:59:37-07:00
New Revision: 5faeefd4fa34e4f260c3e91bccff4d0c9ae45ed0

URL: https://github.com/llvm/llvm-project/commit/5faeefd4fa34e4f260c3e91bccff4d0c9ae45ed0
DIFF: https://github.com/llvm/llvm-project/commit/5faeefd4fa34e4f260c3e91bccff4d0c9ae45ed0.diff

LOG: [tsan] Deflake pthread_atfork_deadlock3

sleep(1) does not guaranty afterfork order.
Also relative child/parent afterfork order is not important for this test so we
can just avoid checking that.

Reviewed By: dvyukov

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

Added: 
    

Modified: 
    compiler-rt/test/tsan/pthread_atfork_deadlock3.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/tsan/pthread_atfork_deadlock3.c b/compiler-rt/test/tsan/pthread_atfork_deadlock3.c
index 77578982fa46..793eaf6ac867 100644
--- a/compiler-rt/test/tsan/pthread_atfork_deadlock3.c
+++ b/compiler-rt/test/tsan/pthread_atfork_deadlock3.c
@@ -1,4 +1,6 @@
-// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
+// RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t > %t.out
+// RUN: FileCheck %s --check-prefixes=CHECK,PARENT --input-file %t.out
+// RUN: FileCheck %s --check-prefixes=CHECK,CHILD --input-file %t.out
 // Regression test for
 // https://groups.google.com/g/thread-sanitizer/c/TQrr4-9PRYo/m/HFR4FMi6AQAJ
 #include "test.h"
@@ -42,9 +44,6 @@ void afterfork() {
 }
 
 void afterfork_child() {
-  // Can't synchronize with barriers because we are
-  // in the new process, but want consistent output.
-  sleep(1);
   write(2, "in afterfork_child\n", strlen("in afterfork_child\n"));
   glob++;
 }
@@ -91,8 +90,8 @@ int main() {
 // CHECK:     #0 handler
 // CHECK:   Previous write of size 8
 // CHECK:     #0 worker
-// CHECK: afterfork
-// CHECK: in handler
-// CHECK: afterfork_child
-// CHECK: CHILD
+// PARENT: afterfork
+// PARENT: in handler
+// CHILD: afterfork_child
+// CHILD: CHILD
 // CHECK: PARENT


        


More information about the llvm-commits mailing list