diff options
author | наб <[email protected]> | 2022-05-28 15:19:05 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-06-29 14:08:59 -0700 |
commit | a2f6bff976e43c58d8460c288bac13868c614447 (patch) | |
tree | 1bac3779c2eb9dbf5a7f87c99168e7256e8bb896 /tests | |
parent | dd66857d92d86643bda57b92fdd58f016bd1725e (diff) |
tests: modernise zdb_decompress
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #13348
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh index f10d13fb5..dffed4890 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh @@ -81,30 +81,28 @@ log_note "block 0 of $init_data has a DVA of $dva" size_str=$(sed -Ene 's/^.+ size=([^ ]+) .*$/\1/p' <<< "$output") log_note "block size $size_str" -vdev=$(echo "$dva" | cut -d: -f1) -offset=$(echo "$dva" | cut -d: -f2) -output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:d 2> /dev/null) +IFS=: read -r vdev offset _ <<< "$dva" +output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:d) echo $output | grep -q $pattern || log_fail "zdb -R :d failed to decompress the data properly" -output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:dr 2> /dev/null) +output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:dr) echo $output | grep -q $four_k || log_fail "zdb -R :dr failed to decompress the data properly" -output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:dr 2> /dev/null) +output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:dr) result=${#output} (( $result != $blksize)) && log_fail \ "zdb -R failed to decompress the data to the length (${#output} != $size_str)" # decompress using lsize -lsize=$(echo $size_str | cut -d/ -f1) -psize=$(echo $size_str | cut -d/ -f2) -output=$(zdb -R $TESTPOOL $vdev:$offset:$lsize:dr 2> /dev/null) +IFS=/ read -r lsize psize _ <<< "$size_str" +output=$(zdb -R $TESTPOOL $vdev:$offset:$lsize:dr) result=${#output} (( $result != $blksize)) && log_fail \ "zdb -R failed to decompress the data (length ${#output} != $blksize)" # Specifying psize will decompress successfully , but not always to full # lsize since zdb has to guess lsize incrementally. -output=$(zdb -R $TESTPOOL $vdev:$offset:$psize:dr 2> /dev/null) +output=$(zdb -R $TESTPOOL $vdev:$offset:$psize:dr) result=${#output} # convert psize to decimal psize_orig=$psize |