]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: wait for the nvme device to appear
authorFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 3 Nov 2023 14:31:52 +0000 (15:31 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 3 Nov 2023 23:26:57 +0000 (23:26 +0000)
Also, use a /dev/disk/by-id/ symlink to the device, which should be
predictable, unlike the /dev/nvmeX stuff.

test/units/testsuite-84.sh

index 954dce2d0468caa47f9b34eefec84c68e93d444f..f82b527a7227235cd1403b66acd57bc6df414d6c 100755 (executable)
@@ -11,15 +11,16 @@ systemctl start sys-kernel-config.mount
 dd if=/dev/urandom of=/var/tmp/storagetm.test bs=1024 count=10240
 
 systemd-run -u teststoragetm.service -p Type=notify /usr/lib/systemd/systemd-storagetm /var/tmp/storagetm.test --nqn=quux
+NVME_SERIAL="$(</sys/kernel/config/nvmet/subsystems/quux.storagetm.test/attr_serial)"
+NVME_DEVICE="/dev/disk/by-id/nvme-Linux_${NVME_SERIAL:?}"
 
 nvme connect-all -t tcp -a 127.0.0.1 -s 16858 --hostid="$(cat /proc/sys/kernel/random/uuid)"
+udevadm wait --settle "$NVME_DEVICE"
 
-dd if=/dev/nvme1n1 bs=1024 | cmp /var/tmp/storagetm.test -
-
-nvme disconnect --device=nvme1
+dd if="$NVME_DEVICE" bs=1024 | cmp /var/tmp/storagetm.test -
 
+nvme disconnect-all
 systemctl stop teststoragetm.service
-
 rm /var/tmp/storagetm.test
 
 touch /testok