diff options
author | Ryan Moeller <[email protected]> | 2020-02-19 13:27:23 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-19 10:27:23 -0800 |
commit | 873cd182de5ff49cdad26381665d21543036a051 (patch) | |
tree | 33a4acf357f1f8e07dce2f6620f3f88d95ec6785 /tests/zfs-tests | |
parent | 392556f0efa0129c51b08378b2e52b6667424a56 (diff) |
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 <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #10023
Diffstat (limited to 'tests/zfs-tests')
-rwxr-xr-x | tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh index 09ae78763..21aae2d0e 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh @@ -73,15 +73,21 @@ function verify_device_uberblocks # <device> <count> typeset device=$1 typeset ubcount=$2 - zdb -quuul $device | egrep '^(\s+)?Uberblock' | - awk -v ubcount=$ubcount 'BEGIN { count=0 } { uberblocks[$0]++; } + zdb -quuul $device | awk -v ubcount=$ubcount ' + /Uberblock/ && ! /invalid/ { uberblocks[$0]++ } END { + count = 0 for (i in uberblocks) { - if (i ~ /invalid/) { continue; } - if (uberblocks[i] != 4) { exit 1; } + if (uberblocks[i] != 4) { + printf "%s count: %s != 4\n", i, uberblocks[i] + exit 1 + } count++; } - if (count != ubcount) { exit 1; } + if (count != ubcount) { + printf "Total uberblock count: %s != %s\n", count, ubcount + exit 1 + } }' return $? |