From 79021177129d093029a330a12ac2e472374bc13b Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Fri, 15 Nov 2024 01:14:35 +0100 Subject: [PATCH] testsuite: add unit test for module overriding This test is like the "replace" test, but it uses depmods's built-in priority logic by copying the replacement modules into the "updates" subdirectory. "depmod -I -a" is expected to detect this change. Signed-off-by: Martin Wilck --- scripts/setup-rootfs.sh | 25 ++++++++++ .../lib/modules/5.3.18/correct-modules.dep | 22 +++++++++ .../modules/5.3.18/correct-modules.dep.bin | Bin 0 -> 3022 bytes .../modules/5.3.18/correct-modules.symbols | 28 +++++++++++ .../5.3.18/correct-modules.symbols.bin | Bin 0 -> 2175 bytes .../lib/modules/5.3.18/modules.alias | 1 + .../lib/modules/5.3.18/modules.alias.bin | Bin 0 -> 12 bytes .../lib/modules/5.3.18/modules.dep | 1 + .../lib/modules/5.3.18/modules.dep.bin | 1 + .../lib/modules/5.3.18/modules.devname | 0 .../lib/modules/5.3.18/modules.softdep | 1 + .../lib/modules/5.3.18/modules.symbols | 1 + .../lib/modules/5.3.18/modules.symbols.bin | 1 + .../lib/modules/5.3.18/modules.weakdep | 1 + .../5.3.18/novers-correct-modules.symbols.bin | Bin 0 -> 2175 bytes .../modules/5.3.18/novers-modules.symbols.bin | 1 + testsuite/test-depmod.c | 44 +++++++++++++++++- 17 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/correct-modules.dep create mode 100644 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/correct-modules.dep.bin create mode 100644 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/correct-modules.symbols create mode 100644 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/correct-modules.symbols.bin create mode 100644 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.alias create mode 100644 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.alias.bin create mode 120000 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.dep create mode 120000 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.dep.bin create mode 100644 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.devname create mode 100644 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.softdep create mode 120000 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.symbols create mode 120000 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.symbols.bin create mode 100644 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.weakdep create mode 100644 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/novers-correct-modules.symbols.bin create mode 120000 testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/novers-modules.symbols.bin diff --git a/scripts/setup-rootfs.sh b/scripts/setup-rootfs.sh index 359a28b8..099407d4 100755 --- a/scripts/setup-rootfs.sh +++ b/scripts/setup-rootfs.sh @@ -216,6 +216,31 @@ map=( ["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" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/block/t10-pi.ko"]="ex-t10-pi.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/cdrom/cdrom.ko"]="ex-cdrom.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/scsi/scsi_mod.ko"]="ex-scsi_mod.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/scsi/scsi_transport_fc.ko"]="ex-scsi_transport_fc.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/scsi/scsi_transport_sas.ko"]="ex-scsi_transport_sas.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/scsi/sd_mod.ko"]="ex-sd_mod.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/scsi/sr_mod.ko"]="ex-sr_mod.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/scsi/ses.ko"]="ex-ses.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/scsi/device_handler/scsi_dh_alua.ko"]="ex-scsi_dh_alua.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/scsi/raid_class.ko"]="ex-raid_class.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/scsi/mpt3sas.ko"]="ex-mpt3sas.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/scsi/qla2xxx/qla2xxx.ko"]="ex-qla2xxx.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/scsi/qla2xxx/tcm_qla2xxx.ko"]="ex-tcm_qla2xxx.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/updates/qla2xxx.ko"]="other/ex-qla2xxx.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/updates/tcm_qla2xxx.ko"]="other/ex-tcm_qla2xxx.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/nvme/host/nvme-fc.ko"]="ex-nvme-fc.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/nvme/host/nvme-fabrics.ko"]="ex-nvme-fabrics.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/nvme/host/nvme-core.ko"]="ex-nvme-core.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/target/target_core_mod.ko"]="ex-target_core_mod.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/misc/enclosure.ko"]="ex-enclosure.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/md/dm-multipath.ko"]="ex-dm-multipath.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/md/dm-service-time.ko"]="ex-dm-multipath.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/drivers/md/dm-mod.ko"]="ex-dm-mod.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/kernel/fs/configfs/configfs.ko"]="ex-configfs.ko" + ["test-depmod/big-01-override/lib/modules/5.3.18/symvers"]="symvers" ) gzip_array=( diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/correct-modules.dep b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/correct-modules.dep new file mode 100644 index 00000000..361d1a9c --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/correct-modules.dep @@ -0,0 +1,22 @@ +kernel/drivers/md/dm-multipath.ko: kernel/drivers/md/dm-mod.ko kernel/drivers/scsi/scsi_mod.ko +updates/qla2xxx.ko: kernel/drivers/nvme/host/nvme-fc.ko kernel/drivers/scsi/scsi_transport_fc.ko kernel/drivers/nvme/host/nvme-fabrics.ko kernel/drivers/scsi/scsi_mod.ko kernel/drivers/nvme/host/nvme-core.ko kernel/block/t10-pi.ko +kernel/drivers/nvme/host/nvme-fc.ko: kernel/drivers/nvme/host/nvme-fabrics.ko kernel/drivers/nvme/host/nvme-core.ko kernel/block/t10-pi.ko +kernel/drivers/nvme/host/nvme-fabrics.ko: kernel/drivers/nvme/host/nvme-core.ko kernel/block/t10-pi.ko +kernel/drivers/scsi/scsi_mod.ko: +kernel/drivers/scsi/ses.ko: kernel/drivers/misc/enclosure.ko kernel/drivers/scsi/scsi_transport_sas.ko kernel/drivers/scsi/scsi_mod.ko +kernel/drivers/scsi/scsi_transport_sas.ko: kernel/drivers/scsi/scsi_mod.ko +kernel/drivers/scsi/mpt3sas.ko: kernel/drivers/scsi/raid_class.ko kernel/drivers/scsi/scsi_transport_sas.ko kernel/drivers/scsi/scsi_mod.ko +kernel/drivers/md/dm-mod.ko: +kernel/drivers/nvme/host/nvme-core.ko: kernel/block/t10-pi.ko +updates/tcm_qla2xxx.ko: updates/qla2xxx.ko kernel/drivers/target/target_core_mod.ko kernel/fs/configfs/configfs.ko kernel/drivers/nvme/host/nvme-fc.ko kernel/drivers/scsi/scsi_transport_fc.ko kernel/drivers/nvme/host/nvme-fabrics.ko kernel/drivers/scsi/scsi_mod.ko kernel/drivers/nvme/host/nvme-core.ko kernel/block/t10-pi.ko +kernel/drivers/misc/enclosure.ko: +kernel/drivers/scsi/raid_class.ko: kernel/drivers/scsi/scsi_mod.ko +kernel/drivers/md/dm-service-time.ko: kernel/drivers/md/dm-mod.ko kernel/drivers/scsi/scsi_mod.ko +kernel/drivers/target/target_core_mod.ko: kernel/fs/configfs/configfs.ko +kernel/drivers/scsi/sr_mod.ko: kernel/drivers/cdrom/cdrom.ko kernel/drivers/scsi/scsi_mod.ko +kernel/drivers/scsi/sd_mod.ko: kernel/drivers/scsi/scsi_mod.ko kernel/block/t10-pi.ko +kernel/drivers/scsi/device_handler/scsi_dh_alua.ko: kernel/drivers/scsi/scsi_mod.ko +kernel/drivers/cdrom/cdrom.ko: +kernel/block/t10-pi.ko: +kernel/drivers/scsi/scsi_transport_fc.ko: kernel/drivers/scsi/scsi_mod.ko +kernel/fs/configfs/configfs.ko: diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/correct-modules.dep.bin b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/correct-modules.dep.bin new file mode 100644 index 0000000000000000000000000000000000000000..022bb53440778d5fa683e0a158a0b52ad34c1d8b GIT binary patch literal 3022 zcmdT`&5qMB5T3T%cDpQp3y2GcB5~nRvJ1C8afBCu3sUgf&Neh@g6&p)1RkRgzyXN^ z5)x8QJOei*9szOV0G=dHitDuH=Ypk8vYyZ1d@~-8`=^qTj&qX1JG^d4_psWGpcFiYrt8v7)g5k%m& zUUfysc;2+eWXd8gihjn5b*^n+3pc5H@t%tw@nwHJg{m1qAa#OnHA!!p*K1OWMvUfq zqdTkEwr^S83wt||7M*N6D~4^vUUBj=lNnQ>=J48CHg>y!tJc+Z@^fstYeHlDLNM&> z-s?>6*uGa|zUZSlHLfyjh#A zkIy+*KDM;gEMKy+tO&xq;#Hwn>!9IB8N`0s?v0QGa}6k3*>WN?UtbUQb~UOnzy=Y< eY)aAU=g!NcJ}h;)I)OG>b)VZ_YsP+b@^ymhV*w9kTZg(BK>YS?b50}4v1v5CA1KhKA3vho^u9=#*>~e&2d6*J;q;F=oIRPt#qZooTkyi65e~V+ zbs^F6O4N%I)ebbH_pCRn8U?TENj=YxVwONt>tewdrdhSTs0%lReJpzmZF`u?MWU6A zpyJ?G9l)>T`$LhJ$jz$emEzYcTp<^BQ_JaASE}OU`H7!-Ius$)1{Z}T*Lf@4l3OfM zy2ebg?-ACb*+s@(QDN_muk%pGN) zgB?}>)QP%cg2eB%jRn)U9{wb%k6uX3&VmDM>_$CP_cn z3*@kmit?0HJId2pkKgkUBr0V}A=G_tN@vQyIZq3gVd(q7wJ1tnH2R9JO(BOAXSohU8YECUZe7#zb}20SQ{c&UDg2w8n_jM1<-S4;L0|`G4{j4m-;WB# zWhp3BF=WF;$a_YN7JKpIEMlI7ePKvt8mgSba=zcM_VzmTbmTJzLegn{m)OGDOUtqD zE7O%n<#aJgJ1d6ZrA|F5lLV-rfO2y<|L`!F^KZ6re$c2oxOh0)(46n)G(O#rFP2pY z=bw%i<49{?-$BP=qe^n77z7N{|PP+LQF%9;7`DtO#1); literal 0 HcmV?d00001 diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.alias b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.alias new file mode 100644 index 00000000..ba76e181 --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.alias @@ -0,0 +1 @@ +# Aliases extracted from modules themselves. diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.alias.bin b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.alias.bin new file mode 100644 index 0000000000000000000000000000000000000000..7075435f6268c4d815aec093d61e26647666ba76 GIT binary patch literal 12 TcmdnM{w17&iGh)Ufq@4A6;A>Z literal 0 HcmV?d00001 diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.dep b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.dep new file mode 120000 index 00000000..506b495b --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.dep @@ -0,0 +1 @@ +../../../../big-01/lib/modules/5.3.18/correct-modules.dep \ No newline at end of file diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.dep.bin b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.dep.bin new file mode 120000 index 00000000..67aa027d --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.dep.bin @@ -0,0 +1 @@ +../../../../big-01/lib/modules/5.3.18/correct-modules.dep.bin \ No newline at end of file diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.devname b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.devname new file mode 100644 index 00000000..e69de29b diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.softdep b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.softdep new file mode 100644 index 00000000..5554ccca --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.softdep @@ -0,0 +1 @@ +# Soft dependencies extracted from modules themselves. diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.symbols b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.symbols new file mode 120000 index 00000000..3dfa0de8 --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.symbols @@ -0,0 +1 @@ +../../../../big-01/lib/modules/5.3.18/correct-modules.symbols \ No newline at end of file diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.symbols.bin b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.symbols.bin new file mode 120000 index 00000000..023d2362 --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.symbols.bin @@ -0,0 +1 @@ +../../../../big-01/lib/modules/5.3.18/correct-modules.symbols.bin \ No newline at end of file diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.weakdep b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.weakdep new file mode 100644 index 00000000..569696db --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/modules.weakdep @@ -0,0 +1 @@ +# Weak dependencies extracted from modules themselves. diff --git a/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/novers-correct-modules.symbols.bin b/testsuite/rootfs-pristine/test-depmod/big-01-override/lib/modules/5.3.18/novers-correct-modules.symbols.bin new file mode 100644 index 0000000000000000000000000000000000000000..5b5c759ee2a9146e8f926ea969431e562232cd08 GIT binary patch literal 2175 zcmdT_J&)5s5S`?b%OQ>r-GM}zn&v)A{s09MCD4sF>q%^#z3bauM~P@Dphs8xAAsnQ z+<@SZT#W=06*|UFtc%yO?oOg%rD)fidAl?3&CGrr{dx&~=#2q(t<3@UmdQlNPXJv3 zU}0nM_lF$dynvp|q4#Oyuhue${=0g!fUWOi*!nYu!Rs+>|3)iqgpng79AQB7NRq`w zs98)w3F`B2P#GmUfD0an>j7F#qZ!VO&Qgq2{Rdxx=>Oc@!vD50h|O2*n|hMk~9 z&ua?&Gj3CD*F;MMF)yHhucYc<4nFg_b3%sbj8Hb!rbX|AN|npMr?Tl=g^`9zVLd^w zg3c45DW}aDr^{Oe$#V72>+pE*QN6zD%-9z?Nn>K4%&G6zEj3RFr8b^MlJ#?yK#r=Y zI8Rx%R-X1Nyw8KGa#K1JU-v$oiYP{OXE4<*jpFrToFudOkX80zDVWUwMuzgV5@EXfC&+pgs zmoO<{__(&HXWo0&K}ScU63jsAv(RCyt-~2-o5xv)wM7deV2{3Scz0pZq~X#(;!5IZ zzHY!ivg2|c5Eq8Bt@7@$H<9AJtN>xq(zOG$>WX1W%k?M`rlfBYYk6`_#E~dq^tmSR zf1Gm|{W!!lLbpum2&HK~VEgW