Skip to content

Commit

Permalink
testsuite/test-modprobe: Test --show-modversions
Browse files Browse the repository at this point in the history
We can't test actual CRC values, because they may vary depending on
kernel configuration. We can ensure the correct symbol names show up
though.

Signed-off-by: Matthew Maurer <[email protected]>
  • Loading branch information
maurer committed Dec 20, 2024
1 parent cb21bc6 commit e44ea22
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/setup-rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ map=(
["test-modprobe/external/lib/modules/external/"]="mod-simple.ko"
["test-modprobe/module-from-abspath/home/foo/"]="mod-simple.ko"
["test-modprobe/module-from-relpath/home/foo/"]="mod-simple.ko"
["test-modprobe/show-modversions/mod-simple.ko"]="mod-simple.ko"
["test-depmod/modules-order-compressed$MODULE_DIRECTORY/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko"
["test-depmod/modules-order-compressed$MODULE_DIRECTORY/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko"
["test-depmod/modules-order-compressed$MODULE_DIRECTORY/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
0x........ single_open
0x........ seq_write
0x........ debugfs_remove
0x........ seq_lseek
0x........ seq_read
0x........ single_release
0x........ __fentry__
0x........ debugfs_create_dir
0x........ debugfs_create_file
0x........ __x86_return_thunk
0x........ module_layout
16 changes: 16 additions & 0 deletions testsuite/test-modprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,20 @@ DEFINE_TEST(modprobe_module_from_relpath,
.modules_loaded = "mod-simple",
);

static noreturn int modprobe_show_modversions(const struct test *t)
{
EXEC_MODPROBE("--show-modversions", "/mod-simple.ko");
exit(EXIT_FAILURE);
}
DEFINE_TEST(modprobe_show_modversions,
.description = "check if output for modprobe --show-modversions is correct",
.config = {
[TC_UNAME_R] = "4.4.4",
[TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/show-modversions",
},
.output = {
.out = TESTSUITE_ROOTFS "test-modprobe/show-modversions/versions-mod-simple.txt",
.regex = true,
});

TESTSUITE_MAIN();

0 comments on commit e44ea22

Please sign in to comment.