zfs test suite: support device paths with intermediate directories

The code assumed that disks (devices) used for testing are always named
like /dev/foo, but there is no reason for that restriction and we can
easily support paths like /dev/stripe/bar.
This commit is contained in:
Andriy Gapon 2018-03-15 12:47:34 +00:00
parent aaaf06cd0c
commit a7478ad1ce
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=330996
3 changed files with 3 additions and 7 deletions

View File

@ -640,7 +640,7 @@ function wipe_partition_table #<whole_disk_name> [<whole_disk_name> ...]
while [[ -n $* ]]; do
typeset diskname=$1
[ ! -e $diskname ] && log_fail "ERROR: $diskname doesn't exist"
if gpart list $(basename $diskname) >/dev/null 2>&1; then
if gpart list ${diskname#/dev/} >/dev/null 2>&1; then
wait_for 5 1 $GPART destroy -F $diskname
else
log_note "No GPT partitions detected on $diskname"

View File

@ -90,9 +90,7 @@ function verify_cache_device
# Zpool status returns on the device name sans the /dev, so
# if the device contains /dev/ remove it.
if [[ $device =~ "^/dev/" ]]; then
device=`basename ${device}`
fi
device=${device#"/dev/"}
if [[ $WRAPPER == *"smi"* ]]; then
$ECHO $device | $EGREP "^c[0-F]+([td][0-F]+)+$" > /dev/null 2>&1

View File

@ -55,9 +55,7 @@ function iscontained
for vdev in $@; do
# remove /dev/dsk in vdev if there is
$ECHO $vdev | $GREP "^/dev/" >/dev/null 2>&1
(( $? == 0 )) && \
vdev=${vdev##*/}
vdev=${vdev#/dev/}
$ZPOOL status "$pool" | $AWK '$1 == vdevname {exit 1}' \
vdevname=$vdev >/dev/null 2>&1