aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2020-01-15 12:27:22 -0500
committerBrian Behlendorf <[email protected]>2020-01-15 09:27:22 -0800
commit6f481612f37a4cffaff142b80f6a4c37257406c6 (patch)
tree2724777e52609639cb81dd5007fb47c0760e2631
parent83c30248efb1ce1d6f0c5de222159322ac2b9203 (diff)
ZTS: Avoid using PCRE with grep in zdb tests
On FreeBSD grep does not support Perl extensions Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Kjeld Schouten <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #9841
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh4
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh4
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 9bc3603d4..7e484ca47 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 0e468d7c9..2777cfc20 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]}')