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

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 16:29:03 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Chris Apple (cjappl)

<details>
<summary>Changes</summary>

Simple one that we missed the first go around.

I am opting for my first post-commit review on this one, because it is so simple. 

---
Full diff: https://github.com/llvm/llvm-project/pull/106159.diff


1 Files Affected:

- (modified) compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp (+6) 


``````````diff
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)); };

``````````

</details>


https://github.com/llvm/llvm-project/pull/106159


More information about the llvm-commits mailing list