test: Shellcheck - correct rule: Use "${var:?}"\

Correct shellcheck rule SC2115: Use "${var:?}" to
ensure this never expands to /* .

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I4a6beef338b7a3c496f1b74a0cdbbdff83403ddc
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471464
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Maciej Wawryk 2019-10-16 10:43:49 +02:00 committed by Jim Harris
parent a8dee6d1b9
commit f3b3fa7753
6 changed files with 9 additions and 9 deletions

View File

@ -63,7 +63,7 @@ echo -e "\t[mon.a]" >> "$ceph_conf"
echo -e "\tmon addr = ${mon_ip}:12046" >> "$ceph_conf"
# create mon
rm -rf ${mon_dir}/*
rm -rf "${mon_dir:?}/"*
mkdir -p ${mon_dir}
mkdir -p ${pid_dir}
rm -f /etc/ceph/ceph.client.admin.keyring

View File

@ -242,7 +242,7 @@ if hash shellcheck 2>/dev/null; then
# This SHCK_EXCLUDE list is out "to do" and we work to fix all of this errors.
SHCK_EXCLUDE="SC1083,SC2002,SC2004,\
SC2010,SC2012,SC2016,SC2034,SC2045,SC2046,SC2068,SC2086,SC2089,SC2090,\
SC2097,SC2098,SC2115,SC2119,SC2120,SC2121,SC2124,SC2126,SC2128,\
SC2097,SC2098,SC2119,SC2120,SC2121,SC2124,SC2126,SC2128,\
SC2129,SC2140,SC2142,SC2143,SC2148,SC2152,SC2153,SC2154,SC2155,\
SC2162,SC2164,SC2165,SC2166,SC2167,\
SC2230"

View File

@ -100,7 +100,7 @@ function host1_start_nvmf()
notice "Starting nvmf_tgt instance on local server"
mkdir -p $nvmf_dir
rm -rf $nvmf_dir/*
rm -rf "${nvmf_dir:?}/"*
trap 'host1_cleanup_nvmf SIGKILL; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
$rootdir/app/nvmf_tgt/nvmf_tgt -s 512 -m 0xF -r $nvmf_dir/nvmf_rpc.sock --wait-for-rpc &

View File

@ -16,7 +16,7 @@ function error()
trap - ERR
set +e
umount "$test_folder_name"
rm -rf "$testdir/$test_folder_name"
rm -rf "${testdir:?}/${test_folder_name:?}"
exit 1
}
@ -37,7 +37,7 @@ mount /dev/$disk_name"1" $test_folder_name
echo "INFO: Removing folder and unmounting $test_folder_name"
umount "$test_folder_name"
rm -rf "$testdir/$test_folder_name"
rm -rf "${testdir:?}/${test_folder_name:?}"
echo "INFO: Deleting partition"
echo -e "d\n1\nw" | fdisk /dev/$disk_name

View File

@ -16,7 +16,7 @@ function error()
trap - ERR
set +e
umount "$test_folder_name"
rm -rf "$testdir/$test_folder_name"
rm -rf "${testdir:?}/${test_folder_name:?}"
exit 1
}
@ -45,4 +45,4 @@ mount /dev/$disk_name"1" $test_folder_name
echo "INFO: Creating a test file $test_file_name"
truncate -s "200M" $test_folder_name/$test_file_name
umount "$test_folder_name"
rm -rf "$testdir/$test_folder_name"
rm -rf "${testdir:?}/${test_folder_name:?}"

View File

@ -14,7 +14,7 @@ function error()
echo -e "ERROR: $*"
echo "==========="
umount "$test_folder_name"
rm -rf "$testdir/$test_folder_name"
rm -rf "${testdir:?}/${test_folder_name:?}"
exit 1
}
@ -61,7 +61,7 @@ if ! rm $testdir/$test_file_name; then
fi
umount "$test_folder_name"
rm -rf "$testdir/$test_folder_name"
rm -rf "${testdir:?}/${test_folder_name:?}"
echo "INFO: Trying to create file system on a readonly disk"
if mkfs.ext4 -F /dev/$disk_name"1"; then
error "Created file system on a readonly disk!"