Lines Matching full:test
3 * Base unit test (KUnit) API.
26 * struct kunit_resource - represents a *test managed resource*
32 * Represents a *test managed resource*, a resource which will automatically be
33 * cleaned up at the end of a test case.
66 * void *kunit_kmalloc(struct kunit *test, size_t size, gfp_t gfp)
73 * return kunit_alloc_resource(test, kunit_kmalloc_init,
80 * unique within the test instance.
94 /* Size of log associated with test. */
112 * enum kunit_status - Type of result for a test or test suite
113 * @KUNIT_SUCCESS: Denotes the test suite has not failed nor been skipped
114 * @KUNIT_FAILURE: Denotes the test has failed.
115 * @KUNIT_SKIPPED: Denotes the test has been skipped.
124 * struct kunit_case - represents an individual test case.
126 * @run_case: the function representing the actual test case.
127 * @name: the name of the test case.
130 * A test case is a function with the signature,
133 * KUNIT_ASSERT_TRUE()) about code under test. Each test case is associated
137 * A test case should be static and should only be created with the
138 * KUNIT_CASE() macro; additionally, every array of test cases should be
139 * terminated with an empty test case.
145 * void add_test_basic(struct kunit *test)
147 * KUNIT_EXPECT_EQ(test, 1, add(1, 0));
148 * KUNIT_EXPECT_EQ(test, 2, add(1, 1));
149 * KUNIT_EXPECT_EQ(test, 0, add(-1, 1));
150 * KUNIT_EXPECT_EQ(test, INT_MAX, add(0, INT_MAX));
151 * KUNIT_EXPECT_EQ(test, -1, add(INT_MAX, INT_MIN));
161 void (*run_case)(struct kunit *test);
185 * @test_name: a reference to a test case function.
187 * Takes a symbol for a function representing a test case and creates a
196 * @test_name: a reference to a test case function.
217 * @name: the name of the test. Purely informational.
218 * @init: called before every test case.
219 * @exit: called after every test case.
220 * @test_cases: a null terminated array of test cases.
223 * @init is called before every test case and @exit is called after every
224 * test case, similar to the notion of a *test fixture* or a *test class*
232 int (*init)(struct kunit *test);
233 void (*exit)(struct kunit *test);
243 * struct kunit - represents a running instance of a test.
248 * Used to store information about the current context under which the test
251 * used by the test writer to store arbitrary data.
260 /* param_value is the current parameter value for a test case. */
266 * test case; thus, it is safe to update this across multiple
268 * be read after the test case finishes once all threads associated
269 * with the test case have terminated.
271 spinlock_t lock; /* Guards all mutable test state. */
275 * new resources) from any thread associated with a test case, we must
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);
317 * Registers @__suites with the test framework. See &struct kunit_suite for
320 * If a test suite is built-in, module_init() gets translated into
354 * Registers @suites with the test framework. See &struct kunit_suite for
382 struct kunit_resource *kunit_alloc_and_get_resource(struct kunit *test,
433 * kunit_add_resource() - Add a *test managed resource*.
434 * @test: The test context object.
442 int kunit_add_resource(struct kunit *test,
449 * kunit_add_named_resource() - Add a named *test managed resource*.
450 * @test: The test context object.
457 int kunit_add_named_resource(struct kunit *test,
465 * kunit_alloc_resource() - Allocates a *test managed resource*.
466 * @test: The test context object.
472 * Allocates a *test managed resource*, a resource which will automatically be
473 * cleaned up at the end of a test case. See &struct kunit_resource for an
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,
504 * @test: Test case to which the resource belongs.
511 static inline bool kunit_resource_instance_match(struct kunit *test, in kunit_resource_instance_match() argument
520 * @test: Test case to which the resource belongs.
524 static inline bool kunit_resource_name_match(struct kunit *test, in kunit_resource_name_match() argument
533 * @test: Test case to which the resource belongs.
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()
562 * @test: Test case to which the resource belongs.
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()
575 * @test: Test case to which the resource belongs.
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()
595 * test.
596 * @test: The test context object.
603 void kunit_remove_resource(struct kunit *test, struct kunit_resource *res);
606 * kunit_kmalloc_array() - Like kmalloc_array() except the allocation is *test managed*.
607 * @test: The test context object.
612 * Just like `kmalloc_array(...)`, except the allocation is managed by the test case
613 * and is automatically cleaned up after the test case concludes. See &struct
616 void *kunit_kmalloc_array(struct kunit *test, size_t n, size_t size, gfp_t gfp);
619 * kunit_kmalloc() - Like kmalloc() except the allocation is *test managed*.
620 * @test: The test context object.
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()
633 * @test: The test case to which the resource belongs.
636 void kunit_kfree(struct kunit *test, const void *ptr);
640 * @test: The test context object.
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()
653 * @test: The test context object.
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);
672 * @test_or_suite: The test context object.
675 * Marks the test as skipped. @fmt is given output as the test status
676 * comment, typically the reason the test was skipped.
678 * Test execution continues after kunit_mark_skipped() is called.
691 * @test_or_suite: The test context object.
694 * Skips the test. @fmt is given output as the test status
695 * comment, typically the reason the test was skipped.
697 * Test execution is halted after kunit_skip() is called.
706 * printk and log to per-test or per-suite log buffer. Logging only done
716 #define kunit_printk(lvl, test, fmt, ...) \ argument
717 kunit_log(lvl, test, KUNIT_SUBTEST_INDENT "# %s: " fmt, \
718 (test)->name, ##__VA_ARGS__)
721 * kunit_info() - Prints an INFO level message associated with @test.
723 * @test: The test context object.
726 * Prints an info level message associated with the test suite being run.
729 #define kunit_info(test, fmt, ...) \ argument
730 kunit_printk(KERN_INFO, test, fmt, ##__VA_ARGS__)
733 * kunit_warn() - Prints a WARN level message associated with @test.
735 * @test: The test context object.
740 #define kunit_warn(test, fmt, ...) \ argument
741 kunit_printk(KERN_WARNING, test, fmt, ##__VA_ARGS__)
744 * kunit_err() - Prints an ERROR level message associated with @test.
746 * @test: The test context object.
751 #define kunit_err(test, fmt, ...) \ argument
752 kunit_printk(KERN_ERR, test, fmt, ##__VA_ARGS__)
756 * @test: The test context object.
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), \
788 * KUNIT_FAIL() - Always causes a test to fail when evaluated.
789 * @test: The test context object.
795 * always causes the test case to fail when evaluated. See KUNIT_EXPECT_TRUE()
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, \
1302 * KUNIT_EXPECT_TRUE() - Causes a test failure when the expression is not true.
1303 * @test: The test context object.
1304 * @condition: an arbitrary boolean expression. The test fails when this does
1307 * This and expectations of the form `KUNIT_EXPECT_*` will cause the test case
1309 * the test case from continuing to run; this is otherwise known as an
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, \
1323 * KUNIT_EXPECT_FALSE() - Makes a test failure when the expression is not false.
1324 * @test: The test context object.
1325 * @condition: an arbitrary boolean expression. The test fails when this does
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, \
1343 * @test: The test context object.
1349 * KUNIT_EXPECT_TRUE(@test, (@left) == (@right)). See KUNIT_EXPECT_TRUE() for
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, \
1365 * @test: The test context object.
1371 * KUNIT_EXPECT_TRUE(@test, (@left) == (@right)). See KUNIT_EXPECT_TRUE() for
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, \
1390 * @test: The test context object.
1396 * KUNIT_EXPECT_TRUE(@test, (@left) != (@right)). See KUNIT_EXPECT_TRUE() for
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, \
1412 * @test: The test context object.
1418 * KUNIT_EXPECT_TRUE(@test, (@left) != (@right)). See KUNIT_EXPECT_TRUE() for
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, \
1437 * @test: The test context object.
1443 * KUNIT_EXPECT_TRUE(@test, (@left) < (@right)). See KUNIT_EXPECT_TRUE() for
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, \
1459 * @test: The test context object.
1465 * to KUNIT_EXPECT_TRUE(@test, (@left) <= (@right)). See KUNIT_EXPECT_TRUE() for
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, \
1481 * @test: The test context object.
1487 * KUNIT_EXPECT_TRUE(@test, (@left) > (@right)). See KUNIT_EXPECT_TRUE() for
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, \
1503 * @test: The test context object.
1509 * KUNIT_EXPECT_TRUE(@test, (@left) >= (@right)). See KUNIT_EXPECT_TRUE() for
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, \
1525 * @test: The test context object.
1531 * KUNIT_EXPECT_TRUE(@test, !strcmp((@left), (@right))). See KUNIT_EXPECT_TRUE()
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, \
1547 * @test: The test context object.
1553 * KUNIT_EXPECT_TRUE(@test, strcmp((@left), (@right))). See KUNIT_EXPECT_TRUE()
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, \
1569 * @test: The test context object.
1574 * KUNIT_EXPECT_TRUE(@test, !IS_ERR_OR_NULL(@ptr)). See KUNIT_EXPECT_TRUE() for
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__)
1592 * @test: The test context object.
1593 * @condition: an arbitrary boolean expression. The test fails and aborts when
1596 * This and assertions of the form `KUNIT_ASSERT_*` will cause the test case to
1598 * an expectation failure, it will prevent the test case from continuing to run;
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, \
1613 * @test: The test context object.
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, \
1632 * @test: The test context object.
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, \
1653 * @test: The test context object.
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, \
1674 * @test: The test context object.
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, \
1696 * @test: The test context object.
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, \
1716 * @test: The test context object.
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, \
1737 * @test: The test context object.
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, \
1759 * @test: The test context object.
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, \
1781 * @test: The test context object.
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, \
1803 * @test: The test context object.
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, \
1824 * @test: The test context object.
1830 * KUNIT_ASSERT_TRUE(@test, strcmp((@left), (@right))). See KUNIT_ASSERT_TRUE()
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, \
1846 * @test: The test context object.
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, \
1865 * KUNIT_ARRAY_PARAM() - Define test parameter generator from an array.
1866 * @name: prefix for the test parameter generator function.
1867 * @array: array of test parameters.