[compiler-rt] [rtsan][compiler-rt] Get rid of [[blocking]] stub in tests (PR #111392)
Chris Apple via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 7 10:22:47 PDT 2024
https://github.com/cjappl updated https://github.com/llvm/llvm-project/pull/111392
>From e8bc15b5230f60899ab658255d1f399d226db03d Mon Sep 17 00:00:00 2001
From: Chris Apple <cja-private at pm.me>
Date: Mon, 7 Oct 2024 08:10:55 -0700
Subject: [PATCH 1/2] [rtsan][compiler-rt] Get rid of [[blocking]] stub in
tests
---
compiler-rt/test/rtsan/blocking_call.cpp | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/compiler-rt/test/rtsan/blocking_call.cpp b/compiler-rt/test/rtsan/blocking_call.cpp
index 47ce3d5544cbd6..481040e81999db 100644
--- a/compiler-rt/test/rtsan/blocking_call.cpp
+++ b/compiler-rt/test/rtsan/blocking_call.cpp
@@ -7,18 +7,11 @@
#include <stdio.h>
#include <stdlib.h>
-// TODO: Remove when [[blocking]] is implemented.
-extern "C" void __rtsan_notify_blocking_call(const char *function_name);
-
-void custom_blocking_function() {
- // TODO: When [[blocking]] is implemented, don't call this directly.
- __rtsan_notify_blocking_call(__func__);
+void custom_blocking_function() [[clang::blocking]] {
+ printf("In blocking function\n");
}
-void safe_call() {
- // TODO: When [[blocking]] is implemented, don't call this directly.
- __rtsan_notify_blocking_call(__func__);
-}
+void safe_call() [[clang::blocking]] { printf("In safe call\n"); }
void process() [[clang::nonblocking]] { custom_blocking_function(); }
@@ -26,9 +19,14 @@ int main() {
safe_call(); // This shouldn't die, because it isn't in nonblocking context.
process();
return 0;
- // CHECK-NOT: {{.*safe_call*}}
// CHECK: ==ERROR: RealtimeSanitizer: blocking-call
- // CHECK-NEXT: Call to blocking function `custom_blocking_function` in real-time context!
+ // CHECK-NEXT: Call to blocking function `custom_blocking_function()` in real-time context!
// CHECK-NEXT: {{.*custom_blocking_function*}}
// CHECK-NEXT: {{.*process*}}
+
+ // We should crash before this line is printed
+ // CHECK-NOT: {{.*In blocking function.*}}
+
+ // should only occur once
+ // CHECK-NOT: ==ERROR: RealtimeSanitizer: blocking-call
}
>From c594208347ac61931c3ef1962712a0e1d4262318 Mon Sep 17 00:00:00 2001
From: Chris Apple <cja-private at pm.me>
Date: Mon, 7 Oct 2024 10:22:34 -0700
Subject: [PATCH 2/2] [PR] dtraev - Clean up fn names
---
compiler-rt/test/rtsan/blocking_call.cpp | 25 +++++++++++-------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/compiler-rt/test/rtsan/blocking_call.cpp b/compiler-rt/test/rtsan/blocking_call.cpp
index 481040e81999db..5c7f9d331096de 100644
--- a/compiler-rt/test/rtsan/blocking_call.cpp
+++ b/compiler-rt/test/rtsan/blocking_call.cpp
@@ -11,22 +11,19 @@ void custom_blocking_function() [[clang::blocking]] {
printf("In blocking function\n");
}
-void safe_call() [[clang::blocking]] { printf("In safe call\n"); }
-
-void process() [[clang::nonblocking]] { custom_blocking_function(); }
+void realtime_function() [[clang::nonblocking]] { custom_blocking_function(); }
+void nonrealtime_function() { custom_blocking_function(); }
int main() {
- safe_call(); // This shouldn't die, because it isn't in nonblocking context.
- process();
+ nonrealtime_function();
+ realtime_function();
return 0;
- // CHECK: ==ERROR: RealtimeSanitizer: blocking-call
- // CHECK-NEXT: Call to blocking function `custom_blocking_function()` in real-time context!
- // CHECK-NEXT: {{.*custom_blocking_function*}}
- // CHECK-NEXT: {{.*process*}}
+}
- // We should crash before this line is printed
- // CHECK-NOT: {{.*In blocking function.*}}
+// CHECK: ==ERROR: RealtimeSanitizer: blocking-call
+// CHECK-NEXT: Call to blocking function `custom_blocking_function()` in real-time context!
+// CHECK-NEXT: {{.*custom_blocking_function*}}
+// CHECK-NEXT: {{.*realtime_function*}}
- // should only occur once
- // CHECK-NOT: ==ERROR: RealtimeSanitizer: blocking-call
-}
+// should only occur once
+// CHECK-NOT: ==ERROR: RealtimeSanitizer: blocking-call
More information about the llvm-commits
mailing list