Lines Matching refs:test
127 void (*run_case)(struct kunit *test);
247 int (*init)(struct kunit *test);
248 void (*exit)(struct kunit *test);
309 static inline void kunit_set_failure(struct kunit *test) in kunit_set_failure() argument
311 WRITE_ONCE(test->status, KUNIT_FAILURE); in kunit_set_failure()
320 void kunit_init_test(struct kunit *test, const char *name, struct string_stream *log);
432 void *kunit_kmalloc_array(struct kunit *test, size_t n, size_t size, gfp_t gfp);
445 static inline void *kunit_kmalloc(struct kunit *test, size_t size, gfp_t gfp) in kunit_kmalloc() argument
447 return kunit_kmalloc_array(test, 1, size, gfp); in kunit_kmalloc()
455 void kunit_kfree(struct kunit *test, const void *ptr);
465 static inline void *kunit_kzalloc(struct kunit *test, size_t size, gfp_t gfp) in kunit_kzalloc() argument
467 return kunit_kmalloc(test, size, gfp | __GFP_ZERO); in kunit_kzalloc()
479 static inline void *kunit_kcalloc(struct kunit *test, size_t n, size_t size, gfp_t gfp) in kunit_kcalloc() argument
481 return kunit_kmalloc_array(test, n, size, gfp | __GFP_ZERO); in kunit_kcalloc()
493 void kunit_kfree_const(struct kunit *test, const void *x);
504 static inline char *kunit_kstrdup(struct kunit *test, const char *str, gfp_t gfp) in kunit_kstrdup() argument
513 buf = kunit_kmalloc(test, len, gfp); in kunit_kstrdup()
530 const char *kunit_kstrdup_const(struct kunit *test, const char *str, gfp_t gfp);
544 unsigned long kunit_vm_mmap(struct kunit *test, struct file *file,
549 void kunit_cleanup(struct kunit *test);
600 #define kunit_printk(lvl, test, fmt, ...) \ argument
601 kunit_log(lvl, test, KUNIT_SUBTEST_INDENT "# %s: " fmt, \
602 (test)->name, ##__VA_ARGS__)
613 #define kunit_info(test, fmt, ...) \ argument
614 kunit_printk(KERN_INFO, test, fmt, ##__VA_ARGS__)
624 #define kunit_warn(test, fmt, ...) \ argument
625 kunit_printk(KERN_WARNING, test, fmt, ##__VA_ARGS__)
635 #define kunit_err(test, fmt, ...) \ argument
636 kunit_printk(KERN_ERR, test, fmt, ##__VA_ARGS__)
642 #define _KUNIT_SAVE_LOC(test) do { \ argument
643 WRITE_ONCE(test->last_seen.file, __FILE__); \
644 WRITE_ONCE(test->last_seen.line, __LINE__); \
655 #define KUNIT_SUCCEED(test) _KUNIT_SAVE_LOC(test) argument
657 void __noreturn __kunit_abort(struct kunit *test);
659 void __printf(6, 7) __kunit_do_failed_assertion(struct kunit *test,
666 #define _KUNIT_FAILED(test, assert_type, assert_class, assert_format, INITIALIZER, fmt, ...) do { \ argument
669 __kunit_do_failed_assertion(test, \
677 __kunit_abort(test); \
681 #define KUNIT_FAIL_ASSERTION(test, assert_type, fmt, ...) do { \ argument
682 _KUNIT_SAVE_LOC(test); \
683 _KUNIT_FAILED(test, \
703 #define KUNIT_FAIL(test, fmt, ...) \ argument
704 KUNIT_FAIL_ASSERTION(test, \
712 #define KUNIT_UNARY_ASSERTION(test, \ argument
719 _KUNIT_SAVE_LOC(test); \
723 _KUNIT_FAILED(test, \
733 #define KUNIT_TRUE_MSG_ASSERTION(test, assert_type, condition, fmt, ...) \ argument
734 KUNIT_UNARY_ASSERTION(test, \
741 #define KUNIT_FALSE_MSG_ASSERTION(test, assert_type, condition, fmt, ...) \ argument
742 KUNIT_UNARY_ASSERTION(test, \
763 #define KUNIT_BASE_BINARY_ASSERTION(test, \ argument
781 _KUNIT_SAVE_LOC(test); \
785 _KUNIT_FAILED(test, \
796 #define KUNIT_BINARY_INT_ASSERTION(test, \ argument
803 KUNIT_BASE_BINARY_ASSERTION(test, \
811 #define KUNIT_BINARY_PTR_ASSERTION(test, \ argument
818 KUNIT_BASE_BINARY_ASSERTION(test, \
826 #define KUNIT_BINARY_STR_ASSERTION(test, \ argument
842 _KUNIT_SAVE_LOC(test); \
847 _KUNIT_FAILED(test, \
858 #define KUNIT_MEM_ASSERTION(test, \ argument
876 _KUNIT_SAVE_LOC(test); \
881 _KUNIT_FAILED(test, \
893 #define KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test, \ argument
901 _KUNIT_SAVE_LOC(test); \
905 _KUNIT_FAILED(test, \
925 #define KUNIT_EXPECT_TRUE(test, condition) \ argument
926 KUNIT_EXPECT_TRUE_MSG(test, condition, NULL)
928 #define KUNIT_EXPECT_TRUE_MSG(test, condition, fmt, ...) \ argument
929 KUNIT_TRUE_MSG_ASSERTION(test, \
944 #define KUNIT_EXPECT_FALSE(test, condition) \ argument
945 KUNIT_EXPECT_FALSE_MSG(test, condition, NULL)
947 #define KUNIT_EXPECT_FALSE_MSG(test, condition, fmt, ...) \ argument
948 KUNIT_FALSE_MSG_ASSERTION(test, \
965 #define KUNIT_EXPECT_EQ(test, left, right) \ argument
966 KUNIT_EXPECT_EQ_MSG(test, left, right, NULL)
968 #define KUNIT_EXPECT_EQ_MSG(test, left, right, fmt, ...) \ argument
969 KUNIT_BINARY_INT_ASSERTION(test, \
986 #define KUNIT_EXPECT_PTR_EQ(test, left, right) \ argument
987 KUNIT_EXPECT_PTR_EQ_MSG(test, left, right, NULL)
989 #define KUNIT_EXPECT_PTR_EQ_MSG(test, left, right, fmt, ...) \ argument
990 KUNIT_BINARY_PTR_ASSERTION(test, \
1007 #define KUNIT_EXPECT_NE(test, left, right) \ argument
1008 KUNIT_EXPECT_NE_MSG(test, left, right, NULL)
1010 #define KUNIT_EXPECT_NE_MSG(test, left, right, fmt, ...) \ argument
1011 KUNIT_BINARY_INT_ASSERTION(test, \
1028 #define KUNIT_EXPECT_PTR_NE(test, left, right) \ argument
1029 KUNIT_EXPECT_PTR_NE_MSG(test, left, right, NULL)
1031 #define KUNIT_EXPECT_PTR_NE_MSG(test, left, right, fmt, ...) \ argument
1032 KUNIT_BINARY_PTR_ASSERTION(test, \
1049 #define KUNIT_EXPECT_LT(test, left, right) \ argument
1050 KUNIT_EXPECT_LT_MSG(test, left, right, NULL)
1052 #define KUNIT_EXPECT_LT_MSG(test, left, right, fmt, ...) \ argument
1053 KUNIT_BINARY_INT_ASSERTION(test, \
1070 #define KUNIT_EXPECT_LE(test, left, right) \ argument
1071 KUNIT_EXPECT_LE_MSG(test, left, right, NULL)
1073 #define KUNIT_EXPECT_LE_MSG(test, left, right, fmt, ...) \ argument
1074 KUNIT_BINARY_INT_ASSERTION(test, \
1091 #define KUNIT_EXPECT_GT(test, left, right) \ argument
1092 KUNIT_EXPECT_GT_MSG(test, left, right, NULL)
1094 #define KUNIT_EXPECT_GT_MSG(test, left, right, fmt, ...) \ argument
1095 KUNIT_BINARY_INT_ASSERTION(test, \
1112 #define KUNIT_EXPECT_GE(test, left, right) \ argument
1113 KUNIT_EXPECT_GE_MSG(test, left, right, NULL)
1115 #define KUNIT_EXPECT_GE_MSG(test, left, right, fmt, ...) \ argument
1116 KUNIT_BINARY_INT_ASSERTION(test, \
1133 #define KUNIT_EXPECT_STREQ(test, left, right) \ argument
1134 KUNIT_EXPECT_STREQ_MSG(test, left, right, NULL)
1136 #define KUNIT_EXPECT_STREQ_MSG(test, left, right, fmt, ...) \ argument
1137 KUNIT_BINARY_STR_ASSERTION(test, \
1154 #define KUNIT_EXPECT_STRNEQ(test, left, right) \ argument
1155 KUNIT_EXPECT_STRNEQ_MSG(test, left, right, NULL)
1157 #define KUNIT_EXPECT_STRNEQ_MSG(test, left, right, fmt, ...) \ argument
1158 KUNIT_BINARY_STR_ASSERTION(test, \
1180 #define KUNIT_EXPECT_MEMEQ(test, left, right, size) \ argument
1181 KUNIT_EXPECT_MEMEQ_MSG(test, left, right, size, NULL)
1183 #define KUNIT_EXPECT_MEMEQ_MSG(test, left, right, size, fmt, ...) \ argument
1184 KUNIT_MEM_ASSERTION(test, \
1207 #define KUNIT_EXPECT_MEMNEQ(test, left, right, size) \ argument
1208 KUNIT_EXPECT_MEMNEQ_MSG(test, left, right, size, NULL)
1210 #define KUNIT_EXPECT_MEMNEQ_MSG(test, left, right, size, fmt, ...) \ argument
1211 KUNIT_MEM_ASSERTION(test, \
1227 #define KUNIT_EXPECT_NULL(test, ptr) \ argument
1228 KUNIT_EXPECT_NULL_MSG(test, \
1232 #define KUNIT_EXPECT_NULL_MSG(test, ptr, fmt, ...) \ argument
1233 KUNIT_BINARY_PTR_ASSERTION(test, \
1248 #define KUNIT_EXPECT_NOT_NULL(test, ptr) \ argument
1249 KUNIT_EXPECT_NOT_NULL_MSG(test, \
1253 #define KUNIT_EXPECT_NOT_NULL_MSG(test, ptr, fmt, ...) \ argument
1254 KUNIT_BINARY_PTR_ASSERTION(test, \
1270 #define KUNIT_EXPECT_NOT_ERR_OR_NULL(test, ptr) \ argument
1271 KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(test, ptr, NULL)
1273 #define KUNIT_EXPECT_NOT_ERR_OR_NULL_MSG(test, ptr, fmt, ...) \ argument
1274 KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test, \
1291 #define KUNIT_FAIL_AND_ABORT(test, fmt, ...) \ argument
1292 KUNIT_FAIL_ASSERTION(test, KUNIT_ASSERTION, fmt, ##__VA_ARGS__)
1305 #define KUNIT_ASSERT_TRUE(test, condition) \ argument
1306 KUNIT_ASSERT_TRUE_MSG(test, condition, NULL)
1308 #define KUNIT_ASSERT_TRUE_MSG(test, condition, fmt, ...) \ argument
1309 KUNIT_TRUE_MSG_ASSERTION(test, \
1324 #define KUNIT_ASSERT_FALSE(test, condition) \ argument
1325 KUNIT_ASSERT_FALSE_MSG(test, condition, NULL)
1327 #define KUNIT_ASSERT_FALSE_MSG(test, condition, fmt, ...) \ argument
1328 KUNIT_FALSE_MSG_ASSERTION(test, \
1344 #define KUNIT_ASSERT_EQ(test, left, right) \ argument
1345 KUNIT_ASSERT_EQ_MSG(test, left, right, NULL)
1347 #define KUNIT_ASSERT_EQ_MSG(test, left, right, fmt, ...) \ argument
1348 KUNIT_BINARY_INT_ASSERTION(test, \
1364 #define KUNIT_ASSERT_PTR_EQ(test, left, right) \ argument
1365 KUNIT_ASSERT_PTR_EQ_MSG(test, left, right, NULL)
1367 #define KUNIT_ASSERT_PTR_EQ_MSG(test, left, right, fmt, ...) \ argument
1368 KUNIT_BINARY_PTR_ASSERTION(test, \
1384 #define KUNIT_ASSERT_NE(test, left, right) \ argument
1385 KUNIT_ASSERT_NE_MSG(test, left, right, NULL)
1387 #define KUNIT_ASSERT_NE_MSG(test, left, right, fmt, ...) \ argument
1388 KUNIT_BINARY_INT_ASSERTION(test, \
1405 #define KUNIT_ASSERT_PTR_NE(test, left, right) \ argument
1406 KUNIT_ASSERT_PTR_NE_MSG(test, left, right, NULL)
1408 #define KUNIT_ASSERT_PTR_NE_MSG(test, left, right, fmt, ...) \ argument
1409 KUNIT_BINARY_PTR_ASSERTION(test, \
1425 #define KUNIT_ASSERT_LT(test, left, right) \ argument
1426 KUNIT_ASSERT_LT_MSG(test, left, right, NULL)
1428 #define KUNIT_ASSERT_LT_MSG(test, left, right, fmt, ...) \ argument
1429 KUNIT_BINARY_INT_ASSERTION(test, \
1445 #define KUNIT_ASSERT_LE(test, left, right) \ argument
1446 KUNIT_ASSERT_LE_MSG(test, left, right, NULL)
1448 #define KUNIT_ASSERT_LE_MSG(test, left, right, fmt, ...) \ argument
1449 KUNIT_BINARY_INT_ASSERTION(test, \
1466 #define KUNIT_ASSERT_GT(test, left, right) \ argument
1467 KUNIT_ASSERT_GT_MSG(test, left, right, NULL)
1469 #define KUNIT_ASSERT_GT_MSG(test, left, right, fmt, ...) \ argument
1470 KUNIT_BINARY_INT_ASSERTION(test, \
1487 #define KUNIT_ASSERT_GE(test, left, right) \ argument
1488 KUNIT_ASSERT_GE_MSG(test, left, right, NULL)
1490 #define KUNIT_ASSERT_GE_MSG(test, left, right, fmt, ...) \ argument
1491 KUNIT_BINARY_INT_ASSERTION(test, \
1507 #define KUNIT_ASSERT_STREQ(test, left, right) \ argument
1508 KUNIT_ASSERT_STREQ_MSG(test, left, right, NULL)
1510 #define KUNIT_ASSERT_STREQ_MSG(test, left, right, fmt, ...) \ argument
1511 KUNIT_BINARY_STR_ASSERTION(test, \
1528 #define KUNIT_ASSERT_STRNEQ(test, left, right) \ argument
1529 KUNIT_ASSERT_STRNEQ_MSG(test, left, right, NULL)
1531 #define KUNIT_ASSERT_STRNEQ_MSG(test, left, right, fmt, ...) \ argument
1532 KUNIT_BINARY_STR_ASSERTION(test, \
1554 #define KUNIT_ASSERT_MEMEQ(test, left, right, size) \ argument
1555 KUNIT_ASSERT_MEMEQ_MSG(test, left, right, size, NULL)
1557 #define KUNIT_ASSERT_MEMEQ_MSG(test, left, right, size, fmt, ...) \ argument
1558 KUNIT_MEM_ASSERTION(test, \
1581 #define KUNIT_ASSERT_MEMNEQ(test, left, right, size) \ argument
1582 KUNIT_ASSERT_MEMNEQ_MSG(test, left, right, size, NULL)
1584 #define KUNIT_ASSERT_MEMNEQ_MSG(test, left, right, size, fmt, ...) \ argument
1585 KUNIT_MEM_ASSERTION(test, \
1601 #define KUNIT_ASSERT_NULL(test, ptr) \ argument
1602 KUNIT_ASSERT_NULL_MSG(test, \
1606 #define KUNIT_ASSERT_NULL_MSG(test, ptr, fmt, ...) \ argument
1607 KUNIT_BINARY_PTR_ASSERTION(test, \
1622 #define KUNIT_ASSERT_NOT_NULL(test, ptr) \ argument
1623 KUNIT_ASSERT_NOT_NULL_MSG(test, \
1627 #define KUNIT_ASSERT_NOT_NULL_MSG(test, ptr, fmt, ...) \ argument
1628 KUNIT_BINARY_PTR_ASSERTION(test, \
1644 #define KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr) \ argument
1645 KUNIT_ASSERT_NOT_ERR_OR_NULL_MSG(test, ptr, NULL)
1647 #define KUNIT_ASSERT_NOT_ERR_OR_NULL_MSG(test, ptr, fmt, ...) \ argument
1648 KUNIT_PTR_NOT_ERR_OR_NULL_MSG_ASSERTION(test, \