test: Shellcheck - correct rule: Use find...
Correct shellcheck rule SC2012: Use find instead of ls to better handle non-alphanumeric filenames Change-Id: Ibfc54ac06ae4cecadd22954159d259295f99912f Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475712 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
fdc82d3bc8
commit
a69df7ea94
@ -134,7 +134,7 @@ timing_enter make_uninstall
|
||||
# Create empty file to check if it is not deleted by target uninstall
|
||||
touch /tmp/spdk/usr/lib/sample_xyz.a
|
||||
$MAKE $MAKEFLAGS uninstall DESTDIR=/tmp/spdk prefix=/usr
|
||||
if [[ $(ls -A /tmp/spdk/usr | wc -l) -ne 2 ]] || [[ $(ls -A /tmp/spdk/usr/lib/ | wc -l) -ne 1 ]]; then
|
||||
if [[ $(find /tmp/spdk/usr -maxdepth 1 -mindepth 1 | wc -l) -ne 2 ]] || [[ $(find /tmp/spdk/usr/lib/ -maxdepth 1 -mindepth 1 | wc -l) -ne 1 ]]; then
|
||||
ls -lR /tmp/spdk
|
||||
rm -rf /tmp/spdk
|
||||
echo "Make uninstall failed"
|
||||
|
@ -241,7 +241,7 @@ if hash shellcheck 2>/dev/null; then
|
||||
# Error descriptions can also be found at: https://github.com/koalaman/shellcheck/wiki
|
||||
# This SHCK_EXCLUDE list is out "to do" and we work to fix all of this errors.
|
||||
SHCK_EXCLUDE="SC1083,SC2002,\
|
||||
SC2010,SC2012,SC2016,SC2034,SC2045,SC2046,SC2086,SC2089,SC2090,\
|
||||
SC2010,SC2016,SC2034,SC2045,SC2046,SC2086,SC2089,SC2090,\
|
||||
SC2097,SC2098,SC2119,SC2120"
|
||||
# SPDK fails some error checks which have been deprecated in later versions of shellcheck.
|
||||
# We will not try to fix these error checks, but instead just leave the error types here
|
||||
|
@ -96,7 +96,7 @@ function cleanup_split_cfg()
|
||||
function cleanup_parted_config()
|
||||
{
|
||||
local disks
|
||||
disks=$(ls /dev/nvme*n1 | sort --version-sort)
|
||||
disks=$(find /dev/ -maxdepth 1 -name 'nvme*n1' | sort --version-sort)
|
||||
for disk in $disks; do
|
||||
parted -s $disk rm 1
|
||||
done
|
||||
@ -226,7 +226,7 @@ if [[ "$ctrl_type" == "kernel_vhost" ]]; then
|
||||
# Prepare kernel vhost configuration
|
||||
# Below grep: match only NVMe partitions which are not "Extended" type.
|
||||
# For example: will match nvme0n1p15 but not nvme0n1p1
|
||||
partitions=$(ls -1 /dev/nvme* | sort --version-sort | grep -P 'p(?!1$)\d+')
|
||||
partitions=$(find /dev/ -maxdepth 1 -name 'nvme*' | sort --version-sort | grep -P 'p(?!1$)\d+')
|
||||
backstores=()
|
||||
|
||||
# Create block backstores for vhost kernel process
|
||||
|
Loading…
Reference in New Issue
Block a user