]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: do not fail if scsi_debug module not available
authorLuca Boccassi <luca.boccassi@gmail.com>
Fri, 4 Jul 2025 00:18:47 +0000 (01:18 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 4 Jul 2025 16:21:16 +0000 (17:21 +0100)
On Debian it's only built on amd64 kernels, so skip test cases if it
cannot be loaded

test/units/TEST-17-UDEV.sanity-check.sh
test/units/TEST-35-LOGIN.sh

index 7b95722f7a835526e2959e489b78dd3a3c92d157..98a277a47eb1301c2d7b211e24f8243c913670fe 100755 (executable)
@@ -190,8 +190,8 @@ udevadm test-builtin "factory_reset status" "$loopdev"
 # systemd-hwdb update is extremely slow when combined with sanitizers and run
 # in a VM without acceleration, so let's just skip the one particular test
 # if we detect this combination
-if ! [[ -v ASAN_OPTIONS && "$(systemd-detect-virt -v)" == "qemu" ]]; then
-    modprobe scsi_debug
+# scsi_debug is not available in all architectures/kernels combinations
+if ! [[ -v ASAN_OPTIONS && "$(systemd-detect-virt -v)" == "qemu" ]] && modprobe scsi_debug; then
     scsidev=$(readlink -f /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/[0-9]*)
     mkdir -p /etc/udev/hwdb.d
     cat >/etc/udev/hwdb.d/99-test.hwdb <<EOF
index 9620bbad6fede159a49de27a9912f4c89873a91c..a543023ceab4d36d3d60c5f776b9b83bd96d6e39 100755 (executable)
@@ -298,7 +298,7 @@ teardown_session() (
 
     rm -f /run/udev/rules.d/70-logindtest-scsi_debug-user.rules
     udevadm control --reload
-    rmmod scsi_debug
+    rmmod scsi_debug || true
 
     return 0
 )
@@ -446,7 +446,11 @@ EOF
 
     # coldplug: logind started with existing device
     systemctl stop systemd-logind.service
-    modprobe scsi_debug
+    if ! modprobe scsi_debug; then
+        echo "scsi_debug module not available, skipping test ${FUNCNAME[0]}."
+        systemctl start systemd-logind.service
+        return
+    fi
     timeout 30 bash -c 'until ls /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/*:*/block 2>/dev/null; do sleep 1; done'
     dev=/dev/$(ls /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/*:*/block 2>/dev/null)
     if [[ ! -b "$dev" ]]; then