# 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
rm -f /run/udev/rules.d/70-logindtest-scsi_debug-user.rules
udevadm control --reload
- rmmod scsi_debug
+ rmmod scsi_debug || true
return 0
)
# 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