[libc-commits] [libc] [libc] Fix posix_madvise_test for riscv32 bot. (PR #209504)

via libc-commits libc-commits at lists.llvm.org
Tue Jul 14 07:57:35 PDT 2026


https://github.com/lntue created https://github.com/llvm/llvm-project/pull/209504

None

>From d54b6ebd6001e016aea9b7209c6804b27a23a79b Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Tue, 14 Jul 2026 14:42:16 +0000
Subject: [PATCH] [libc] Fix posix_madvise_test for riscv32 bot.

---
 libc/test/src/sys/mman/linux/posix_madvise_test.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libc/test/src/sys/mman/linux/posix_madvise_test.cpp b/libc/test/src/sys/mman/linux/posix_madvise_test.cpp
index 05edb39d590c4..9be5a1fc4a723 100644
--- a/libc/test/src/sys/mman/linux/posix_madvise_test.cpp
+++ b/libc/test/src/sys/mman/linux/posix_madvise_test.cpp
@@ -46,9 +46,9 @@ TEST_F(LlvmLibcPosixMadviseTest, Error_BadPtr) {
   // posix_madvise doesn't set errno, but the return value is actually the error
   // code.
 #ifdef LIBC_TEST_UNDER_EMULATOR
-  // QEMU stubs madvise hints, so posix_madvise returns 0.
-  EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(nullptr, 8, POSIX_MADV_SEQUENTIAL),
-            0);
+  // QEMU might stub madvise hints, so posix_madvise might return 0.
+  int ret = LIBC_NAMESPACE::posix_madvise(nullptr, 8, POSIX_MADV_SEQUENTIAL);
+  EXPECT_TRUE(ret == 0 || ret = ENOMEM);
 #else
   EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(nullptr, 8, POSIX_MADV_SEQUENTIAL),
             ENOMEM);



More information about the libc-commits mailing list