[compiler-rt] 9ef9d01 - tsan: extend signal_malloc test

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 28 08:35:19 PDT 2021


Author: Dmitry Vyukov
Date: 2021-07-28T17:35:13+02:00
New Revision: 9ef9d01a5046f4f58b51b59d658e4c05f41344a1

URL: https://github.com/llvm/llvm-project/commit/9ef9d01a5046f4f58b51b59d658e4c05f41344a1
DIFF: https://github.com/llvm/llvm-project/commit/9ef9d01a5046f4f58b51b59d658e4c05f41344a1.diff

LOG: tsan: extend signal_malloc test

Test that we report the warning for free()
and ensure the test finishes as we usually do with "DONE".

Depends on D106951.

Reviewed By: melver

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

Added: 
    

Modified: 
    compiler-rt/test/tsan/signal_malloc.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/tsan/signal_malloc.cpp b/compiler-rt/test/tsan/signal_malloc.cpp
index 5595ee2451759..9f73ee90ed5f2 100644
--- a/compiler-rt/test/tsan/signal_malloc.cpp
+++ b/compiler-rt/test/tsan/signal_malloc.cpp
@@ -10,6 +10,10 @@ static void handler(int, siginfo_t*, void*) {
   // CHECK: SUMMARY: ThreadSanitizer: signal-unsafe call inside of a signal{{.*}}handler
   volatile char *p = (char*)malloc(1);
   p[0] = 0;
+  // CHECK: WARNING: ThreadSanitizer: signal-unsafe call inside of a signal
+  // CHECK:     #0 free
+  // CHECK:     #{{(1|2)}} handler(int, {{(__)?}}siginfo{{(_t)?}}*, void*) {{.*}}signal_malloc.cpp:[[@LINE+2]]
+  // CHECK: SUMMARY: ThreadSanitizer: signal-unsafe call inside of a signal{{.*}}handler
   free((void*)p);
 }
 
@@ -19,6 +23,8 @@ int main() {
   sigaction(SIGPROF, &act, 0);
   kill(getpid(), SIGPROF);
   sleep(1);  // let the signal handler run
+  fprintf(stderr, "DONE\n");
+  // CHECK: DONE
   return 0;
 }
 


        


More information about the llvm-commits mailing list