mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
ZTS: Fix zpool_create/create-o_ashift on FreeBSD
For some unknown reason, egrep was misbehaving with this pattern on FreeBSD. The command works fine run interactively from a shell, but in the test the output of egrep is empty. Work around the issue by using a filter in the awk script instead. While here, add a bit of diagnostic output and other simplifications to the awk script as well. Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #10023
This commit is contained in:
parent
392556f0ef
commit
873cd182de
@ -73,15 +73,21 @@ function verify_device_uberblocks # <device> <count>
|
|||||||
typeset device=$1
|
typeset device=$1
|
||||||
typeset ubcount=$2
|
typeset ubcount=$2
|
||||||
|
|
||||||
zdb -quuul $device | egrep '^(\s+)?Uberblock' |
|
zdb -quuul $device | awk -v ubcount=$ubcount '
|
||||||
awk -v ubcount=$ubcount 'BEGIN { count=0 } { uberblocks[$0]++; }
|
/Uberblock/ && ! /invalid/ { uberblocks[$0]++ }
|
||||||
END {
|
END {
|
||||||
|
count = 0
|
||||||
for (i in uberblocks) {
|
for (i in uberblocks) {
|
||||||
if (i ~ /invalid/) { continue; }
|
if (uberblocks[i] != 4) {
|
||||||
if (uberblocks[i] != 4) { exit 1; }
|
printf "%s count: %s != 4\n", i, uberblocks[i]
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (count != ubcount) { exit 1; }
|
if (count != ubcount) {
|
||||||
|
printf "Total uberblock count: %s != %s\n", count, ubcount
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
}'
|
}'
|
||||||
|
|
||||||
return $?
|
return $?
|
||||||
|
Loading…
Reference in New Issue
Block a user