xref: /openbmc/linux/arch/s390/lib/test_modules.c (revision 7a2f6f61)
1 // SPDX-License-Identifier: GPL-2.0+
2 
3 #include <kunit/test.h>
4 #include <linux/module.h>
5 
6 #include "test_modules.h"
7 
8 /*
9  * Test that modules with many relocations are loaded properly.
10  */
11 static void test_modules_many_vmlinux_relocs(struct kunit *test)
12 {
13 	int result = 0;
14 
15 #define CALL_RETURN(i) result += test_modules_return_ ## i()
16 	REPEAT_10000(CALL_RETURN);
17 	KUNIT_ASSERT_EQ(test, result, 49995000);
18 }
19 
20 static struct kunit_case modules_testcases[] = {
21 	KUNIT_CASE(test_modules_many_vmlinux_relocs),
22 	{}
23 };
24 
25 static struct kunit_suite modules_test_suite = {
26 	.name = "modules_test_s390",
27 	.test_cases = modules_testcases,
28 };
29 
30 kunit_test_suites(&modules_test_suite);
31 
32 MODULE_LICENSE("GPL");
33