blob: b3119e2f5db9d7a97e5b70c9d3917d2416748fed [file] [log] [blame]
// TRANSITIONAL ONLY.
// Provide some macros to make it easier to transition some code relying on the
// older non-upstream kunit version.
#include <test/test.h>
#define KUNIT_SUCCEED SUCCEED
#define KUNIT_FAIL FAIL
#define KUNIT_EXPECT EXPECT
#define KUNIT_EXPECT_TRUE EXPECT_TRUE
#define KUNIT_EXPECT_FALSE EXPECT_FALSE
#define KUNIT_EXPECT_NOT_NULL EXPECT_NOT_NULL
#define KUNIT_EXPECT_NULL EXPECT_NULL
#define KUNIT_EXPECT_SUCCESS EXPECT_SUCCESS
#define KUNIT_EXPECT_ERROR EXPECT_ERROR
#define KUNIT_EXPECT_BINARY EXPECT_BINARY
#define KUNIT_EXPECT_EQ EXPECT_EQ
#define KUNIT_EXPECT_NE EXPECT_NE
#define KUNIT_EXPECT_LT EXPECT_LT
#define KUNIT_EXPECT_LE EXPECT_LE
#define KUNIT_EXPECT_GT EXPECT_GT
#define KUNIT_EXPECT_GE EXPECT_GE
#define KUNIT_EXPECT_STREQ EXPECT_STREQ
#define KUNIT_EXPECT_NOT_ERR_OR_NULL EXPECT_NOT_ERR_OR_NULL
#define KUNIT_ASSERT ASSERT
#define KUNIT_ASSERT_TRUE ASSERT_TRUE
#define KUNIT_ASSERT_FALSE ASSERT_FALSE
#define KUNIT_ASSERT_NOT_NULL ASSERT_NOT_NULL
#define KUNIT_ASSERT_NULL ASSERT_NULL
#define KUNIT_ASSERT_SUCCESS ASSERT_SUCCESS
#define KUNIT_ASSERT_ERROR ASSERT_ERROR
#define KUNIT_ASSERT_BINARY ASSERT_BINARY
#define KUNIT_ASSERT_EQ ASSERT_EQ
#define KUNIT_ASSERT_NE ASSERT_NE
#define KUNIT_ASSERT_LT ASSERT_LT
#define KUNIT_ASSERT_LE ASSERT_LE
#define KUNIT_ASSERT_GT ASSERT_GT
#define KUNIT_ASSERT_GE ASSERT_GE
#define KUNIT_ASSERT_STREQ ASSERT_STREQ
#define KUNIT_ASSERT_NOT_ERR_OR_NULL ASSERT_NOT_ERR_OR_NULL
#define KUNIT_ASSERT_SIGSEGV ASSERT_SIGSEGV
#define KUNIT_CASE TEST_CASE
#define kunit_test_suite module_test
// NOTE: in upstream, this can handle multiple suites. We can't here.
#define ___concat(a,b) a##b
#define __concat(a,b) ___concat(a,b)
#define kunit_test_suites(suite_ptr) \
static struct KUNIT_SUITE_T *__concat(__test_module_,__COUNTER__) __used \
__aligned(8) __attribute__((__section__(".test_modules"))) = \
suite_ptr
#define kunit_info test_info
#define kunit_warn test_warn
#define kunit_err test_err
#define kunit_printk test_printk
// Note: the following functions don't quite have a 1:1 equivalent.
// * test_alloc_resource
// * test_free_resource
#define kunit_kmalloc test_kmalloc
#define kunit_kzalloc test_kzalloc
#define kunit_cleanup test_cleanup
#define kunit_kfree(test, ptr) kfree(ptr)