[compiler-rt] 4b3f147 - [rtsan][compiler-rt] Add missing calloc unit test (#106159)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 16:54:55 PDT 2024


Author: Chris Apple
Date: 2024-08-26T16:54:52-07:00
New Revision: 4b3f1473bc25c089c52fd2ba90883bcc52d69330

URL: https://github.com/llvm/llvm-project/commit/4b3f1473bc25c089c52fd2ba90883bcc52d69330
DIFF: https://github.com/llvm/llvm-project/commit/4b3f1473bc25c089c52fd2ba90883bcc52d69330.diff

LOG: [rtsan][compiler-rt] Add missing calloc unit test (#106159)

Added: 
    

Modified: 
    compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
index 5b88cf64612942..9303bd5fd3d3e0 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
@@ -71,6 +71,12 @@ TEST(TestRtsanInterceptors, MallocDiesWhenRealtime) {
   ExpectNonRealtimeSurvival(Func);
 }
 
+TEST(TestRtsanInterceptors, CallocDiesWhenRealtime) {
+  auto Func = []() { EXPECT_NE(nullptr, calloc(2, 4)); };
+  ExpectRealtimeDeath(Func, "calloc");
+  ExpectNonRealtimeSurvival(Func);
+}
+
 TEST(TestRtsanInterceptors, ReallocDiesWhenRealtime) {
   void *ptr_1 = malloc(1);
   auto Func = [ptr_1]() { EXPECT_NE(nullptr, realloc(ptr_1, 8)); };


        


More information about the llvm-commits mailing list