Hi Luis, On Mon, Oct 21, 2024 at 12:33 PM Luis Chamberlain <mcgrof@xxxxxxxxxx> wrote: > > diff --git a/lib/tests/module/gen_test_kallsyms.sh b/lib/tests/module/gen_test_kallsyms.sh > new file mode 100755 > index 000000000000..e85f10dc11bd > --- /dev/null > +++ b/lib/tests/module/gen_test_kallsyms.sh > @@ -0,0 +1,128 @@ [..] > +gen_template_module_data_b() > +{ > + printf "\nextern int auto_test_a_%010d;\n\n" 28 > + echo "static int auto_runtime_test(void)" > + echo "{" > + printf "\nreturn auto_test_a_%010d;\n" 28 > + echo "}" > +} FYI, I get a warning when loading test_kallsyms_b because the init function return value is >0: # modprobe test_kallsyms_b [ 11.154496] do_init_module: 'test_kallsyms_b'->init suspiciously returned 255, it should follow 0/-E convention [ 11.154496] do_init_module: loading module anyway... [ 11.156156] CPU: 3 UID: 0 PID: 116 Comm: modprobe Not tainted 6.12.0-rc5-00020-g897cb2ff413d #1 [ 11.156832] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014 [ 11.157762] Call Trace: [ 11.158914] <TASK> [ 11.159253] dump_stack_lvl+0x3f/0xb0 [ 11.160279] do_init_module+0x1f4/0x200 [ 11.160586] __se_sys_finit_module+0x30c/0x400 [ 11.160948] do_syscall_64+0xd0/0x1a0 [ 11.161255] ? arch_exit_to_user_mode_prepare+0x11/0x60 [ 11.161659] ? irqentry_exit_to_user_mode+0x8e/0xb0 [ 11.162052] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 11.162598] RIP: 0033:0x7f5843968cf6 [ 11.163076] Code: 48 89 57 30 48 8b 04 24 48 89 47 38 e9 1e 9a 02 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 3a fd ff ff c3 48 c7 c6 01 00 00 00 e9 a1 [ 11.164465] RSP: 002b:00007ffefcc92d68 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 11.165046] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f5843968cf6 [ 11.165656] RDX: 0000000000000000 RSI: 00000000320429e0 RDI: 0000000000000003 [ 11.166220] RBP: 00000000320429e0 R08: 0000000000000074 R09: 0000000000000000 [ 11.166804] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000032042b50 [ 11.167378] R13: 0000000000000001 R14: 0000000032042c10 R15: 0000000000000000 [ 11.168007] </TASK> > diff --git a/tools/testing/selftests/module/find_symbol.sh b/tools/testing/selftests/module/find_symbol.sh > new file mode 100755 > index 000000000000..140364d3c49f > --- /dev/null > +++ b/tools/testing/selftests/module/find_symbol.sh > @@ -0,0 +1,81 @@ [..] > +test_reqs() > +{ > + if ! which modprobe 2> /dev/null > /dev/null; then > + echo "$0: You need modprobe installed" >&2 > + exit $ksft_skip > + fi > + > + if ! which kmod 2> /dev/null > /dev/null; then > + echo "$0: You need kmod installed" >&2 > + exit $ksft_skip > + fi Is there a reason to test for kmod? I don't see it called directly in this script. Also, shouldn't you add the module directory to TARGETS in tools/testing/selftests/Makefile? Otherwise the script won't be installed with the rest of kselftests. Sami