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

Mikhail R. Gadelha via libc-commits libc-commits at lists.llvm.org
Sat Jul 11 09:51:23 PDT 2026


mikhailramalho 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.

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


More information about the libc-commits mailing list