[PATCH v3 2/9] lib/test_cpumask: Make test_cpumask_last check for nr_cpu_ids bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



test_cpumask_last() currently fails on a system with
  CONFIG_NR_CPUS=64
  CONFIG_CPUMASK_OFFSTACK=n
  nr_cpu_ids < NR_CPUS

  [   14.088853]     # test_cpumask_last: EXPECTATION FAILED at lib/test_cpumask.c:77
  [   14.088853]     Expected ((unsigned int)64) - 1 == cpumask_last(((const struct cpumask *)&__cpu_possible_mask)), but
  [   14.088853]         ((unsigned int)64) - 1 == 63
  [   14.088853]         cpumask_last(((const struct cpumask *)&__cpu_possible_mask)) == 3
  [   14.090435]     not ok 3 - test_cpumask_last

Per smp.c::setup_nr_cpu_ids(), nr_cpu_ids <= NR_CPUS, so we want
the test to use nr_cpu_ids rather than nr_cpumask_bits.

Signed-off-by: Valentin Schneider <vschneid@xxxxxxxxxx>
---
 lib/test_cpumask.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/test_cpumask.c b/lib/test_cpumask.c
index a31a1622f1f6..81b17563fcb3 100644
--- a/lib/test_cpumask.c
+++ b/lib/test_cpumask.c
@@ -73,8 +73,8 @@ static void test_cpumask_first(struct kunit *test)
 
 static void test_cpumask_last(struct kunit *test)
 {
-	KUNIT_EXPECT_LE(test, nr_cpumask_bits, cpumask_last(&mask_empty));
-	KUNIT_EXPECT_EQ(test, nr_cpumask_bits - 1, cpumask_last(cpu_possible_mask));
+	KUNIT_EXPECT_LE(test, nr_cpu_ids, cpumask_last(&mask_empty));
+	KUNIT_EXPECT_EQ(test, nr_cpu_ids - 1, cpumask_last(cpu_possible_mask));
 }
 
 static void test_cpumask_next(struct kunit *test)
-- 
2.31.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux