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

Chris Apple via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 16:28:35 PDT 2024


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

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. 

>From ff9c1ac9bbd6beadf02b66cde9c27f35e255335b Mon Sep 17 00:00:00 2001
From: Chris Apple <cja-private at pm.me>
Date: Sun, 11 Aug 2024 17:31:33 -0700
Subject: [PATCH] [rtsan][compiler-rt] Add missing calloc unit test

---
 compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

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