1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-06 17:18:12 +03:00
systemd/test/TEST-64-UDEV-STORAGE/long_sysfs_path.configure
Daan De Meyer 2ec809dd3b TEST-64-UDEV-STORAGE: Don't hardcode device name in long-sysfs-path test
There's no guarantee our device will be named /dev/vda, so give it
a serial so we can query for its devname inside the test.
2024-11-02 20:43:22 +01:00

32 lines
908 B
Python
Executable File

#!/usr/bin/python3
# SPDX-License-Identifier: LGPL-2.1-or-later
import json
import sys
config = json.load(sys.stdin)
config["QemuDrives"] += [
{
"Id": "drive0",
"Size": "64M",
"Options": "cache=unsafe",
}
]
config["QemuArgs"] += ["-device", "pci-bridge,id=pci_bridge0,chassis_nr=64"]
# Create 25 additional PCI bridges, each one connected to the previous one
# (basically a really long extension cable), and attach a virtio drive to
# the last one. This should force udev into attempting to create a device
# unit with a _really_ long name.
for bridge in range(1, 26):
config["QemuArgs"] += [
"-device",
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,serial=long-sysfs-path"]
json.dump(config, sys.stdout)