]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(dracut.sh): make omit-drivers option do exact match for names
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Wed, 24 Aug 2022 19:16:26 +0000 (19:16 +0000)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Mon, 24 Oct 2022 15:19:37 +0000 (15:19 +0000)
Modify the basic test case to use --omit-drivers and make it fail
without the PR and make it pass with the PR.

The test would fail with the following error without the PR:
FATAL: iscsiroot requested but kernel/initrd does not support iscsi

dracut.sh
test/TEST-01-BASIC/test.sh

index 78801a4269795ded8134a8aa422603c8c7160328..5b10b5a6ecf526cc3d200f98c456038ec162fe8a 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1345,7 +1345,7 @@ omit_drivers_corrected=""
 for d in $omit_drivers; do
     [[ " $drivers $add_drivers " == *\ $d\ * ]] && continue
     [[ " $drivers $force_drivers " == *\ $d\ * ]] && continue
-    omit_drivers_corrected+="$d|"
+    omit_drivers_corrected+="^$d$|"
 done
 omit_drivers="${omit_drivers_corrected%|}"
 unset omit_drivers_corrected
index 38f3ab20577f3a18e6eb964650367688d52ce893..b782e7ee1e07dacfa482e4c628053d1798416876 100755 (executable)
@@ -108,9 +108,12 @@ test_setup() {
         inst_hook shutdown-emergency 000 ./hard-off.sh
         inst_hook emergency 000 ./hard-off.sh
     )
+
+    # make sure --omit-drivers does not filter out drivers using regexp to test for an earlier regression (assuming there is no one letter linux kernel module needed to run the test)
     "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
         -a "debug watchdog" \
         -d "piix ide-gd_mod ata_piix ext3 sd_mod i6300esb ib700wdt" \
+        --omit-drivers 'a b c d e f g h i j k l m n o p q r s t u v w x y z' \
         --no-hostonly-cmdline -N \
         -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
 }