mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 02:49:32 +03:00
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")
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user