From: Yu Watanabe Date: Sat, 21 Jun 2025 14:06:16 +0000 (+0900) Subject: test-cpu-set-util: fix check for CPUSet.allocated X-Git-Tag: v258-rc1~262 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=274e2f4bb9fa14c55a971eaccd3b1487ecc05582;p=thirdparty%2Fsystemd.git test-cpu-set-util: fix check for CPUSet.allocated The check was simply wrong and meaningless, as it always checked CPUSet.allocated is greater than or equals to 1, as sizeof(__cpu_mask) is 8. Let's make the test more strict. --- diff --git a/src/test/test-cpu-set-util.c b/src/test/test-cpu-set-util.c index c7bc6340623..e37ddc4cad4 100644 --- a/src/test/test-cpu-set-util.c +++ b/src/test/test-cpu-set-util.c @@ -8,13 +8,10 @@ ASSERT_NULL(c.set); \ ASSERT_EQ(c.allocated, 0u) -#define ASSERT_CPUSET_ALLOCATED(c) \ - ASSERT_GE(c.allocated, DIV_ROUND_UP(sizeof(__cpu_mask), 8)) - #define ASSERT_CPUSET_COUNT(c, n) \ ASSERT_NOT_NULL(c.set); \ - ASSERT_CPUSET_ALLOCATED(c); \ - ASSERT_EQ(CPU_COUNT_S(c.allocated, c.set), n) + ASSERT_GE(c.allocated, CPU_ALLOC_SIZE(n)); \ + ASSERT_EQ(CPU_COUNT_S(c.allocated, c.set), (n)) #define ASSERT_CPUSET_ISSET(c, i) \ ASSERT_TRUE(CPU_ISSET_S(i, c.allocated, c.set));