8 TEST_TYPE=$(echo $TARGET | sed -e 's|lib/tests/module/test_kallsyms_||g')
9 TEST_TYPE=$(echo $TEST_TYPE | sed -e 's|.c||g')
12 if [[ $NUM_SYMS -gt 2 ]]; then
13 FIRST_B_LOOKUP=$((NUM_SYMS/2))
16 gen_template_module_header()
19 // SPDX-License-Identifier: GPL-2.0-or-later OR copyleft-next-0.3.1
23 * Automatically generated code for testing, do not edit manually.
26 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
28 #include <linux/init.h>
29 #include <linux/module.h>
30 #include <linux/printk.h>
39 for i in $(seq 1 $NUM); do
40 printf "int auto_test_%s_%010d = 0;\n" $PREFIX $i
41 printf "EXPORT_SYMBOL_GPL(auto_test_%s_%010d);\n" $PREFIX $i
46 gen_template_module_data_a()
50 static int auto_runtime_test(void)
58 gen_template_module_data_b()
60 printf "\nextern int auto_test_a_%010d;\n\n" $FIRST_B_LOOKUP
61 echo "static int auto_runtime_test(void)"
63 printf "\nreturn auto_test_a_%010d;\n" $FIRST_B_LOOKUP
67 gen_template_module_data_c()
71 static int auto_runtime_test(void)
79 gen_template_module_data_d()
83 static int auto_runtime_test(void)
91 gen_template_module_exit()
94 static int __init auto_test_module_init(void)
96 return auto_runtime_test();
98 module_init(auto_test_module_init);
100 static void __exit auto_test_module_exit(void)
103 module_exit(auto_test_module_exit);
106 MODULE_LICENSE("GPL");
107 MODULE_DESCRIPTION("Test module for kallsyms");
113 gen_template_module_header > $TARGET
114 gen_template_module_data_a $NUM_SYMS >> $TARGET
115 gen_template_module_exit >> $TARGET
118 gen_template_module_header > $TARGET
119 gen_template_module_data_b >> $TARGET
120 gen_template_module_exit >> $TARGET
123 gen_template_module_header > $TARGET
124 gen_template_module_data_c $((NUM_SYMS * SCALE_FACTOR)) >> $TARGET
125 gen_template_module_exit >> $TARGET
128 gen_template_module_header > $TARGET
129 gen_template_module_data_d $((NUM_SYMS * SCALE_FACTOR * 2)) >> $TARGET
130 gen_template_module_exit >> $TARGET