kunit: transition: add macro for defining struct kunit_case/test_case

Change-Id: I0bed03ff0934fb4402ee4cd81f5c75c13f0042ef
diff --git a/include/test/test-names.h b/include/test/test-names.h
index 821ed6e..9711ed2 100644
--- a/include/test/test-names.h
+++ b/include/test/test-names.h
@@ -4,10 +4,12 @@
 
 #define KUNIT_T kunit
 #define KUNIT_RESOURCE_T kunit_resource
+#define KUNIT_CASE_T kunit_case
 
 #else
 
 #define KUNIT_T test
 #define KUNIT_RESOURCE_T test_resource
+#define KUNIT_CASE_T test_case
 
 #endif
diff --git a/include/test/test.h b/include/test/test.h
index 2011a62..0fa45ed 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -78,7 +78,7 @@
 struct KUNIT_T;
 
 /**
- * struct test_case - represents an individual test case.
+ * struct KUNIT_CASE_T - represents an individual test case.
  * @run_case: the function representing the actual test case.
  * @name: the name of the test case.
  *
@@ -105,13 +105,13 @@
  *		EXPECT_EQ(test, -1, add(INT_MAX, INT_MIN));
  *	}
  *
- *	static struct test_case example_test_cases[] = {
+ *	static struct KUNIT_CASE_T example_test_cases[] = {
  *		TEST_CASE(add_test_basic),
  *		{},
  *	};
  *
  */
-struct test_case {
+struct KUNIT_CASE_T {
 	void (*run_case)(struct KUNIT_T *test);
 	const char name[256];
 	/* private: internal use only. */
@@ -119,35 +119,35 @@
 };
 
 /**
- * TEST_CASE - A helper for creating a &struct test_case
+ * TEST_CASE - A helper for creating a &struct KUNIT_CASE_T
  * @test_name: a reference to a test case function.
  *
  * Takes a symbol for a function representing a test case and creates a &struct
- * test_case object from it. See the documentation for &struct test_case for an
+ * test_case object from it. See the documentation for &struct KUNIT_CASE_T for an
  * example on how to use it.
  */
 #define TEST_CASE(test_name) { .run_case = test_name, .name = #test_name }
 
 /**
- * struct test_module - describes a related collection of &struct test_case s.
+ * struct test_module - describes a related collection of &struct KUNIT_CASE_T s.
  * @name: the name of the test. Purely informational.
  * @init: called before every test case.
  * @exit: called after every test case.
  * @test_cases: a null terminated array of test cases.
  *
- * A test_module is a collection of related &struct test_case s, such that
+ * A test_module is a collection of related &struct KUNIT_CASE_T s, such that
  * @init is called before every test case and @exit is called after every test
  * case, similar to the notion of a *test fixture* or a *test class* in other
  * unit testing frameworks like JUnit or Googletest.
  *
- * Every &struct test_case must be associated with a test_module for KUnit to
+ * Every &struct KUNIT_CASE_T must be associated with a test_module for KUnit to
  * run it.
  */
 struct test_module {
 	const char name[256];
 	int (*init)(struct KUNIT_T *test);
 	void (*exit)(struct KUNIT_T *test);
-	struct test_case *test_cases;
+	struct KUNIT_CASE_T *test_cases;
 };
 
 struct test_initcall {
diff --git a/test/example-test.c b/test/example-test.c
index 6418c5c..d61daf7 100644
--- a/test/example-test.c
+++ b/test/example-test.c
@@ -62,7 +62,7 @@
 	return 0;
 }
 
-static struct test_case example_test_cases[] = {
+static struct KUNIT_CASE_T example_test_cases[] = {
 	KUNIT_CASE(example_simple_test),
 	KUNIT_CASE(example_mock_test),
 	{},
diff --git a/test/mock-macro-test.c b/test/mock-macro-test.c
index df7d209..32f2b3c 100644
--- a/test/mock-macro-test.c
+++ b/test/mock-macro-test.c
@@ -240,7 +240,7 @@
 	return 0;
 }
 
-static struct test_case mock_macro_test_cases[] = {
+static struct KUNIT_CASE_T mock_macro_test_cases[] = {
 	TEST_CASE(mock_macro_is_equal),
 	TEST_CASE(mock_macro_if),
 	TEST_CASE(mock_macro_apply_tokens),
diff --git a/test/mock-test.c b/test/mock-test.c
index b2777ca..e67a1bd1 100644
--- a/test/mock-test.c
+++ b/test/mock-test.c
@@ -1070,7 +1070,7 @@
 	EXPECT_EQ(test, 1, expectation->times_called);
 }
 
-static struct test_case mock_test_cases[] = {
+static struct KUNIT_CASE_T mock_test_cases[] = {
 	TEST_CASE(mock_test_do_expect_basic),
 	TEST_CASE(mock_test_ptr_eq),
 	TEST_CASE(mock_test_ptr_eq_not_equal),
diff --git a/test/strerror-test.c b/test/strerror-test.c
index a29aae1..09e2fbc 100644
--- a/test/strerror-test.c
+++ b/test/strerror-test.c
@@ -63,7 +63,7 @@
 	EXPECT_NOT_NULL(test, strerror_r(MAX_ERRNO + 1, buf, sizeof(buf)));
 }
 
-static struct test_case strerror_test_cases[] = {
+static struct KUNIT_CASE_T strerror_test_cases[] = {
 	TEST_CASE(test_strerror_returns_null_for_unknown_errors),
 	TEST_CASE(test_strerror_r_returns_null_if_buflen_is_zero),
 	TEST_CASE(test_strerror_returns_string),
diff --git a/test/string-stream-test.c b/test/string-stream-test.c
index c979012..0a97050 100644
--- a/test/string-stream-test.c
+++ b/test/string-stream-test.c
@@ -47,7 +47,7 @@
 	destroy_string_stream(stream);
 }
 
-static struct test_case string_stream_test_cases[] = {
+static struct KUNIT_CASE_T string_stream_test_cases[] = {
 	TEST_CASE(string_stream_test_get_string),
 	TEST_CASE(string_stream_test_add_and_clear),
 	{}
diff --git a/test/test-death-test.c b/test/test-death-test.c
index be49460..806effe 100644
--- a/test/test-death-test.c
+++ b/test/test-death-test.c
@@ -14,7 +14,7 @@
 	ASSERT_SIGSEGV(test, invalid_func());
 }
 
-static struct test_case test_death_test_cases[] = {
+static struct KUNIT_CASE_T test_death_test_cases[] = {
 	TEST_CASE(test_death_test_catches_segfault),
 	{},
 };
diff --git a/test/test-stream-test.c b/test/test-stream-test.c
index 089ff54..c1c7e96 100644
--- a/test/test-stream-test.c
+++ b/test/test-stream-test.c
@@ -154,7 +154,7 @@
 	mock_unregister_formatter(mock_find_formatter("struct va_format *"));
 }
 
-static struct test_case test_stream_test_cases[] = {
+static struct KUNIT_CASE_T test_stream_test_cases[] = {
 	TEST_CASE(test_stream_test_add),
 	TEST_CASE(test_stream_test_append),
 	TEST_CASE(test_stream_test_commits_any_uncommitted_when_cleanup),
diff --git a/test/test-test.c b/test/test-test.c
index 2c9d72d..9b00bee 100644
--- a/test/test-test.c
+++ b/test/test-test.c
@@ -114,7 +114,7 @@
 	kfree(ctx);
 }
 
-static struct test_case test_test_cases[] = {
+static struct KUNIT_CASE_T test_test_cases[] = {
 	TEST_CASE(test_test_init_resources),
 	TEST_CASE(test_test_alloc_resource),
 	TEST_CASE(test_test_free_resource),
diff --git a/test/test.c b/test/test.c
index d9bbbae..d0cad80 100644
--- a/test/test.c
+++ b/test/test.c
@@ -139,7 +139,7 @@
  */
 static void test_run_case_internal(struct KUNIT_T *test,
 				   struct test_module *module,
-				   struct test_case *test_case)
+				   struct KUNIT_CASE_T *test_case)
 {
 	struct test_initcall *initcall;
 	int ret;
@@ -170,7 +170,7 @@
  */
 static void test_handle_test_crash(struct KUNIT_T *test,
 				   struct test_module *module,
-				   struct test_case *test_case)
+				   struct KUNIT_CASE_T *test_case)
 {
 	test_err(test, "%s crashed", test_case->name);
 	/*
@@ -185,7 +185,7 @@
 struct test_try_catch_context {
 	struct KUNIT_T *test;
 	struct test_module *module;
-	struct test_case *test_case;
+	struct KUNIT_CASE_T *test_case;
 };
 
 
@@ -195,7 +195,7 @@
  */
 static void test_run_case_cleanup(struct KUNIT_T *test,
 				  struct test_module *module,
-				  struct test_case *test_case)
+				  struct KUNIT_CASE_T *test_case)
 {
 	struct test_post_condition *condition, *condition_safe;
 
@@ -218,7 +218,7 @@
 	struct test_try_catch_context *ctx = data;
 	struct KUNIT_T *test = ctx->test;
 	struct test_module *module = ctx->module;
-	struct test_case *test_case = ctx->test_case;
+	struct KUNIT_CASE_T *test_case = ctx->test_case;
 
 	/*
 	 * test_run_case_internal may encounter a fatal error; if it does,
@@ -235,7 +235,7 @@
 	struct test_try_catch_context *ctx = data;
 	struct KUNIT_T *test = ctx->test;
 	struct test_module *module = ctx->module;
-	struct test_case *test_case = ctx->test_case;
+	struct KUNIT_CASE_T *test_case = ctx->test_case;
 	int try_exit_code = test_try_catch_get_result(&test->try_catch);
 
 	if (try_exit_code) {
@@ -280,7 +280,7 @@
  */
 static bool test_run_case_catch_errors(struct KUNIT_T *test,
 				       struct test_module *module,
-				       struct test_case *test_case)
+				       struct KUNIT_CASE_T *test_case)
 {
 	struct test_try_catch *try_catch = &test->try_catch;
 	struct test_try_catch_context context;
@@ -303,7 +303,7 @@
 int test_run_tests(struct test_module *module)
 {
 	bool all_passed = true, success;
-	struct test_case *test_case;
+	struct KUNIT_CASE_T *test_case;
 	struct KUNIT_T test;
 	int ret;