]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
common/rc: fix _get_pci_dev_from_blkdev
authorOmar Sandoval <osandov@fb.com>
Tue, 24 Oct 2017 21:01:29 +0000 (14:01 -0700)
committerOmar Sandoval <osandov@fb.com>
Tue, 24 Oct 2017 21:05:36 +0000 (14:05 -0700)
The device path might include multiple PCI devices, like the port.
Always get the last one.

Fixes #5.

Signed-off-by: Omar Sandoval <osandov@fb.com>
common/rc
tests/block/011

index 28116b0fc30897f2f386f6610f6fbed178b08dae..d7f322016ea48094ddd134f6a8acb54b893ee62f 100644 (file)
--- 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
 }
index 920c58bb8ee40c2f3433d96c0e13b3be8fa308aa..62e89f758ef17cadfd2359d86ffe541b6342a151 100755 (executable)
@@ -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"