From: Johannes Thumshirn Date: Wed, 4 Jul 2018 11:40:12 +0000 (+0200) Subject: common/rc: search harder for pci device X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=eb3484e46579c1ca5210a3611b32d7aad0a3a97f;p=users%2Fsagi%2Fblktests.git common/rc: search harder for pci device Some multipathed NVMe devices have a bit of a different sysfs layout then we've expoected them to have in the first place. Try harder searching for a pci device if we encounter such a device. This fixes issue #26. Signed-off-by: Johannes Thumshirn --- diff --git a/common/rc b/common/rc index e414fa3..3c3e91f 100644 --- a/common/rc +++ b/common/rc @@ -165,6 +165,19 @@ _test_dev_queue_set() { _test_dev_is_pci() { if ! readlink -f "$TEST_DEV_SYSFS/device" | grep -q pci; then + # nvme needs some special casing + if readlink -f "$TEST_DEV_SYSFS/device" | grep -q nvme; then + local blkdev + local ctrldev + # First get the controller device from the namespace blockdev + blkdev="$(echo "$TEST_DEV_SYSFS" | cut -d '/' -f 7)" + ctrldev="$(echo "$blkdev" | grep -Eo 'nvme[0-9]+')" + # Then get the pci device from the controller device + if readlink -f "$ctrldev/device" | grep -1 pci; then + return 0 + fi + fi + SKIP_REASON="$TEST_DEV is not a PCI device" return 1 fi