ZTS: Make DVA pattern in zdb tests more robust

Ensure the capture ends at the first DVA in case there are multiple
DVAs on the same line by only capturing up to the first '>' character.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9851
This commit is contained in:
Ryan Moeller 2020-01-17 15:41:03 -05:00 committed by Brian Behlendorf
parent 70835c5b75
commit 914bd02f29
2 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@ log_note "file $init_data has object number $obj"
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \ output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
|grep -m 1 "L0 DVA" |head -n1) |grep -m 1 "L0 DVA" |head -n1)
dva=$(sed -Ene 's/^.+DVA\[0\]=<(.+)>.*$/\1/p' <<< "$output") dva=$(sed -Ene 's/^.+DVA\[0\]=<([^>]+)>.*$/\1/p' <<< "$output")
log_note "block 0 of $init_data has a DVA of $dva" log_note "block 0 of $init_data has a DVA of $dva"
cksum_expected=$(sed -Ene 's/^.+ cksum=([a-z0-9:]+)$/\1/p' <<< "$output") cksum_expected=$(sed -Ene 's/^.+ cksum=([a-z0-9:]+)$/\1/p' <<< "$output")
log_note "expecting cksum $cksum_expected" log_note "expecting cksum $cksum_expected"

View File

@ -74,7 +74,7 @@ log_note "file $init_data has object number $obj"
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \ output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
|grep -m 1 "L0 DVA" |head -n1) |grep -m 1 "L0 DVA" |head -n1)
dva=$(sed -Ene 's/^.+DVA\[0\]=<(.+)>.*$/\1/p' <<< "$output") dva=$(sed -Ene 's/^.+DVA\[0\]=<([^>]+)>.*$/\1/p' <<< "$output")
log_note "block 0 of $init_data has a DVA of $dva" log_note "block 0 of $init_data has a DVA of $dva"
# use the length reported by zdb -ddddddbbbbbb # use the length reported by zdb -ddddddbbbbbb