Lines Matching refs:test
16 #define EXPECT_FOR_EACH_CPU_EQ(test, mask) \ argument
23 KUNIT_EXPECT_EQ_MSG((test), mask_weight, iter, MASK_MSG(mask)); \
26 #define EXPECT_FOR_EACH_CPU_NOT_EQ(test, mask) \ argument
33 KUNIT_EXPECT_EQ_MSG((test), nr_cpu_ids - mask_weight, iter, MASK_MSG(mask)); \
36 #define EXPECT_FOR_EACH_CPU_OP_EQ(test, op, mask1, mask2) \ argument
46 KUNIT_EXPECT_EQ((test), weight, iter); \
49 #define EXPECT_FOR_EACH_CPU_WRAP_EQ(test, mask) \ argument
56 KUNIT_EXPECT_EQ_MSG((test), mask_weight, iter, MASK_MSG(mask)); \
59 #define EXPECT_FOR_EACH_CPU_BUILTIN_EQ(test, name) \ argument
65 KUNIT_EXPECT_EQ_MSG((test), mask_weight, iter, MASK_MSG(cpu_##name##_mask)); \
72 static void test_cpumask_weight(struct kunit *test) in test_cpumask_weight() argument
74 KUNIT_EXPECT_TRUE_MSG(test, cpumask_empty(&mask_empty), MASK_MSG(&mask_empty)); in test_cpumask_weight()
75 KUNIT_EXPECT_TRUE_MSG(test, cpumask_full(&mask_all), MASK_MSG(&mask_all)); in test_cpumask_weight()
77 KUNIT_EXPECT_EQ_MSG(test, 0, cpumask_weight(&mask_empty), MASK_MSG(&mask_empty)); in test_cpumask_weight()
78 KUNIT_EXPECT_EQ_MSG(test, nr_cpu_ids, cpumask_weight(cpu_possible_mask), in test_cpumask_weight()
80 KUNIT_EXPECT_EQ_MSG(test, nr_cpumask_bits, cpumask_weight(&mask_all), MASK_MSG(&mask_all)); in test_cpumask_weight()
83 static void test_cpumask_first(struct kunit *test) in test_cpumask_first() argument
85 KUNIT_EXPECT_LE_MSG(test, nr_cpu_ids, cpumask_first(&mask_empty), MASK_MSG(&mask_empty)); in test_cpumask_first()
86 KUNIT_EXPECT_EQ_MSG(test, 0, cpumask_first(cpu_possible_mask), MASK_MSG(cpu_possible_mask)); in test_cpumask_first()
88 KUNIT_EXPECT_EQ_MSG(test, 0, cpumask_first_zero(&mask_empty), MASK_MSG(&mask_empty)); in test_cpumask_first()
89 KUNIT_EXPECT_LE_MSG(test, nr_cpu_ids, cpumask_first_zero(cpu_possible_mask), in test_cpumask_first()
93 static void test_cpumask_last(struct kunit *test) in test_cpumask_last() argument
95 KUNIT_EXPECT_LE_MSG(test, nr_cpumask_bits, cpumask_last(&mask_empty), in test_cpumask_last()
97 KUNIT_EXPECT_EQ_MSG(test, nr_cpu_ids - 1, cpumask_last(cpu_possible_mask), in test_cpumask_last()
101 static void test_cpumask_next(struct kunit *test) in test_cpumask_next() argument
103 KUNIT_EXPECT_EQ_MSG(test, 0, cpumask_next_zero(-1, &mask_empty), MASK_MSG(&mask_empty)); in test_cpumask_next()
104 KUNIT_EXPECT_LE_MSG(test, nr_cpu_ids, cpumask_next_zero(-1, cpu_possible_mask), in test_cpumask_next()
107 KUNIT_EXPECT_LE_MSG(test, nr_cpu_ids, cpumask_next(-1, &mask_empty), in test_cpumask_next()
109 KUNIT_EXPECT_EQ_MSG(test, 0, cpumask_next(-1, cpu_possible_mask), in test_cpumask_next()
113 static void test_cpumask_iterators(struct kunit *test) in test_cpumask_iterators() argument
115 EXPECT_FOR_EACH_CPU_EQ(test, &mask_empty); in test_cpumask_iterators()
116 EXPECT_FOR_EACH_CPU_NOT_EQ(test, &mask_empty); in test_cpumask_iterators()
117 EXPECT_FOR_EACH_CPU_WRAP_EQ(test, &mask_empty); in test_cpumask_iterators()
118 EXPECT_FOR_EACH_CPU_OP_EQ(test, and, &mask_empty, &mask_empty); in test_cpumask_iterators()
119 EXPECT_FOR_EACH_CPU_OP_EQ(test, and, cpu_possible_mask, &mask_empty); in test_cpumask_iterators()
120 EXPECT_FOR_EACH_CPU_OP_EQ(test, andnot, &mask_empty, &mask_empty); in test_cpumask_iterators()
122 EXPECT_FOR_EACH_CPU_EQ(test, cpu_possible_mask); in test_cpumask_iterators()
123 EXPECT_FOR_EACH_CPU_NOT_EQ(test, cpu_possible_mask); in test_cpumask_iterators()
124 EXPECT_FOR_EACH_CPU_WRAP_EQ(test, cpu_possible_mask); in test_cpumask_iterators()
125 EXPECT_FOR_EACH_CPU_OP_EQ(test, and, cpu_possible_mask, cpu_possible_mask); in test_cpumask_iterators()
126 EXPECT_FOR_EACH_CPU_OP_EQ(test, andnot, cpu_possible_mask, &mask_empty); in test_cpumask_iterators()
129 static void test_cpumask_iterators_builtin(struct kunit *test) in test_cpumask_iterators_builtin() argument
131 EXPECT_FOR_EACH_CPU_BUILTIN_EQ(test, possible); in test_cpumask_iterators_builtin()
136 EXPECT_FOR_EACH_CPU_BUILTIN_EQ(test, online); in test_cpumask_iterators_builtin()
137 EXPECT_FOR_EACH_CPU_BUILTIN_EQ(test, present); in test_cpumask_iterators_builtin()
142 static int test_cpumask_init(struct kunit *test) in test_cpumask_init() argument