Lines Matching refs:test
161 void (*run_case)(struct kunit *test);
232 int (*init)(struct kunit *test);
233 void (*exit)(struct kunit *test);
283 static inline void kunit_set_failure(struct kunit *test) in kunit_set_failure() argument
285 WRITE_ONCE(test->status, KUNIT_FAILURE); in kunit_set_failure()
288 void kunit_init_test(struct kunit *test, const char *name, char *log);
382 struct kunit_resource *kunit_alloc_and_get_resource(struct kunit *test,
442 int kunit_add_resource(struct kunit *test,
457 int kunit_add_named_resource(struct kunit *test,
480 static inline void *kunit_alloc_resource(struct kunit *test, in kunit_alloc_resource() argument
492 if (!kunit_add_resource(test, init, free, res, context)) in kunit_alloc_resource()
498 typedef bool (*kunit_resource_match_t)(struct kunit *test,
511 static inline bool kunit_resource_instance_match(struct kunit *test, in kunit_resource_instance_match() argument
524 static inline bool kunit_resource_name_match(struct kunit *test, in kunit_resource_name_match() argument
538 kunit_find_resource(struct kunit *test, in kunit_find_resource() argument
545 spin_lock_irqsave(&test->lock, flags); in kunit_find_resource()
547 list_for_each_entry_reverse(res, &test->resources, node) { in kunit_find_resource()
548 if (match(test, res, (void *)match_data)) { in kunit_find_resource()
555 spin_unlock_irqrestore(&test->lock, flags); in kunit_find_resource()
566 kunit_find_named_resource(struct kunit *test, in kunit_find_named_resource() argument
569 return kunit_find_resource(test, kunit_resource_name_match, in kunit_find_named_resource()
582 int kunit_destroy_resource(struct kunit *test,
586 static inline int kunit_destroy_named_resource(struct kunit *test, in kunit_destroy_named_resource() argument
589 return kunit_destroy_resource(test, kunit_resource_name_match, in kunit_destroy_named_resource()
603 void kunit_remove_resource(struct kunit *test, struct kunit_resource *res);
616 void *kunit_kmalloc_array(struct kunit *test, size_t n, size_t size, gfp_t gfp);
626 static inline void *kunit_kmalloc(struct kunit *test, size_t size, gfp_t gfp) in kunit_kmalloc() argument
628 return kunit_kmalloc_array(test, 1, size, gfp); in kunit_kmalloc()
636 void kunit_kfree(struct kunit *test, const void *ptr);
646 static inline void *kunit_kzalloc(struct kunit *test, size_t size, gfp_t gfp) in kunit_kzalloc() argument
648 return kunit_kmalloc(test, size, gfp | __GFP_ZERO); in kunit_kzalloc()
660 static inline void *kunit_kcalloc(struct kunit *test, size_t n, size_t size, gfp_t gfp) in kunit_kcalloc() argument
662 return kunit_kmalloc_array(test, n, size, gfp | __GFP_ZERO); in kunit_kcalloc()
665 void kunit_cleanup(struct kunit *test);
716 #define kunit_printk(lvl, test, fmt, ...) \ argument
717 kunit_log(lvl, test, KUNIT_SUBTEST_INDENT "# %s: " fmt, \
718 (test)->name, ##__VA_ARGS__)
729 #define kunit_info(test, fmt, ...) \ argument
730 kunit_printk(KERN_INFO, test, fmt, ##__VA_ARGS__)
740 #define kunit_warn(test, fmt, ...) \ argument
741 kunit_printk(KERN_WARNING, test, fmt, ##__VA_ARGS__)
751 #define kunit_err(test, fmt, ...) \ argument
752 kunit_printk(KERN_ERR, test, fmt, ##__VA_ARGS__)
762 #define KUNIT_SUCCEED(test) do {} while (0) argument
764 void kunit_do_assertion(struct kunit *test,
769 #define KUNIT_ASSERTION(test, pass, assert_class, INITIALIZER, fmt, ...) do { \ argument
771 kunit_do_assertion(test, \
779 #define KUNIT_FAIL_ASSERTION(test, assert_type, fmt, ...) \ argument
780 KUNIT_ASSERTION(test, \
783 KUNIT_INIT_FAIL_ASSERT_STRUCT(test, assert_type), \
798 #define KUNIT_FAIL(test, fmt, ...) \ argument
799 KUNIT_FAIL_ASSERTION(test, \
804 #define KUNIT_UNARY_ASSERTION(test, \ argument
810 KUNIT_ASSERTION(test, \
813 KUNIT_INIT_UNARY_ASSERT_STRUCT(test, \
820 #define KUNIT_TRUE_MSG_ASSERTION(test, assert_type, condition, fmt, ...) \ argument
821 KUNIT_UNARY_ASSERTION(test, \
828 #define KUNIT_TRUE_ASSERTION(test, assert_type, condition) \ argument
829 KUNIT_TRUE_MSG_ASSERTION(test, assert_type, condition, NULL)
831 #define KUNIT_FALSE_MSG_ASSERTION(test, assert_type, condition, fmt, ...) \ argument
832 KUNIT_UNARY_ASSERTION(test, \
839 #define KUNIT_FALSE_ASSERTION(test, assert_type, condition) \ argument
840 KUNIT_FALSE_MSG_ASSERTION(test, assert_type, condition, NULL)
856 #define KUNIT_BASE_BINARY_ASSERTION(test, \ argument
869 KUNIT_ASSERTION(test, \
872 ASSERT_CLASS_INIT(test, \
883 #define KUNIT_BASE_EQ_MSG_ASSERTION(test, \ argument
891 KUNIT_BASE_BINARY_ASSERTION(test, \
899 #define KUNIT_BASE_NE_MSG_ASSERTION(test, \ argument
907 KUNIT_BASE_BINARY_ASSERTION(test, \
915 #define KUNIT_BASE_LT_MSG_ASSERTION(test, \ argument
923 KUNIT_BASE_BINARY_ASSERTION(test, \
931 #define KUNIT_BASE_LE_MSG_ASSERTION(test, \ argument
939 KUNIT_BASE_BINARY_ASSERTION(test, \
947 #define KUNIT_BASE_GT_MSG_ASSERTION(test, \ argument
955 KUNIT_BASE_BINARY_ASSERTION(test, \
963 #define KUNIT_BASE_GE_MSG_ASSERTION(test, \ argument
971 KUNIT_BASE_BINARY_ASSERTION(test, \
979 #define KUNIT_BINARY_EQ_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\ argument
980 KUNIT_BASE_EQ_MSG_ASSERTION(test, \
989 #define KUNIT_BINARY_EQ_ASSERTION(test, assert_type, left, right) \ argument
990 KUNIT_BINARY_EQ_MSG_ASSERTION(test, \
996 #define KUNIT_BINARY_PTR_EQ_MSG_ASSERTION(test, \ argument
1002 KUNIT_BASE_EQ_MSG_ASSERTION(test, \
1011 #define KUNIT_BINARY_PTR_EQ_ASSERTION(test, assert_type, left, right) \ argument
1012 KUNIT_BINARY_PTR_EQ_MSG_ASSERTION(test, \
1018 #define KUNIT_BINARY_NE_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\ argument
1019 KUNIT_BASE_NE_MSG_ASSERTION(test, \
1028 #define KUNIT_BINARY_NE_ASSERTION(test, assert_type, left, right) \ argument
1029 KUNIT_BINARY_NE_MSG_ASSERTION(test, \
1035 #define KUNIT_BINARY_PTR_NE_MSG_ASSERTION(test, \ argument
1041 KUNIT_BASE_NE_MSG_ASSERTION(test, \
1050 #define KUNIT_BINARY_PTR_NE_ASSERTION(test, assert_type, left, right) \ argument
1051 KUNIT_BINARY_PTR_NE_MSG_ASSERTION(test, \
1057 #define KUNIT_BINARY_LT_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\ argument
1058 KUNIT_BASE_LT_MSG_ASSERTION(test, \
1067 #define KUNIT_BINARY_LT_ASSERTION(test, assert_type, left, right) \ argument
1068 KUNIT_BINARY_LT_MSG_ASSERTION(test, \
1074 #define KUNIT_BINARY_PTR_LT_MSG_ASSERTION(test, \ argument
1080 KUNIT_BASE_LT_MSG_ASSERTION(test, \
1089 #define KUNIT_BINARY_PTR_LT_ASSERTION(test, assert_type, left, right) \ argument
1090 KUNIT_BINARY_PTR_LT_MSG_ASSERTION(test, \
1096 #define KUNIT_BINARY_LE_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\ argument
1097 KUNIT_BASE_LE_MSG_ASSERTION(test, \
1106 #define KUNIT_BINARY_LE_ASSERTION(test, assert_type, left, right) \ argument
1107 KUNIT_BINARY_LE_MSG_ASSERTION(test, \
1113 #define KUNIT_BINARY_PTR_LE_MSG_ASSERTION(test, \ argument
1119 KUNIT_BASE_LE_MSG_ASSERTION(test, \
1128 #define KUNIT_BINARY_PTR_LE_ASSERTION(test, assert_type, left, right) \ argument
1129 KUNIT_BINARY_PTR_LE_MSG_ASSERTION(test, \
1135 #define KUNIT_BINARY_GT_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\ argument
1136 KUNIT_BASE_GT_MSG_ASSERTION(test, \
1145 #define KUNIT_BINARY_GT_ASSERTION(test, assert_type, left, right) \ argument
1146 KUNIT_BINARY_GT_MSG_ASSERTION(test, \
1152 #define KUNIT_BINARY_PTR_GT_MSG_ASSERTION(test, \ argument
1158 KUNIT_BASE_GT_MSG_ASSERTION(test, \
1167 #define KUNIT_BINARY_PTR_GT_ASSERTION(test, assert_type, left, right) \ argument
1168 KUNIT_BINARY_PTR_GT_MSG_ASSERTION(test, \
1174 #define KUNIT_BINARY_GE_MSG_ASSERTION(test, assert_type, left, right, fmt, ...)\ argument
1175 KUNIT_BASE_GE_MSG_ASSERTION(test, \
1184 #define KUNIT_BINARY_GE_ASSERTION(test, assert_type, left, right) \ argument
1185 KUNIT_BINARY_GE_MSG_ASSERTION(test, \
1191 #define KUNIT_BINARY_PTR_GE_MSG_ASSERTION(test, \ argument
1197 KUNIT_BASE_GE_MSG_ASSERTION(test, \
1206 #define KUNIT_BINARY_PTR_GE_ASSERTION(test, assert_type, left, right) \ argument
1207 KUNIT_BINARY_PTR_GE_MSG_ASSERTION(test, \
1213 #define KUNIT_BINARY_STR_ASSERTION(test, \ argument
1224 KUNIT_ASSERTION(test, \
1227 KUNIT_INIT_BINARY_STR_ASSERT_STRUCT(test, \
1238 #define KUNIT_BINARY_STR_EQ_MSG_ASSERTION(test, \ argument
1244 KUNIT_BINARY_STR_ASSERTION(test, \
1250 #define KUNIT_BINARY_STR_EQ_ASSERTION(test, assert_type, left, right) \ argument
1251 KUNIT_BINARY_STR_EQ_MSG_ASSERTION(test, \
1257 #define KUNIT_BINARY_STR_NE_MSG_ASSERTION(test, \ argument
1263 KUNIT_BINARY_STR_ASSERTION(test, \
1269 #define KUNIT_BINARY_STR_NE_ASSERTION(test, assert_type, left, right) \ argument
1270 KUNIT_BINARY_STR_NE_MSG_ASSERTION(test, \
1276 #define KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test, \ argument
1284 KUNIT_ASSERTION(test, \
1287 KUNIT_INIT_PTR_NOT_ERR_STRUCT(test, \
1295 #define KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION(test, assert_type, ptr) \ argument
1296 KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test, \
1312 #define KUNIT_EXPECT_TRUE(test, condition) \ argument
1313 KUNIT_TRUE_ASSERTION(test, KUNIT_EXPECTATION, condition)
1315 #define KUNIT_EXPECT_TRUE_MSG(test, condition, fmt, ...) \ argument
1316 KUNIT_TRUE_MSG_ASSERTION(test, \
1331 #define KUNIT_EXPECT_FALSE(test, condition) \ argument
1332 KUNIT_FALSE_ASSERTION(test, KUNIT_EXPECTATION, condition)
1334 #define KUNIT_EXPECT_FALSE_MSG(test, condition, fmt, ...) \ argument
1335 KUNIT_FALSE_MSG_ASSERTION(test, \
1352 #define KUNIT_EXPECT_EQ(test, left, right) \ argument
1353 KUNIT_BINARY_EQ_ASSERTION(test, KUNIT_EXPECTATION, left, right)
1355 #define KUNIT_EXPECT_EQ_MSG(test, left, right, fmt, ...) \ argument
1356 KUNIT_BINARY_EQ_MSG_ASSERTION(test, \
1374 #define KUNIT_EXPECT_PTR_EQ(test, left, right) \ argument
1375 KUNIT_BINARY_PTR_EQ_ASSERTION(test, \
1380 #define KUNIT_EXPECT_PTR_EQ_MSG(test, left, right, fmt, ...) \ argument
1381 KUNIT_BINARY_PTR_EQ_MSG_ASSERTION(test, \
1399 #define KUNIT_EXPECT_NE(test, left, right) \ argument
1400 KUNIT_BINARY_NE_ASSERTION(test, KUNIT_EXPECTATION, left, right)
1402 #define KUNIT_EXPECT_NE_MSG(test, left, right, fmt, ...) \ argument
1403 KUNIT_BINARY_NE_MSG_ASSERTION(test, \
1421 #define KUNIT_EXPECT_PTR_NE(test, left, right) \ argument
1422 KUNIT_BINARY_PTR_NE_ASSERTION(test, \
1427 #define KUNIT_EXPECT_PTR_NE_MSG(test, left, right, fmt, ...) \ argument
1428 KUNIT_BINARY_PTR_NE_MSG_ASSERTION(test, \
1446 #define KUNIT_EXPECT_LT(test, left, right) \ argument
1447 KUNIT_BINARY_LT_ASSERTION(test, KUNIT_EXPECTATION, left, right)
1449 #define KUNIT_EXPECT_LT_MSG(test, left, right, fmt, ...) \ argument
1450 KUNIT_BINARY_LT_MSG_ASSERTION(test, \
1468 #define KUNIT_EXPECT_LE(test, left, right) \ argument
1469 KUNIT_BINARY_LE_ASSERTION(test, KUNIT_EXPECTATION, left, right)
1471 #define KUNIT_EXPECT_LE_MSG(test, left, right, fmt, ...) \ argument
1472 KUNIT_BINARY_LE_MSG_ASSERTION(test, \
1490 #define KUNIT_EXPECT_GT(test, left, right) \ argument
1491 KUNIT_BINARY_GT_ASSERTION(test, KUNIT_EXPECTATION, left, right)
1493 #define KUNIT_EXPECT_GT_MSG(test, left, right, fmt, ...) \ argument
1494 KUNIT_BINARY_GT_MSG_ASSERTION(test, \
1512 #define KUNIT_EXPECT_GE(test, left, right) \ argument
1513 KUNIT_BINARY_GE_ASSERTION(test, KUNIT_EXPECTATION, left, right)
1515 #define KUNIT_EXPECT_GE_MSG(test, left, right, fmt, ...) \ argument
1516 KUNIT_BINARY_GE_MSG_ASSERTION(test, \
1534 #define KUNIT_EXPECT_STREQ(test, left, right) \ argument
1535 KUNIT_BINARY_STR_EQ_ASSERTION(test, KUNIT_EXPECTATION, left, right)
1537 #define KUNIT_EXPECT_STREQ_MSG(test, left, right, fmt, ...) \ argument
1538 KUNIT_BINARY_STR_EQ_MSG_ASSERTION(test, \
1556 #define KUNIT_EXPECT_STRNEQ(test, left, right) \ argument
1557 KUNIT_BINARY_STR_NE_ASSERTION(test, KUNIT_EXPECTATION, left, right)
1559 #define KUNIT_EXPECT_STRNEQ_MSG(test, left, right, fmt, ...) \ argument
1560 KUNIT_BINARY_STR_NE_MSG_ASSERTION(test, \
1577 #define KUNIT_EXPECT_NOT_ERR_OR_NULL(test, ptr) \ argument
1578 KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION(test, KUNIT_EXPECTATION, ptr)
1580 #define KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(test, ptr, fmt, ...) \ argument
1581 KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test, \
1587 #define KUNIT_ASSERT_FAILURE(test, fmt, ...) \ argument
1588 KUNIT_FAIL_ASSERTION(test, KUNIT_ASSERTION, fmt, ##__VA_ARGS__)
1601 #define KUNIT_ASSERT_TRUE(test, condition) \ argument
1602 KUNIT_TRUE_ASSERTION(test, KUNIT_ASSERTION, condition)
1604 #define KUNIT_ASSERT_TRUE_MSG(test, condition, fmt, ...) \ argument
1605 KUNIT_TRUE_MSG_ASSERTION(test, \
1620 #define KUNIT_ASSERT_FALSE(test, condition) \ argument
1621 KUNIT_FALSE_ASSERTION(test, KUNIT_ASSERTION, condition)
1623 #define KUNIT_ASSERT_FALSE_MSG(test, condition, fmt, ...) \ argument
1624 KUNIT_FALSE_MSG_ASSERTION(test, \
1640 #define KUNIT_ASSERT_EQ(test, left, right) \ argument
1641 KUNIT_BINARY_EQ_ASSERTION(test, KUNIT_ASSERTION, left, right)
1643 #define KUNIT_ASSERT_EQ_MSG(test, left, right, fmt, ...) \ argument
1644 KUNIT_BINARY_EQ_MSG_ASSERTION(test, \
1661 #define KUNIT_ASSERT_PTR_EQ(test, left, right) \ argument
1662 KUNIT_BINARY_PTR_EQ_ASSERTION(test, KUNIT_ASSERTION, left, right)
1664 #define KUNIT_ASSERT_PTR_EQ_MSG(test, left, right, fmt, ...) \ argument
1665 KUNIT_BINARY_PTR_EQ_MSG_ASSERTION(test, \
1682 #define KUNIT_ASSERT_NE(test, left, right) \ argument
1683 KUNIT_BINARY_NE_ASSERTION(test, KUNIT_ASSERTION, left, right)
1685 #define KUNIT_ASSERT_NE_MSG(test, left, right, fmt, ...) \ argument
1686 KUNIT_BINARY_NE_MSG_ASSERTION(test, \
1704 #define KUNIT_ASSERT_PTR_NE(test, left, right) \ argument
1705 KUNIT_BINARY_PTR_NE_ASSERTION(test, KUNIT_ASSERTION, left, right)
1707 #define KUNIT_ASSERT_PTR_NE_MSG(test, left, right, fmt, ...) \ argument
1708 KUNIT_BINARY_PTR_NE_MSG_ASSERTION(test, \
1725 #define KUNIT_ASSERT_LT(test, left, right) \ argument
1726 KUNIT_BINARY_LT_ASSERTION(test, KUNIT_ASSERTION, left, right)
1728 #define KUNIT_ASSERT_LT_MSG(test, left, right, fmt, ...) \ argument
1729 KUNIT_BINARY_LT_MSG_ASSERTION(test, \
1746 #define KUNIT_ASSERT_LE(test, left, right) \ argument
1747 KUNIT_BINARY_LE_ASSERTION(test, KUNIT_ASSERTION, left, right)
1749 #define KUNIT_ASSERT_LE_MSG(test, left, right, fmt, ...) \ argument
1750 KUNIT_BINARY_LE_MSG_ASSERTION(test, \
1768 #define KUNIT_ASSERT_GT(test, left, right) \ argument
1769 KUNIT_BINARY_GT_ASSERTION(test, KUNIT_ASSERTION, left, right)
1771 #define KUNIT_ASSERT_GT_MSG(test, left, right, fmt, ...) \ argument
1772 KUNIT_BINARY_GT_MSG_ASSERTION(test, \
1790 #define KUNIT_ASSERT_GE(test, left, right) \ argument
1791 KUNIT_BINARY_GE_ASSERTION(test, KUNIT_ASSERTION, left, right)
1793 #define KUNIT_ASSERT_GE_MSG(test, left, right, fmt, ...) \ argument
1794 KUNIT_BINARY_GE_MSG_ASSERTION(test, \
1811 #define KUNIT_ASSERT_STREQ(test, left, right) \ argument
1812 KUNIT_BINARY_STR_EQ_ASSERTION(test, KUNIT_ASSERTION, left, right)
1814 #define KUNIT_ASSERT_STREQ_MSG(test, left, right, fmt, ...) \ argument
1815 KUNIT_BINARY_STR_EQ_MSG_ASSERTION(test, \
1833 #define KUNIT_ASSERT_STRNEQ(test, left, right) \ argument
1834 KUNIT_BINARY_STR_NE_ASSERTION(test, KUNIT_ASSERTION, left, right)
1836 #define KUNIT_ASSERT_STRNEQ_MSG(test, left, right, fmt, ...) \ argument
1837 KUNIT_BINARY_STR_NE_MSG_ASSERTION(test, \
1854 #define KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr) \ argument
1855 KUNIT_PTR_NOT_ERR_OR_NULL_ASSERTION(test, KUNIT_ASSERTION, ptr)
1857 #define KUNIT_ASSERT_NOT_ERR_OR_NULL_MSG(test, ptr, fmt, ...) \ argument
1858 KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test, \