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.
This commit is contained in:
Yu Watanabe
2025-06-21 23:06:16 +09:00
committed by Luca Boccassi
parent 170d7d49f5
commit 274e2f4bb9

View File

@@ -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));