tests: review every awk(1) invocation

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13259
This commit is contained in:
наб
2022-03-11 23:54:08 +01:00
committed by Brian Behlendorf
parent 72f3516094
commit 75746e9a40
132 changed files with 402 additions and 762 deletions
@@ -55,6 +55,6 @@ TEMPFILE="$TEST_BASE_DIR/zfs_001_neg.$$.txt"
zfs > $TEMPFILE 2>&1
log_must grep "usage: zfs command args" "$TEMPFILE"
log_must eval "awk '{if (length(\$0) > 80) exit 1}' < $TEMPFILE"
log_must awk '{if (length($0) > 80) exit 1}' $TEMPFILE
log_pass "zfs shows a usage message when run as a user"
@@ -59,6 +59,6 @@ log_assert "zpool shows a usage message when run as a user"
eval "zpool > $TEMPFILE 2>&1"
log_must grep "usage: zpool command args" "$TEMPFILE"
log_must eval "awk '{if (length(\$0) > 80) exit 1}' < $TEMPFILE"
log_must awk '{if (length($0) > 80) exit 1}' $TEMPFILE
log_pass "zpool shows a usage message when run as a user"
@@ -54,12 +54,12 @@ while [[ $i -lt ${#args[*]} ]]
do
PROP=${props[$i]}
EXPECTED=${prop_vals[$i]}
ACTUAL=$( zpool get $PROP $TESTPOOL | grep $PROP | awk '{print $1}' )
ACTUAL=$( zpool get $PROP $TESTPOOL | awk -v p=$PROP '$0 ~ p {print $1}' )
if [ "$ACTUAL" != "$EXPECTED" ]
then
log_fail "Property $PROP value was $ACTUAL, expected $EXPECTED"
fi
i=$(( $i + 1 ))
i=$(( $i + 1 ))
done
log_must zpool get all $TESTPOOL
@@ -59,7 +59,7 @@ do
log_mustnot $POOL set $PROP=$NEW $TESTPOOL
# Now verify that the above command did nothing
ACTUAL=$( zpool get $PROP $TESTPOOL | grep $PROP | awk '{print $1}' )
ACTUAL=$( zpool get $PROP $TESTPOOL | awk -v p=$PROP '$0 ~ p {print $1}' )
if [ "$ACTUAL" != "$EXPECTED" ]
then
log_fail "Property $PROP was set to $ACTUAL, expected $EXPECTED"
@@ -120,7 +120,7 @@ function verify_reverse_sort { # command list name
function is_fs_type_zfs {
typeset dirname=$1
typeset fs="$(df $dirname | tail -1 | awk '{print $NF}')"
typeset fs="$(df $dirname | awk 'END {print $NF}')"
if is_freebsd; then
fs_type=$(mount | awk -v fs=$fs '{if ($3 == fs) print $4}' \