Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

cjappl
Copy link
Contributor

@cjappl cjappl commented Aug 26, 2024

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.

@llvmbot
Copy link
Member

llvmbot commented Aug 26, 2024

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

Author: Chris Apple (cjappl)

Changes

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

@cjappl
Copy link
Contributor Author

cjappl commented Aug 26, 2024

CC @davidtrevelyan

@cjappl
Copy link
Contributor Author

cjappl commented Aug 26, 2024

I'll do my first post-commit review....unless vitalybuka reviews in world record time! Thanks!

@cjappl cjappl merged commit 4b3f147 into llvm:main Aug 26, 2024
8 of 9 checks passed
@cjappl cjappl deleted the calloc_unit_test branch August 26, 2024 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants