[compiler-rt] 0368e76 - [rtsan] Fix ioctl args in interceptor test (#154959)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 22 13:04:51 PDT 2025


Author: davidtrevelyan
Date: 2025-08-22T21:04:47+01:00
New Revision: 0368e76fded6565d8613645d11ea752b5c4a2ed5

URL: https://github.com/llvm/llvm-project/commit/0368e76fded6565d8613645d11ea752b5c4a2ed5
DIFF: https://github.com/llvm/llvm-project/commit/0368e76fded6565d8613645d11ea752b5c4a2ed5.diff

LOG: [rtsan] Fix ioctl args in interceptor test (#154959)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
index 9b684e36e3b35..d69a4e74825f0 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp
@@ -753,15 +753,24 @@ TEST_F(RtsanOpenedFileTest, RewindDieWhenRealtime) {
 #endif
 
 TEST_F(RtsanOpenedFileTest, IoctlDiesWhenRealtime) {
-  auto Func = [this]() { ioctl(GetOpenFd(), FIONREAD); };
+  auto Func = [this]() {
+    int arg{};
+    ioctl(GetOpenFd(), FIONREAD, &arg);
+    EXPECT_THAT(arg, Ge(0));
+  };
   ExpectRealtimeDeath(Func, "ioctl");
   ExpectNonRealtimeSurvival(Func);
 }
 
+TEST_F(RtsanOpenedFileTest, IoctlBehavesWithoutOutputArg) {
+  const int result = ioctl(GetOpenFd(), FIONCLEX);
+  EXPECT_THAT(result, Ne(-1));
+}
+
 TEST_F(RtsanOpenedFileTest, IoctlBehavesWithOutputArg) {
   int arg{};
-  ioctl(GetOpenFd(), FIONREAD, &arg);
-
+  const int result = ioctl(GetOpenFd(), FIONREAD, &arg);
+  ASSERT_THAT(result, Ne(-1));
   EXPECT_THAT(arg, Ge(0));
 }
 


        


More information about the llvm-commits mailing list