Skip to content

Commit

Permalink
testsuite: add unit test module replacement
Browse files Browse the repository at this point in the history
This test takes again the module set from "big-01" and replaces
two modules such that a symbol version changes. "depmod -I -a"
is expected to pick up this change.

Signed-off-by: Martin Wilck <[email protected]>
  • Loading branch information
mwilck committed Nov 18, 2024
1 parent 420995a commit 4ab8a53
Show file tree
Hide file tree
Showing 27 changed files with 105 additions and 116 deletions.
23 changes: 23 additions & 0 deletions scripts/setup-rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,29 @@ map=(
["test-depmod/big-01-delete/lib/modules/5.3.18/kernel/drivers/md/dm-mod.ko"]="ex-dm-mod.ko"
["test-depmod/big-01-delete/lib/modules/5.3.18/kernel/fs/configfs/configfs.ko"]="ex-configfs.ko"
["test-depmod/big-01-delete/lib/modules/5.3.18/symvers"]="symvers"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/block/t10-pi.ko"]="ex-t10-pi.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/cdrom/cdrom.ko"]="ex-cdrom.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/scsi/scsi_mod.ko"]="ex-scsi_mod.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/scsi/scsi_transport_fc.ko"]="ex-scsi_transport_fc.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/scsi/scsi_transport_sas.ko"]="ex-scsi_transport_sas.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/scsi/sd_mod.ko"]="ex-sd_mod.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/scsi/sr_mod.ko"]="ex-sr_mod.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/scsi/ses.ko"]="ex-ses.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/scsi/device_handler/scsi_dh_alua.ko"]="ex-scsi_dh_alua.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/scsi/raid_class.ko"]="ex-raid_class.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/scsi/mpt3sas.ko"]="ex-mpt3sas.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/scsi/qla2xxx/qla2xxx.ko"]="other/ex-qla2xxx.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/scsi/qla2xxx/tcm_qla2xxx.ko"]="other/ex-tcm_qla2xxx.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/nvme/host/nvme-fc.ko"]="ex-nvme-fc.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/nvme/host/nvme-fabrics.ko"]="ex-nvme-fabrics.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/nvme/host/nvme-core.ko"]="ex-nvme-core.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/target/target_core_mod.ko"]="ex-target_core_mod.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/misc/enclosure.ko"]="ex-enclosure.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/md/dm-multipath.ko"]="ex-dm-multipath.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/md/dm-service-time.ko"]="ex-dm-multipath.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/drivers/md/dm-mod.ko"]="ex-dm-mod.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/kernel/fs/configfs/configfs.ko"]="ex-configfs.ko"
["test-depmod/big-01-replace/lib/modules/5.3.18/symvers"]="symvers"
)

gzip_array=(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Aliases for symbols, used by symbol_request().
alias symbol:t10_pi_type1_crc t10_pi
alias symbol:nvmf_fail_nonready_command nvme_fabrics
alias symbol:scsi_dma_map scsi_mod
alias symbol:scsi_is_sdev_device scsi_mod
alias symbol:nvme_uninit_ctrl nvme_core
alias symbol:dm_table_run_md_queue_async dm_mod
alias symbol:nvme_fc_set_remoteport_devloss nvme_fc
alias symbol:scsi_remove_host scsi_mod
alias symbol:scsi_target_block scsi_mod
alias symbol:dm_unregister_path_selector dm_service_time
alias symbol:scsi_host_get scsi_mod
alias symbol:nvme_complete_rq nvme_core
alias symbol:fc_vport_create scsi_transport_fc
alias symbol:scsi_print_sense_hdr scsi_mod
alias symbol:target_backend_unregister target_core_mod
alias symbol:enclosure_remove_device enclosure
alias symbol:fc_attach_transport scsi_transport_fc
alias symbol:raid_class_attach raid_class
alias symbol:register_cdrom cdrom
alias symbol:scsi_mode_sense scsi_mod
alias symbol:target_execute_cmd target_core_mod
alias symbol:scsi_dh_attach scsi_mod
alias symbol:__scsi_iterate_devices scsi_mod
alias symbol:config_group_init configfs
alias symbol:scsi_target_block_mangled scsi_mod
alias symbol:scsi_remove_host_mangled scsi_mod
alias symbol:t10_pi_type1_crc_mangled t10_pi
alias symbol:scsi_dh_attach_mangled scsi_mod
alias symbol:nvme_fc_set_remoteport_devloss_mangled nvme_fc
alias symbol:target_backend_unregister_mangled target_core_mod
alias symbol:scsi_host_get_mangled scsi_mod
alias symbol:__scsi_iterate_devices_mangled scsi_mod
alias symbol:target_execute_cmd_mangled target_core_mod
alias symbol:fc_attach_transport_mangled scsi_transport_fc
alias symbol:register_cdrom_mangled cdrom
alias symbol:fc_vport_create_mangled scsi_transport_fc
alias symbol:scsi_print_sense_hdr_mangled scsi_mod
alias symbol:scsi_dma_map_mangled scsi_mod
alias symbol:scsi_is_sdev_device_mangled scsi_mod
alias symbol:nvme_complete_rq_mangled nvme_core
alias symbol:dm_unregister_path_selector_mangled dm_service_time
alias symbol:raid_class_attach_mangled raid_class
alias symbol:enclosure_remove_device_mangled enclosure
alias symbol:scsi_mode_sense_mangled scsi_mod
alias symbol:dm_table_run_md_queue_async_mangled dm_mod
alias symbol:nvmf_fail_nonready_command_mangled nvme_fabrics
alias symbol:nvme_uninit_ctrl_mangled nvme_core
alias symbol:config_group_init_mangled configfs
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Aliases extracted from modules themselves.
Binary file not shown.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Soft dependencies extracted from modules themselves.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Weak dependencies extracted from modules themselves.
Binary file not shown.
43 changes: 43 additions & 0 deletions testsuite/test-depmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,4 +521,47 @@ DEFINE_TEST(depmod_test_big_01_delete,
},
});

#define TEST_BIG_01_REPLACE_ROOTFS TESTSUITE_ROOTFS "test-depmod/big-01-replace"
static noreturn int depmod_test_big_01_replace(const struct test *t)
{
const char *progname = TOOLS_DIR "/depmod";
const char *const args[] = {
progname,
"-e",
"-E",
TEST_BIG_01_REPLACE_ROOTFS "/lib/modules/5.3.18/symvers",
"-I",
"5.3.18",
"kernel/drivers/scsi/qla2xxx/qla2xxx.ko",
"kernel/drivers/scsi/qla2xxx/tcm_qla2xxx.ko",
NULL,
};

test_spawn_prog(progname, args);
exit(EXIT_FAILURE);
}
DEFINE_TEST(depmod_test_big_01_replace,
#if defined(KMOD_SYSCONFDIR_NOT_ETC)
.skip = true,
#endif
.description = "check depmod -I with module deletion from the big-01 module set",
.config = {
[TC_UNAME_R] = "5.3.18",
[TC_ROOTFS] = TEST_BIG_01_REPLACE_ROOTFS,
},
.output = {
.regex = true,
.files = (const struct keyval[]) {
{ TEST_BIG_01_REPLACE_ROOTFS "/lib/modules/5.3.18/correct-modules.dep",
TEST_BIG_01_REPLACE_ROOTFS "/lib/modules/5.3.18/modules.dep" },
{ TEST_BIG_01_REPLACE_ROOTFS "/lib/modules/5.3.18/correct-modules.dep.bin",
TEST_BIG_01_REPLACE_ROOTFS "/lib/modules/5.3.18/modules.dep.bin" },
{ TEST_BIG_01_REPLACE_ROOTFS "/lib/modules/5.3.18/correct-modules.symbols",
TEST_BIG_01_REPLACE_ROOTFS "/lib/modules/5.3.18/modules.symbols" },
{ TEST_BIG_01_REPLACE_ROOTFS "/lib/modules/5.3.18/correct-modules.symbols.bin",
TEST_BIG_01_REPLACE_ROOTFS "/lib/modules/5.3.18/modules.symbols.bin" },
{ }
},
});

TESTSUITE_MAIN();

0 comments on commit 4ab8a53

Please sign in to comment.