From c4033bf83812956d0934bd0e7064d76c6af5c40f Mon Sep 17 00:00:00 2001 From: Omar Sandoval Date: Tue, 24 Oct 2017 14:01:29 -0700 Subject: [PATCH] common/rc: fix _get_pci_dev_from_blkdev The device path might include multiple PCI devices, like the port. Always get the last one. Fixes #5. Signed-off-by: Omar Sandoval --- common/rc | 3 ++- tests/block/011 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/rc b/common/rc index 28116b0..d7f3220 100644 --- a/common/rc +++ b/common/rc @@ -138,5 +138,6 @@ _test_dev_is_pci() { _get_pci_dev_from_blkdev() { readlink -f "$TEST_DEV_SYSFS/device" | \ - grep -Eo '[0-9a-f]{4}:[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]' + grep -Eo '[0-9a-f]{4}:[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]' | \ + tail -1 } diff --git a/tests/block/011 b/tests/block/011 index 920c58b..62e89f7 100755 --- a/tests/block/011 +++ b/tests/block/011 @@ -31,7 +31,7 @@ device_requires() { test_device() { echo "Running ${TEST_NAME}" - pdev=$(_get_pci_dev_from_blkdev) + pdev="$(_get_pci_dev_from_blkdev)" if _test_dev_is_rotational; then size="32m" -- 2.51.0