[libc-commits] [libc] 19e979f - [libc] Relax timeout checks in socketopt_test (#237350)
via libc-commits
libc-commits at lists.llvm.org
Tue Nov 3 04:57:03 PST 2026
Author: Pavel Labath
Date: 2026-11-03T13:56:58+01:00
New Revision: 19e979f0ca2f7906fbd9c3d4ca251aeda8c454ac
URL: https://github.com/llvm/llvm-project/commit/19e979f0ca2f7906fbd9c3d4ca251aeda8c454ac
DIFF: https://github.com/llvm/llvm-project/commit/19e979f0ca2f7906fbd9c3d4ca251aeda8c454ac.diff
LOG: [libc] Relax timeout checks in socketopt_test (#237350)
This test failed rarely (waited for slightly less than one second) on
the presubmit bots. According to AI, this could be because the
designated (virtual) timekeeping cpu was not scheduled for a long(ish)
interval (MAX_STALLED_JIFFIES). This sounds plausible, although I don't
know how to verify that.
In any case, this test wasn't meant to test kernel's timekeeping -- only
that we got the plumbing right, and the kernel waits for *some*
interval, which is why I relax the lower bound of the interval.
Added:
Modified:
libc/test/src/sys/socket/linux/socketopt_test.cpp
Removed:
################################################################################
diff --git a/libc/test/src/sys/socket/linux/socketopt_test.cpp b/libc/test/src/sys/socket/linux/socketopt_test.cpp
index 7901558d63de4f..b7dbb0f5d1b78b 100644
--- a/libc/test/src/sys/socket/linux/socketopt_test.cpp
+++ b/libc/test/src/sys/socket/linux/socketopt_test.cpp
@@ -200,6 +200,7 @@ TEST_F(LlvmLibcSocketOptTest, ReceiveTimeout) {
int64_t elapsed_seconds = end.tv_sec - start.tv_sec;
int64_t elapsed_nseconds = end.tv_nsec - start.tv_nsec;
int64_t elapsed_ms = elapsed_seconds * 1000 + elapsed_nseconds / 1000000;
- ASSERT_GE(elapsed_ms, static_cast<int64_t>(1000));
+ // Make sure the value is in the right ballpark.
+ ASSERT_GE(elapsed_ms, static_cast<int64_t>(900));
ASSERT_LT(elapsed_ms, static_cast<int64_t>(10000));
}
More information about the libc-commits
mailing list