]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-74-AUX-UTILS: Support systems with pre-existing modules config
authorRichard Maw <richard.maw@codethink.co.uk>
Thu, 22 Feb 2024 13:00:48 +0000 (13:00 +0000)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 6 May 2024 08:58:47 +0000 (10:58 +0200)
test/units/testsuite-74.modules-load.sh

index 3d00e07f07c68dafa3bbbe2571ebd9316ff9229e..aea2f3cbdea44eae7bda690c3c3480cce45827c5 100755 (executable)
@@ -17,6 +17,8 @@ if systemd-detect-virt -cq; then
     exit 0
 fi
 
+ORIG_MODULES_LOAD_CONFIG="$(systemd-analyze cat-config modules-load.d)"
+
 # Check if we have required kernel modules
 modprobe --all --resolve-alias loop dummy
 
@@ -75,7 +77,7 @@ modprobe -v --all --remove loop dummy
 # Make sure we have no config files left over that might interfere with
 # following tests
 rm -fv "$CONFIG_FILE"
-[[ -z "$(systemd-analyze cat-config modules-load.d)" ]]
+[[ "$ORIG_MODULES_LOAD_CONFIG" == "$(systemd-analyze cat-config modules-load.d)" ]]
 CMDLINE="ro root= modules_load= modules_load=, / = modules_load=foo-bar-baz,dummy modules_load=loop,loop,loop"
 SYSTEMD_PROC_CMDLINE="$CMDLINE" "$MODULES_LOAD_BIN" |& tee /tmp/out.log
 grep -E "^Inserted module .*loop" /tmp/out.log