• Home
  • Raw
  • Download

Lines Matching refs:test

15 #define TEST_REQUIRES_BP_SLOTS(test, slots)						\  argument
18 kunit_skip((test), "Requires breakpoint slots: %d > %d", slots, \
23 #define TEST_EXPECT_NOSPC(expr) KUNIT_EXPECT_EQ(test, -ENOSPC, PTR_ERR(expr))
65 static void fill_one_bp_slot(struct kunit *test, int *id, int cpu, struct task_struct *tsk) in fill_one_bp_slot() argument
69 KUNIT_ASSERT_NOT_NULL(test, bp); in fill_one_bp_slot()
70 KUNIT_ASSERT_FALSE(test, IS_ERR(bp)); in fill_one_bp_slot()
71 KUNIT_ASSERT_NULL(test, test_bps[*id]); in fill_one_bp_slot()
80 static bool fill_bp_slots(struct kunit *test, int *id, int cpu, struct task_struct *tsk, int skip) in fill_bp_slots() argument
83 fill_one_bp_slot(test, id, cpu, tsk); in fill_bp_slots()
93 static struct task_struct *get_other_task(struct kunit *test) in get_other_task() argument
101 KUNIT_ASSERT_FALSE(test, IS_ERR(tsk)); in get_other_task()
122 static void test_one_cpu(struct kunit *test) in test_one_cpu() argument
126 fill_bp_slots(test, &idx, get_test_cpu(0), NULL, 0); in test_one_cpu()
131 static void test_many_cpus(struct kunit *test) in test_many_cpus() argument
138 bool do_continue = fill_bp_slots(test, &idx, cpu, NULL, 0); in test_many_cpus()
146 static void test_one_task_on_all_cpus(struct kunit *test) in test_one_task_on_all_cpus() argument
150 fill_bp_slots(test, &idx, -1, current, 0); in test_one_task_on_all_cpus()
156 fill_one_bp_slot(test, &idx, get_test_cpu(0), NULL); in test_one_task_on_all_cpus()
159 static void test_two_tasks_on_all_cpus(struct kunit *test) in test_two_tasks_on_all_cpus() argument
164 fill_bp_slots(test, &idx, -1, current, 0); in test_two_tasks_on_all_cpus()
165 fill_bp_slots(test, &idx, -1, get_other_task(test), 0); in test_two_tasks_on_all_cpus()
168 TEST_EXPECT_NOSPC(register_test_bp(-1, get_other_task(test), idx)); in test_two_tasks_on_all_cpus()
170 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), get_other_task(test), idx)); in test_two_tasks_on_all_cpus()
177 static void test_one_task_on_one_cpu(struct kunit *test) in test_one_task_on_one_cpu() argument
181 fill_bp_slots(test, &idx, get_test_cpu(0), current, 0); in test_one_task_on_one_cpu()
190 fill_one_bp_slot(test, &idx, get_test_cpu(0), NULL); in test_one_task_on_one_cpu()
193 static void test_one_task_mixed(struct kunit *test) in test_one_task_mixed() argument
197 TEST_REQUIRES_BP_SLOTS(test, 3); in test_one_task_mixed()
199 fill_one_bp_slot(test, &idx, get_test_cpu(0), current); in test_one_task_mixed()
200 fill_bp_slots(test, &idx, -1, current, 1); in test_one_task_mixed()
208 fill_one_bp_slot(test, &idx, get_test_cpu(0), NULL); in test_one_task_mixed()
209 fill_one_bp_slot(test, &idx, get_test_cpu(0), NULL); in test_one_task_mixed()
213 static void test_two_tasks_on_one_cpu(struct kunit *test) in test_two_tasks_on_one_cpu() argument
217 fill_bp_slots(test, &idx, get_test_cpu(0), current, 0); in test_two_tasks_on_one_cpu()
218 fill_bp_slots(test, &idx, get_test_cpu(0), get_other_task(test), 0); in test_two_tasks_on_one_cpu()
221 TEST_EXPECT_NOSPC(register_test_bp(-1, get_other_task(test), idx)); in test_two_tasks_on_one_cpu()
223 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), get_other_task(test), idx)); in test_two_tasks_on_one_cpu()
226 fill_bp_slots(test, &idx, get_test_cpu(1), NULL, 0); in test_two_tasks_on_one_cpu()
229 static void test_two_tasks_on_one_all_cpus(struct kunit *test) in test_two_tasks_on_one_all_cpus() argument
233 fill_bp_slots(test, &idx, get_test_cpu(0), current, 0); in test_two_tasks_on_one_all_cpus()
234 fill_bp_slots(test, &idx, -1, get_other_task(test), 0); in test_two_tasks_on_one_all_cpus()
237 TEST_EXPECT_NOSPC(register_test_bp(-1, get_other_task(test), idx)); in test_two_tasks_on_one_all_cpus()
239 TEST_EXPECT_NOSPC(register_test_bp(get_test_cpu(0), get_other_task(test), idx)); in test_two_tasks_on_one_all_cpus()
245 static void test_task_on_all_and_one_cpu(struct kunit *test) in test_task_on_all_and_one_cpu() argument
250 TEST_REQUIRES_BP_SLOTS(test, 3); in test_task_on_all_and_one_cpu()
252 fill_bp_slots(test, &idx, -1, current, 2); in test_task_on_all_and_one_cpu()
255 fill_one_bp_slot(test, &idx, get_test_cpu(0), current); in test_task_on_all_and_one_cpu()
256 fill_one_bp_slot(test, &idx, -1, current); in test_task_on_all_and_one_cpu()
264 fill_one_bp_slot(test, &idx, get_test_cpu(1), NULL); in test_task_on_all_and_one_cpu()
273 fill_one_bp_slot(test, &idx, -1, current); in test_task_on_all_and_one_cpu()
294 static int test_init(struct kunit *test) in test_init() argument
298 kunit_skip(test, "not enough cpus"); in test_init()
302 kunit_skip(test, "hw breakpoint already in use"); in test_init()
307 static void test_exit(struct kunit *test) in test_exit() argument
320 KUNIT_EXPECT_FALSE(test, hw_breakpoint_is_used()); in test_exit()