[libc-commits] [libc] [libc] Update some syscall tests to be more tolerance to QEMU behaviors. (PR #208920)

via libc-commits libc-commits at lists.llvm.org
Sun Jul 12 19:19:56 PDT 2026


lntue wrote:

> What if instead of changing the expected result from the calls, we do:
> 
> ```
> # in LLVMLibCTestRules.cmake, where test compile options are assembled
> if(CMAKE_CROSSCOMPILING_EMULATOR)
>   list(APPEND compile_options "-DLIBC_TEST_UNDER_EMULATOR")
> endif()
> ```
> 
> and in the tests:
> 
> ```
> #ifdef LIBC_TEST_UNDER_EMULATOR
>   // QEMU stubs madvise hints; nothing to assert here.
>   return;
> #endif
>   EXPECT_THAT(LIBC_NAMESPACE::madvise(nullptr, 8, MADV_SEQUENTIAL),
>               Fails(ENOMEM));
> ```
> 
> That way, we could skip the tests when running on qemu, but they will run normally on the actual hardware.

Done.

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


More information about the libc-commits mailing list