From a2f6bff976e43c58d8460c288bac13868c614447 Mon Sep 17 00:00:00 2001 From: наб Date: Sat, 28 May 2022 15:19:05 +0200 Subject: tests: modernise zdb_decompress MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13348 --- .../tests/functional/cli_root/zdb/zdb_decompress.ksh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3