From 182ed72f357022a3b86696c3a56b1012c36ba57d Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Tue, 21 Feb 2023 09:36:54 +0100 Subject: [PATCH] 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 Change-Id: Iaeb09298c2255404273bb3fc6910bc6b93c2d7eb Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16892 Reviewed-by: Karol Latecki Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- test/vhost/perf_bench/vhost_perf.sh | 30 +++++++++++------------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/test/vhost/perf_bench/vhost_perf.sh b/test/vhost/perf_bench/vhost_perf.sh index 0b1ceeb8a..18364c5a3 100755 --- a/test/vhost/perf_bench/vhost_perf.sh +++ b/test/vhost/perf_bench/vhost_perf.sh @@ -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..."