[libc-commits] [libc] [libc] Properly clear out errno in tests that check its value. (PR #131650)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Mon Mar 17 12:59:22 PDT 2025


================
@@ -15,6 +15,7 @@
 using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
 
 TEST(LlvmLibcEpollCreate1Test, Basic) {
+  LIBC_NAMESPACE::libc_errno = 0;
----------------
vonosmas wrote:

This assumption doesn't hold - we see cases when errno (and previously - fp exceptions) are set to non-zero values before the first test case is being executed -- e.g. by some code that runs pre-main(). Clearing out the state at the beginning of the tests would fix these cases and make the tests more hermetic.

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


More information about the libc-commits mailing list