Lines Matching refs:test
37 static void cs_amp_lib_test_init_dummy_cal_blob(struct kunit *test, int num_amps) in cs_amp_lib_test_init_dummy_cal_blob() argument
39 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_init_dummy_cal_blob()
46 priv->cal_blob = kunit_kzalloc(test, blob_size, GFP_KERNEL); in cs_amp_lib_test_init_dummy_cal_blob()
47 KUNIT_ASSERT_NOT_NULL(test, priv->cal_blob); in cs_amp_lib_test_init_dummy_cal_blob()
63 static u64 cs_amp_lib_test_get_target_uid(struct kunit *test) in cs_amp_lib_test_get_target_uid() argument
65 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_target_uid()
66 const struct cs_amp_lib_test_param *param = test->param_value; in cs_amp_lib_test_get_target_uid()
91 static void cs_amp_lib_test_cal_data_too_short_test(struct kunit *test) in cs_amp_lib_test_cal_data_too_short_test() argument
93 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_cal_data_too_short_test()
98 kunit_activate_static_stub(test, in cs_amp_lib_test_cal_data_too_short_test()
103 KUNIT_EXPECT_EQ(test, ret, -EOVERFLOW); in cs_amp_lib_test_cal_data_too_short_test()
105 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_cal_data_too_short_test()
114 struct kunit *test = kunit_get_current_test(); in cs_amp_lib_test_get_efi_variable_bad_count() local
115 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_variable_bad_count()
132 static void cs_amp_lib_test_cal_count_too_big_test(struct kunit *test) in cs_amp_lib_test_cal_count_too_big_test() argument
134 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_cal_count_too_big_test()
138 cs_amp_lib_test_init_dummy_cal_blob(test, 8); in cs_amp_lib_test_cal_count_too_big_test()
141 kunit_activate_static_stub(test, in cs_amp_lib_test_cal_count_too_big_test()
146 KUNIT_EXPECT_EQ(test, ret, -EOVERFLOW); in cs_amp_lib_test_cal_count_too_big_test()
148 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_cal_count_too_big_test()
161 static void cs_amp_lib_test_no_cal_data_test(struct kunit *test) in cs_amp_lib_test_no_cal_data_test() argument
163 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_no_cal_data_test()
168 kunit_activate_static_stub(test, in cs_amp_lib_test_no_cal_data_test()
173 KUNIT_EXPECT_EQ(test, ret, -ENOENT); in cs_amp_lib_test_no_cal_data_test()
175 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_no_cal_data_test()
187 struct kunit *test = kunit_get_current_test(); in cs_amp_lib_test_get_efi_variable() local
188 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_variable()
190 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, name); in cs_amp_lib_test_get_efi_variable()
191 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, guid); in cs_amp_lib_test_get_efi_variable()
192 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, size); in cs_amp_lib_test_get_efi_variable()
194 KUNIT_EXPECT_MEMEQ(test, name, expected_name, sizeof(expected_name)); in cs_amp_lib_test_get_efi_variable()
195 KUNIT_EXPECT_MEMEQ(test, guid, &expected_guid, sizeof(expected_guid)); in cs_amp_lib_test_get_efi_variable()
202 KUNIT_ASSERT_GE_MSG(test, ksize(buf), priv->cal_blob->size, "Buffer to small"); in cs_amp_lib_test_get_efi_variable()
210 static void cs_amp_lib_test_get_efi_cal_by_uid_test(struct kunit *test) in cs_amp_lib_test_get_efi_cal_by_uid_test() argument
212 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_cal_by_uid_test()
213 const struct cs_amp_lib_test_param *param = test->param_value; in cs_amp_lib_test_get_efi_cal_by_uid_test()
218 cs_amp_lib_test_init_dummy_cal_blob(test, param->num_amps); in cs_amp_lib_test_get_efi_cal_by_uid_test()
221 kunit_activate_static_stub(test, in cs_amp_lib_test_get_efi_cal_by_uid_test()
225 target_uid = cs_amp_lib_test_get_target_uid(test); in cs_amp_lib_test_get_efi_cal_by_uid_test()
227 KUNIT_EXPECT_EQ(test, ret, 0); in cs_amp_lib_test_get_efi_cal_by_uid_test()
229 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_get_efi_cal_by_uid_test()
231 KUNIT_EXPECT_EQ(test, result_data.calTarget[0], target_uid & 0xFFFFFFFFULL); in cs_amp_lib_test_get_efi_cal_by_uid_test()
232 KUNIT_EXPECT_EQ(test, result_data.calTarget[1], target_uid >> 32); in cs_amp_lib_test_get_efi_cal_by_uid_test()
233 KUNIT_EXPECT_EQ(test, result_data.calTime[0], in cs_amp_lib_test_get_efi_cal_by_uid_test()
235 KUNIT_EXPECT_EQ(test, result_data.calTime[1], in cs_amp_lib_test_get_efi_cal_by_uid_test()
237 KUNIT_EXPECT_EQ(test, result_data.calAmbient, in cs_amp_lib_test_get_efi_cal_by_uid_test()
239 KUNIT_EXPECT_EQ(test, result_data.calStatus, in cs_amp_lib_test_get_efi_cal_by_uid_test()
241 KUNIT_EXPECT_EQ(test, result_data.calR, in cs_amp_lib_test_get_efi_cal_by_uid_test()
246 static void cs_amp_lib_test_get_efi_cal_by_index_unchecked_test(struct kunit *test) in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test() argument
248 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test()
249 const struct cs_amp_lib_test_param *param = test->param_value; in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test()
253 cs_amp_lib_test_init_dummy_cal_blob(test, param->num_amps); in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test()
256 kunit_activate_static_stub(test, in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test()
262 KUNIT_EXPECT_EQ(test, ret, 0); in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test()
264 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test()
266 KUNIT_EXPECT_EQ(test, result_data.calTime[0], in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test()
268 KUNIT_EXPECT_EQ(test, result_data.calTime[1], in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test()
270 KUNIT_EXPECT_EQ(test, result_data.calAmbient, in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test()
272 KUNIT_EXPECT_EQ(test, result_data.calStatus, in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test()
274 KUNIT_EXPECT_EQ(test, result_data.calR, in cs_amp_lib_test_get_efi_cal_by_index_unchecked_test()
279 static void cs_amp_lib_test_get_efi_cal_by_index_checked_test(struct kunit *test) in cs_amp_lib_test_get_efi_cal_by_index_checked_test() argument
281 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
282 const struct cs_amp_lib_test_param *param = test->param_value; in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
287 cs_amp_lib_test_init_dummy_cal_blob(test, param->num_amps); in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
290 kunit_activate_static_stub(test, in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
294 target_uid = cs_amp_lib_test_get_target_uid(test); in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
297 KUNIT_EXPECT_EQ(test, ret, 0); in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
299 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
301 KUNIT_EXPECT_EQ(test, result_data.calTime[0], in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
303 KUNIT_EXPECT_EQ(test, result_data.calTime[1], in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
305 KUNIT_EXPECT_EQ(test, result_data.calAmbient, in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
307 KUNIT_EXPECT_EQ(test, result_data.calStatus, in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
309 KUNIT_EXPECT_EQ(test, result_data.calR, in cs_amp_lib_test_get_efi_cal_by_index_checked_test()
317 static void cs_amp_lib_test_get_efi_cal_by_index_uid_mismatch_test(struct kunit *test) in cs_amp_lib_test_get_efi_cal_by_index_uid_mismatch_test() argument
319 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_cal_by_index_uid_mismatch_test()
320 const struct cs_amp_lib_test_param *param = test->param_value; in cs_amp_lib_test_get_efi_cal_by_index_uid_mismatch_test()
325 cs_amp_lib_test_init_dummy_cal_blob(test, param->num_amps); in cs_amp_lib_test_get_efi_cal_by_index_uid_mismatch_test()
328 kunit_activate_static_stub(test, in cs_amp_lib_test_get_efi_cal_by_index_uid_mismatch_test()
333 target_uid = ~cs_amp_lib_test_get_target_uid(test); in cs_amp_lib_test_get_efi_cal_by_index_uid_mismatch_test()
336 KUNIT_EXPECT_EQ(test, ret, -ENOENT); in cs_amp_lib_test_get_efi_cal_by_index_uid_mismatch_test()
338 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_get_efi_cal_by_index_uid_mismatch_test()
345 static void cs_amp_lib_test_get_efi_cal_by_index_fallback_test(struct kunit *test) in cs_amp_lib_test_get_efi_cal_by_index_fallback_test() argument
347 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_cal_by_index_fallback_test()
348 const struct cs_amp_lib_test_param *param = test->param_value; in cs_amp_lib_test_get_efi_cal_by_index_fallback_test()
353 cs_amp_lib_test_init_dummy_cal_blob(test, param->num_amps); in cs_amp_lib_test_get_efi_cal_by_index_fallback_test()
362 kunit_activate_static_stub(test, in cs_amp_lib_test_get_efi_cal_by_index_fallback_test()
368 KUNIT_EXPECT_EQ(test, ret, 0); in cs_amp_lib_test_get_efi_cal_by_index_fallback_test()
370 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_get_efi_cal_by_index_fallback_test()
372 KUNIT_EXPECT_EQ(test, result_data.calTime[0], in cs_amp_lib_test_get_efi_cal_by_index_fallback_test()
374 KUNIT_EXPECT_EQ(test, result_data.calTime[1], in cs_amp_lib_test_get_efi_cal_by_index_fallback_test()
376 KUNIT_EXPECT_EQ(test, result_data.calAmbient, in cs_amp_lib_test_get_efi_cal_by_index_fallback_test()
378 KUNIT_EXPECT_EQ(test, result_data.calStatus, in cs_amp_lib_test_get_efi_cal_by_index_fallback_test()
380 KUNIT_EXPECT_EQ(test, result_data.calR, in cs_amp_lib_test_get_efi_cal_by_index_fallback_test()
388 static void cs_amp_lib_test_get_efi_cal_uid_not_found_noindex_test(struct kunit *test) in cs_amp_lib_test_get_efi_cal_uid_not_found_noindex_test() argument
390 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_cal_uid_not_found_noindex_test()
395 cs_amp_lib_test_init_dummy_cal_blob(test, 8); in cs_amp_lib_test_get_efi_cal_uid_not_found_noindex_test()
404 kunit_activate_static_stub(test, in cs_amp_lib_test_get_efi_cal_uid_not_found_noindex_test()
410 KUNIT_EXPECT_EQ(test, ret, -ENOENT); in cs_amp_lib_test_get_efi_cal_uid_not_found_noindex_test()
412 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_get_efi_cal_uid_not_found_noindex_test()
419 static void cs_amp_lib_test_get_efi_cal_uid_not_found_index_not_found_test(struct kunit *test) in cs_amp_lib_test_get_efi_cal_uid_not_found_index_not_found_test() argument
421 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_cal_uid_not_found_index_not_found_test()
426 cs_amp_lib_test_init_dummy_cal_blob(test, 8); in cs_amp_lib_test_get_efi_cal_uid_not_found_index_not_found_test()
435 kunit_activate_static_stub(test, in cs_amp_lib_test_get_efi_cal_uid_not_found_index_not_found_test()
441 KUNIT_EXPECT_EQ(test, ret, -ENOENT); in cs_amp_lib_test_get_efi_cal_uid_not_found_index_not_found_test()
443 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_get_efi_cal_uid_not_found_index_not_found_test()
450 static void cs_amp_lib_test_get_efi_cal_no_uid_index_not_found_test(struct kunit *test) in cs_amp_lib_test_get_efi_cal_no_uid_index_not_found_test() argument
452 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_cal_no_uid_index_not_found_test()
456 cs_amp_lib_test_init_dummy_cal_blob(test, 8); in cs_amp_lib_test_get_efi_cal_no_uid_index_not_found_test()
459 kunit_activate_static_stub(test, in cs_amp_lib_test_get_efi_cal_no_uid_index_not_found_test()
464 KUNIT_EXPECT_EQ(test, ret, -ENOENT); in cs_amp_lib_test_get_efi_cal_no_uid_index_not_found_test()
466 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_get_efi_cal_no_uid_index_not_found_test()
470 static void cs_amp_lib_test_get_efi_cal_no_uid_no_index_test(struct kunit *test) in cs_amp_lib_test_get_efi_cal_no_uid_no_index_test() argument
472 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_cal_no_uid_no_index_test()
476 cs_amp_lib_test_init_dummy_cal_blob(test, 8); in cs_amp_lib_test_get_efi_cal_no_uid_no_index_test()
479 kunit_activate_static_stub(test, in cs_amp_lib_test_get_efi_cal_no_uid_no_index_test()
484 KUNIT_EXPECT_EQ(test, ret, -ENOENT); in cs_amp_lib_test_get_efi_cal_no_uid_no_index_test()
486 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_get_efi_cal_no_uid_no_index_test()
493 static void cs_amp_lib_test_get_efi_cal_zero_not_matched_test(struct kunit *test) in cs_amp_lib_test_get_efi_cal_zero_not_matched_test() argument
495 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_cal_zero_not_matched_test()
499 cs_amp_lib_test_init_dummy_cal_blob(test, 8); in cs_amp_lib_test_get_efi_cal_zero_not_matched_test()
508 kunit_activate_static_stub(test, in cs_amp_lib_test_get_efi_cal_zero_not_matched_test()
513 KUNIT_EXPECT_EQ(test, ret, -ENOENT); in cs_amp_lib_test_get_efi_cal_zero_not_matched_test()
515 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_get_efi_cal_zero_not_matched_test()
522 static void cs_amp_lib_test_get_efi_cal_empty_entry_test(struct kunit *test) in cs_amp_lib_test_get_efi_cal_empty_entry_test() argument
524 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_get_efi_cal_empty_entry_test()
528 cs_amp_lib_test_init_dummy_cal_blob(test, 8); in cs_amp_lib_test_get_efi_cal_empty_entry_test()
540 kunit_activate_static_stub(test, in cs_amp_lib_test_get_efi_cal_empty_entry_test()
545 KUNIT_EXPECT_EQ(test, in cs_amp_lib_test_get_efi_cal_empty_entry_test()
552 KUNIT_EXPECT_EQ(test, in cs_amp_lib_test_get_efi_cal_empty_entry_test()
558 kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); in cs_amp_lib_test_get_efi_cal_empty_entry_test()
574 struct kunit *test = kunit_get_current_test(); in cs_amp_lib_test_write_cal_coeff() local
575 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_write_cal_coeff()
578 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctl_name); in cs_amp_lib_test_write_cal_coeff()
579 KUNIT_EXPECT_PTR_EQ(test, controls, &cs_amp_lib_test_calibration_controls); in cs_amp_lib_test_write_cal_coeff()
581 entry = kunit_kzalloc(test, sizeof(*entry), GFP_KERNEL); in cs_amp_lib_test_write_cal_coeff()
582 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, entry); in cs_amp_lib_test_write_cal_coeff()
593 static void cs_amp_lib_test_write_cal_data_test(struct kunit *test) in cs_amp_lib_test_write_cal_data_test() argument
595 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_write_cal_data_test()
601 dsp = kunit_kzalloc(test, sizeof(*dsp), GFP_KERNEL); in cs_amp_lib_test_write_cal_data_test()
602 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dsp); in cs_amp_lib_test_write_cal_data_test()
608 kunit_activate_static_stub(test, in cs_amp_lib_test_write_cal_data_test()
613 KUNIT_EXPECT_EQ(test, ret, 0); in cs_amp_lib_test_write_cal_data_test()
615 kunit_deactivate_static_stub(test, cs_amp_test_hooks->write_cal_coeff); in cs_amp_lib_test_write_cal_data_test()
617 KUNIT_EXPECT_EQ(test, list_count_nodes(&priv->ctl_write_list), 4); in cs_amp_lib_test_write_cal_data_test()
621 KUNIT_EXPECT_STREQ(test, entry->name, cs_amp_lib_test_calibration_controls.checksum); in cs_amp_lib_test_write_cal_data_test()
622 KUNIT_EXPECT_EQ(test, entry->value, data.calR + 1); in cs_amp_lib_test_write_cal_data_test()
626 KUNIT_EXPECT_STREQ(test, entry->name, cs_amp_lib_test_calibration_controls.ambient); in cs_amp_lib_test_write_cal_data_test()
627 KUNIT_EXPECT_EQ(test, entry->value, data.calAmbient); in cs_amp_lib_test_write_cal_data_test()
631 KUNIT_EXPECT_STREQ(test, entry->name, cs_amp_lib_test_calibration_controls.calr); in cs_amp_lib_test_write_cal_data_test()
632 KUNIT_EXPECT_EQ(test, entry->value, data.calR); in cs_amp_lib_test_write_cal_data_test()
636 KUNIT_EXPECT_STREQ(test, entry->name, cs_amp_lib_test_calibration_controls.status); in cs_amp_lib_test_write_cal_data_test()
637 KUNIT_EXPECT_EQ(test, entry->value, data.calStatus); in cs_amp_lib_test_write_cal_data_test()
644 static int cs_amp_lib_test_case_init(struct kunit *test) in cs_amp_lib_test_case_init() argument
649 KUNIT_ASSERT_NOT_NULL(test, cs_amp_test_hooks); in cs_amp_lib_test_case_init()
651 priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL); in cs_amp_lib_test_case_init()
655 test->priv = priv; in cs_amp_lib_test_case_init()
663 KUNIT_ASSERT_GE_MSG(test, ret, 0, "Failed to register amp platform device\n"); in cs_amp_lib_test_case_init()
668 static void cs_amp_lib_test_case_exit(struct kunit *test) in cs_amp_lib_test_case_exit() argument
670 struct cs_amp_lib_test_priv *priv = test->priv; in cs_amp_lib_test_case_exit()