From 6f481612f37a4cffaff142b80f6a4c37257406c6 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Wed, 15 Jan 2020 12:27:22 -0500 Subject: [PATCH] ZTS: Avoid using PCRE with grep in zdb tests On FreeBSD grep does not support Perl extensions Reviewed-by: John Kennedy Reviewed-by: Kjeld Schouten Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #9841 --- .../zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh | 4 ++-- .../tests/functional/cli_root/zdb/zdb_decompress.ksh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh index 9bc3603d46..7e484ca478 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh @@ -53,9 +53,9 @@ log_note "file $init_data has object number $obj" output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \ |grep -m 1 "L0 DVA" |head -n1) -dva=$(grep -oP 'DVA\[0\]=<\K.*?(?=>)' <<< "$output") +dva=$(sed -Ene 's/^.+DVA\[0\]=<(.+)>.*$/\1/p' <<< "$output") log_note "block 0 of $init_data has a DVA of $dva" -cksum_expected=$(grep -oP '(?<=cksum=)[ A-Za-z0-9:]*' <<< "$output") +cksum_expected=$(sed -Ene 's/^.+ cksum=([a-z0-9:]+)$/\1/p' <<< "$output") log_note "expecting cksum $cksum_expected" output=$(zdb -R $TESTPOOL $dva:c 2> /dev/null) result=$(grep $cksum_expected <<< "$output") diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh index 0e468d7c98..2777cfc20e 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh @@ -74,11 +74,11 @@ log_note "file $init_data has object number $obj" output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \ |grep -m 1 "L0 DVA" |head -n1) -dva=$(grep -oP 'DVA\[0\]=<\K.*?(?=>)' <<< "$output") +dva=$(sed -Ene 's/^.+DVA\[0\]=<(.+)>.*$/\1/p' <<< "$output") log_note "block 0 of $init_data has a DVA of $dva" # use the length reported by zdb -ddddddbbbbbb -size_str=$(grep -oP 'size=\K.*?(?= )' <<< "$output") +size_str=$(sed -Ene 's/^.+ size=([^ ]+) .*$/\1/p' <<< "$output") log_note "block size $size_str" vdev=$(echo "$dva" |awk '{split($0,array,":")} END{print array[1]}')