blob: d056baa8fbb0cf9588722dfdf662858493383411 [file] [log] [blame]
Ilya Leoshkevich90c53182022-01-19 19:26:38 +01001// 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#define DECLARE_RETURN(i) int test_modules_return_ ## i(void)
9REPEAT_10000(DECLARE_RETURN);
10
11/*
12 * Test that modules with many relocations are loaded properly.
13 */
14static void test_modules_many_vmlinux_relocs(struct kunit *test)
15{
16 int result = 0;
17
18#define CALL_RETURN(i) result += test_modules_return_ ## i()
19 REPEAT_10000(CALL_RETURN);
20 KUNIT_ASSERT_EQ(test, result, 49995000);
21}
22
23static struct kunit_case modules_testcases[] = {
24 KUNIT_CASE(test_modules_many_vmlinux_relocs),
25 {}
26};
27
28static struct kunit_suite modules_test_suite = {
29 .name = "modules_test_s390",
30 .test_cases = modules_testcases,
31};
32
33kunit_test_suites(&modules_test_suite);
34
35MODULE_LICENSE("GPL");