diff --git a/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure b/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure index f29677ce663..02e2ac4daaa 100755 --- a/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure +++ b/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure @@ -26,6 +26,6 @@ for bridge in range(1, 26): f"pci-bridge,id=pci_bridge{bridge},bus=pci_bridge{bridge - 1},chassis_nr={64 + bridge},addr=1", ] -config["QemuArgs"] += ["-device", f"virtio-blk-pci,drive=drive0,bus=pci_bridge25,addr=1"] +config["QemuArgs"] += ["-device", f"virtio-blk-pci,drive=drive0,bus=pci_bridge25,addr=1,serial=long-sysfs-path"] json.dump(config, sys.stdout) diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh index 2fd7bf2bfb9..104902055b5 100755 --- a/test/TEST-64-UDEV-STORAGE/test.sh +++ b/test/TEST-64-UDEV-STORAGE/test.sh @@ -464,7 +464,7 @@ testcase_long_sysfs_path() { qemu_opts+=("-device pci-bridge,id=pci_bridge$brid,bus=pci_bridge$((brid-1)),chassis_nr=$((64+brid))") done - qemu_opts+=("-device virtio-blk-pci,drive=drive0,bus=pci_bridge$brid") + qemu_opts+=("-device virtio-blk-pci,drive=drive0,bus=pci_bridge$brid,serial=long-sysfs-path") KERNEL_APPEND="systemd.setenv=TEST_FUNCTION_NAME=${FUNCNAME[0]} ${USER_KERNEL_APPEND:-}" QEMU_OPTIONS="${qemu_opts[*]} ${USER_QEMU_OPTIONS:-}" diff --git a/test/units/TEST-64-UDEV-STORAGE.sh b/test/units/TEST-64-UDEV-STORAGE.sh index 6c8f6d63e6d..17f93dc4a1a 100755 --- a/test/units/TEST-64-UDEV-STORAGE.sh +++ b/test/units/TEST-64-UDEV-STORAGE.sh @@ -1006,19 +1006,21 @@ testcase_long_sysfs_path() { journalctl --cursor-file="${cursor:?}" -n0 -q # Make sure the test device is connected and show its "wonderful" path - stat /sys/block/vda - readlink -f /sys/block/vda/dev + dev="$(udevadm info -e --property-match=ID_SERIAL=long-sysfs-path --property-match DEVTYPE=disk --json=short | jq -r .DEVNAME)" + dev="${dev#/dev/}" - dev="/dev/vda" - udevadm lock --device "$dev" sfdisk "$dev" </etc/fstab