]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-oomd: fix flakiness under sanitizers
authorLuca Boccassi <luca.boccassi@gmail.com>
Tue, 5 May 2026 14:33:49 +0000 (15:33 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 5 May 2026 15:31:43 +0000 (17:31 +0200)
The test asserts that pgscan is 0, but under sanitizers this sometimes
fails and shows up as 1. We cannot control what the kernel scans, and
with sanitizers the runtime can be slow enough it's possible that the
kernel does a pass on the cgroup of the unit test.
Instead of asserting that it's 0, assert that it's between 0 and 9,
which seems a reasonable range.

Fixes https://github.com/systemd/systemd/issues/37710

src/oom/test-oomd-util.c

index 7332f532a8aaa0dd4baace7c5eee46d2b7aac505..c78315c56b6b0da11a3bb249f572d9ed051cac1c 100644 (file)
@@ -291,7 +291,7 @@ TEST(oomd_cgroup_context_acquire_and_insert) {
         ASSERT_EQ(ctx->memory_low, 0u);
         ASSERT_EQ(ctx->swap_usage, 0u);
         ASSERT_EQ(ctx->last_pgscan, 0u);
-        ASSERT_EQ(ctx->pgscan, 0u);
+        ASSERT_LT(ctx->pgscan, 10u);
         ASSERT_NULL(ctx = oomd_cgroup_context_unref(ctx));
 
         ASSERT_OK(oomd_cgroup_context_acquire("", &ctx));