tests: modernise zdb_decompress
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13348
This commit is contained in:
parent
dd66857d92
commit
a2f6bff976
|
@ -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")
|
size_str=$(sed -Ene 's/^.+ size=([^ ]+) .*$/\1/p' <<< "$output")
|
||||||
log_note "block size $size_str"
|
log_note "block size $size_str"
|
||||||
|
|
||||||
vdev=$(echo "$dva" | cut -d: -f1)
|
IFS=: read -r vdev offset _ <<< "$dva"
|
||||||
offset=$(echo "$dva" | cut -d: -f2)
|
output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:d)
|
||||||
output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:d 2> /dev/null)
|
|
||||||
echo $output | grep -q $pattern || log_fail "zdb -R :d failed to decompress the data properly"
|
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"
|
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=${#output}
|
||||||
(( $result != $blksize)) && log_fail \
|
(( $result != $blksize)) && log_fail \
|
||||||
"zdb -R failed to decompress the data to the length (${#output} != $size_str)"
|
"zdb -R failed to decompress the data to the length (${#output} != $size_str)"
|
||||||
|
|
||||||
# decompress using lsize
|
# decompress using lsize
|
||||||
lsize=$(echo $size_str | cut -d/ -f1)
|
IFS=/ read -r lsize psize _ <<< "$size_str"
|
||||||
psize=$(echo $size_str | cut -d/ -f2)
|
output=$(zdb -R $TESTPOOL $vdev:$offset:$lsize:dr)
|
||||||
output=$(zdb -R $TESTPOOL $vdev:$offset:$lsize:dr 2> /dev/null)
|
|
||||||
result=${#output}
|
result=${#output}
|
||||||
(( $result != $blksize)) && log_fail \
|
(( $result != $blksize)) && log_fail \
|
||||||
"zdb -R failed to decompress the data (length ${#output} != $blksize)"
|
"zdb -R failed to decompress the data (length ${#output} != $blksize)"
|
||||||
|
|
||||||
# Specifying psize will decompress successfully , but not always to full
|
# Specifying psize will decompress successfully , but not always to full
|
||||||
# lsize since zdb has to guess lsize incrementally.
|
# 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}
|
result=${#output}
|
||||||
# convert psize to decimal
|
# convert psize to decimal
|
||||||
psize_orig=$psize
|
psize_orig=$psize
|
||||||
|
|
Loading…
Reference in New Issue