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>
_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
}
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"