tests: review every instance of $?

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-23 01:52:39 +01:00
committed by Brian Behlendorf
parent 6586085673
commit 23914a3b91
147 changed files with 560 additions and 1485 deletions
@@ -44,19 +44,13 @@
function check_zdb
{
$@ > $TEST_BASE_DIR/zdb.$$
grep "Dataset mos" $TEST_BASE_DIR/zdb.$$
if [ $? -eq 0 ]
then
log_fail "$@ exited 0 when run as a non root user!"
fi
rm $TEST_BASE_DIR/zdb.$$
log_mustnot eval "$* | grep -q 'Dataset mos'"
}
function cleanup
{
rm -f $TEST_BASE_DIR/zdb_001_neg.$$.txt $TEST_BASE_DIR/zdb.$$
rm -f $TEST_BASE_DIR/zdb_001_neg.$$.txt
}
verify_runnable "global"
@@ -66,7 +60,7 @@ log_onexit cleanup
log_must eval "zdb > $TEST_BASE_DIR/zdb_001_neg.$$.txt"
# verify the output looks okay
log_must grep pool_guid $TEST_BASE_DIR/zdb_001_neg.$$.txt
log_must grep -q pool_guid $TEST_BASE_DIR/zdb_001_neg.$$.txt
log_must rm $TEST_BASE_DIR/zdb_001_neg.$$.txt
# we shouldn't able to run it on any dataset
@@ -43,19 +43,12 @@
#
#
# check to see if we have zfs unallow
zfs 2>&1 | grep "unallow" > /dev/null
if (($? != 0)) then
log_unsupported "ZFS unallow not supported on this machine."
fi
log_assert "zfs unallow returns an error when run as a user"
log_mustnot zfs unallow everyone $TESTPOOL/$TESTFS/allowed
# now check with zfs allow to see if the permissions are still there
OUTPUT=$(zfs allow $TESTPOOL/$TESTFS/allowed | grep "Local+Descendent" )
if [ -z "$OUTPUT" ]
if ! zfs allow $TESTPOOL/$TESTFS/allowed | grep -q "Local+Descendent"
then
log_fail "Error - create permissions were unallowed on \
$TESTPOOL/$TESTFS/allowed"
@@ -66,10 +66,7 @@ cd /tmp
for path in $TESTPOOL/$TESTFS $TESTDIR ./../$TESTDIR ; do
zfs list -rH -o name $path > $tmpfile
for fs in $children ; do
grep "^${fs}$" $tmpfile > /dev/null 2>&1
if (( $? != 0 )); then
log_fail "$fs not shown in the output list."
fi
log_must grep -qxF "$fs" $tmpfile
done
done