From: Frantisek Sumsal Date: Fri, 1 Oct 2021 11:56:25 +0000 (+0200) Subject: test: test udev with a _very_ long device name X-Git-Tag: v250-rc1~558 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f415cdb3723200e3ceebd2ef18a919fbe2d76710;p=thirdparty%2Fsystemd.git test: test udev with a _very_ long device name Let's attempt to provide some coverage for #16161, #6867, and similar. --- diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh index 23cdefa5ce9..bd3f8250a3f 100755 --- a/test/TEST-64-UDEV-STORAGE/test.sh +++ b/test/TEST-64-UDEV-STORAGE/test.sh @@ -2,10 +2,9 @@ # vi: ts=4 sw=4 tw=0 et: # # TODO: -# * iSCSI -# * LVM over iSCSI (?) # * SW raid (mdadm) -# * MD (mdadm) -> DM-CRYPT -> LVM +# * MD (mdadm) -> dm-crypt -> LVM +# * iSCSI -> dm-crypt -> LVM set -e TEST_DESCRIPTION="systemd-udev storage tests" @@ -69,7 +68,7 @@ test_append_files() {( instmods "=block" "=md" "=nvme" "=scsi" install_dmevent - image_install lsblk wc wipefs + image_install lsblk swapoff swapon wc wipefs # Install the optional features if the host has the respective tooling for feature in "${!features[@]}"; do @@ -391,13 +390,51 @@ testcase_iscsi_lvm() { ) done - KERNEL_APPEND="systemd.setenv=TEST_FUNCTION_NAME=${FUNCNAME[0]} ${USER_KERNEL_APPEND:-}" QEMU_OPTIONS="${qemu_opts[*]} ${USER_QEMU_OPTIONS:-}" test_run_one "${1:?}" || return $? rm -f "${TESTDIR:?}"/iscsibasic*.img } + +testcase_long_sysfs_path() { + local brid + local testdisk="${TESTDIR:?}/longsysfspath.img" + local qemu_opts=( + "-drive if=none,id=drive0,format=raw,cache=unsafe,file=$testdisk" + "-device pci-bridge,id=pci_bridge0,bus=pci.0,chassis_nr=64" + ) + + dd if=/dev/zero of="$testdisk" bs=1M count=64 + lodev="$(losetup --show -f -P "$testdisk")" + sfdisk "${lodev:?}" <>/etc/fstab + systemctl daemon-reload + mount "$mpoint" + test -e "$mpoint/test" + umount "$mpoint" + + # Test out the swap partition + swapon -v -L swap_vol + swapoff -v -L swap_vol + + logfile="$(mktemp)" + journalctl -b -q --no-pager -o short-monotonic -p info --grep "Device path.*vda.?' too long to fit into unit name" + # Make sure we don't unnecessarily spam the log + journalctl -b -q --no-pager -o short-monotonic -p info --grep "/sys/devices/.+/vda[0-9]?" _PID=1 + UNIT=systemd-udevd.service | tee "$logfile" + [[ "$(wc -l <"$logfile")" -lt 10 ]] + + : >/etc/fstab + rm -fr "${logfile:?}" "${mpoint:?}" +} + : >/failed udevadm settle @@ -605,6 +652,7 @@ fi echo "TEST_FUNCTION_NAME=$TEST_FUNCTION_NAME" "$TEST_FUNCTION_NAME" +udevadm settle echo "Check if all symlinks under /dev/disk/ are valid (post-test)" helper_check_device_symlinks