test/vhost: Make sure $disk_map exists

Also, simplify the way how it's read. As a benefit, this gets rid of
the xargs complaining about a NUL being sent out to its input which
was quite verbose.

Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: Iaeb09298c2255404273bb3fc6910bc6b93c2d7eb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16892
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Michal Berger 2023-02-21 09:36:54 +01:00 committed by David Ko
parent 276a5f1d45
commit 182ed72f35

View File

@ -239,7 +239,7 @@ fi
trap 'error_exit "${FUNCNAME}" "${LINENO}"' INT ERR
if [[ -z $disk_map ]]; then
if [[ ! -f $disk_map ]]; then
fail "No disk map provided for test. Exiting."
fi
@ -268,27 +268,19 @@ if [[ $run_precondition == true ]]; then
--iodepth=32 --filename="${fio_filename}" || true
fi
set +x
readarray disk_cfg < $disk_map
for line in "${disk_cfg[@]}"; do
echo $line
[[ $line == "#"* ]] && continue
IFS=","
s=($line)
disk_cfg_bdfs+=(${s[0]})
disk_cfg_spdk_names+=(${s[1]})
disk_cfg_splits+=(${s[2]})
disk_cfg_vms+=("${s[3]}")
while IFS="," read -r bdf spdk_name split vms; do
[[ $bdf == "#"* ]] && continue
disk_cfg_bdfs+=("$bdf")
disk_cfg_spdk_names+=("$spdk_name")
disk_cfg_splits+=("$split")
disk_cfg_vms+=("$vms")
# Find kernel nvme names
if [[ "$ctrl_type" == "kernel_vhost" ]]; then
tmp=$(find /sys/devices/pci* -name ${s[0]} -print0 | xargs sh -c 'ls $0/nvme')
disk_cfg_kernel_names+=($tmp)
IFS=" "
disk_cfg_kernel_names+=("/sys/bus/pci/devices/$bdf/nvme/nvme"*)
fi
done
unset IFS
set -x
done < "$disk_map"
disk_cfg_kernel_names=("${disk_cfg_kernel_names[@]##*/}")
if [[ "$ctrl_type" == "kernel_vhost" ]]; then
notice "Configuring kernel vhost..."