diff options
author | Paul Zuchowski <[email protected]> | 2018-03-07 20:03:33 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-03-07 17:03:33 -0800 |
commit | 8e5d14844d2f22997b3a41d8e2357e8f30c5d5dd (patch) | |
tree | f6435948dbb50287f614279d49a32736ae9b1db7 /tests/zfs-tests/include/libtest.shlib | |
parent | 0e85048f53e46f30f26540fe3f6ae755d4d52ad1 (diff) |
zdb and inuse tests don't pass with real disks
Due to zpool create auto-partioning in Linux (i.e. sdb1),
certain utilities need to use the parition (sdb1) while
others use the whole disk name (sdb).
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Zuchowski <[email protected]>
Closes #6939
Closes #7261
Diffstat (limited to 'tests/zfs-tests/include/libtest.shlib')
-rw-r--r-- | tests/zfs-tests/include/libtest.shlib | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 464b59d3f..3a310680b 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -806,7 +806,11 @@ function zero_partitions #<whole_disk_name> typeset i if is_linux; then - log_must parted $DEV_DSKDIR/$diskname -s -- mklabel gpt + DSK=$DEV_DSKDIR/$diskname + DSK=$(echo $DSK | sed -e "s|//|/|g") + log_must parted $DSK -s -- mklabel gpt + blockdev --rereadpt $DSK 2>/dev/null + block_device_wait else for i in 0 1 3 4 5 6 7 do @@ -834,10 +838,11 @@ function set_partition #<slice_num> <slice_start> <size_plus_units> <whole_disk typeset start=$2 typeset size=$3 typeset disk=$4 - [[ -z $slicenum || -z $size || -z $disk ]] && \ - log_fail "The slice, size or disk name is unspecified." if is_linux; then + if [[ -z $size || -z $disk ]]; then + log_fail "The size or disk name is unspecified." + fi typeset size_mb=${size%%[mMgG]} size_mb=${size_mb%%[mMgG][bB]} @@ -880,6 +885,10 @@ function set_partition #<slice_num> <slice_start> <size_plus_units> <whole_disk blockdev --rereadpt $DEV_DSKDIR/$disk 2>/dev/null block_device_wait else + if [[ -z $slicenum || -z $size || -z $disk ]]; then + log_fail "The slice, size or disk name is unspecified." + fi + typeset format_file=/var/tmp/format_in.$$ echo "partition" >$format_file |