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
@@ -92,8 +92,8 @@ typeset -i filenum=0
typeset cwd=""
log_note "Make a ufs filesystem on source $rawdisk1"
new_fs $rawdisk1 > /dev/null 2>&1
(($? != 0)) && log_untested "Unable to create ufs filesystem on $rawdisk1"
new_fs $rawdisk1 > /dev/null 2>&1 ||
log_untested "Unable to create ufs filesystem on $rawdisk1"
log_must mkdir -p $UFSMP
@@ -104,9 +104,9 @@ log_note "Now create some directories and files to be ufsdump'ed"
while (($dirnum <= 2)); do
log_must mkdir $bigdir${dirnum}
while (( $filenum <= 2 )); do
file_write -o create -f $bigdir${dirnum}/file${filenum} \
if ! file_write -o create -f $bigdir${dirnum}/file${filenum} \
-b $BLOCK_SIZE -c $BLOCK_COUNT
if [[ $? -ne 0 ]]; then
then
if [[ $dirnum -lt 3 ]]; then
log_fail "file_write only wrote" \
"<(( $dirnum * 3 + $filenum ))>" \
@@ -135,9 +135,7 @@ log_note "Attempt to take the source device in use by ufsdump as spare device"
log_mustnot zpool create $TESTPOOL1 "$FS_DISK2" spare "$disk1"
log_mustnot poolexists $TESTPOOL1
wait $PIDUFSDUMP
typeset -i retval=$?
(($retval != 0)) && log_fail "ufsdump failed with error code $ret_val"
wait $PIDUFSDUMP || log_fail "ufsdump failed with error code $?"
log_must mount $disk1 $UFSMP
@@ -52,10 +52,10 @@ function cleanup
# to work correctly. So its reproduced below. Still need to fully
# understand why default_cleanup does not work correctly from here.
#
log_must zfs umount $TESTPOOL/$TESTFS
log_must zfs umount $TESTPOOL/$TESTFS
rm -rf $TESTDIR || \
log_unresolved Could not remove $TESTDIR
rm -rf $TESTDIR ||
log_unresolved Could not remove $TESTDIR
log_must zfs destroy $TESTPOOL/$TESTFS
destroy_pool $TESTPOOL
@@ -71,21 +71,11 @@ function mini_format
if is_linux; then
parted $disk -s -- mklabel gpt
typeset -i retval=$?
elif is_freebsd; then
gpart create -s gpt $disk
typeset -i retval=$?
else
typeset format_file=$TEST_BASE_DIR/format_in.$$.1
echo "partition" > $format_file
echo "modify" >> $format_file
format -e -s -d $disk -f $format_file
typeset -i retval=$?
rm -rf $format_file
format -e -s -d $disk -f <(printf '%s\n' partition modify)
fi
return $retval
}
log_assert "format will disallow modification of a mounted zfs disk partition"\