From 41b9487d2aaabbd71b2981f481d1b1cd9310ed6e Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Mon, 13 Feb 2023 11:54:24 +0100 Subject: [PATCH] test/multipath: quote any paths using {root,test}dir It fixes the test when the repository is in a directory with spaces in its name, e.g. "/foo/bar baz/spdk". Signed-off-by: Konrad Sztyber Change-Id: I07e8ce8eac50e0222c85f9ceb6088d69e02592f9 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16770 Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris Reviewed-by: Michal Berger Reviewed-by: Shuhei Matsumoto --- test/nvmf/host/multipath.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/nvmf/host/multipath.sh b/test/nvmf/host/multipath.sh index 004073f61..38361cadc 100755 --- a/test/nvmf/host/multipath.sh +++ b/test/nvmf/host/multipath.sh @@ -3,10 +3,10 @@ # Copyright (C) 2020 Intel Corporation # All rights reserved. # -testdir=$(readlink -f $(dirname $0)) -rootdir=$(readlink -f $testdir/../../..) -source $rootdir/test/common/autotest_common.sh -source $rootdir/test/nvmf/common.sh +testdir=$(readlink -f "$(dirname $0)") +rootdir=$(readlink -f "$testdir/../../..") +source "$rootdir/test/common/autotest_common.sh" +source "$rootdir/test/nvmf/common.sh" MALLOC_BDEV_SIZE=64 MALLOC_BLOCK_SIZE=512 @@ -21,8 +21,8 @@ NQN=nqn.2016-06.io.spdk:cnode1 cleanup() { process_shm --id $NVMF_APP_SHM_ID || true - cat $testdir/try.txt - rm -f $testdir/try.txt + cat "$testdir/try.txt" + rm -f "$testdir/try.txt" killprocess $bdevperf_pid nvmftestfini } @@ -40,7 +40,7 @@ $rpc_py nvmf_subsystem_add_ns $NQN Malloc0 $rpc_py nvmf_subsystem_add_listener $NQN -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT $rpc_py nvmf_subsystem_add_listener $NQN -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_SECOND_PORT -$rootdir/build/examples/bdevperf -m 0x4 -z -r $bdevperf_rpc_sock -q 128 -o 4096 -w verify -t 90 &> $testdir/try.txt & +"$rootdir/build/examples/bdevperf" -m 0x4 -z -r $bdevperf_rpc_sock -q 128 -o 4096 -w verify -t 90 &> "$testdir/try.txt" & bdevperf_pid=$! trap 'cleanup; exit 1' SIGINT SIGTERM EXIT @@ -61,19 +61,19 @@ function set_ANA_state() { # check for io on the expected ANA state port function confirm_io_on_port() { - $bpf_sh $nvmfapp_pid $rootdir/scripts/bpf/nvmf_path.bt &> $testdir/trace.txt & + $bpf_sh $nvmfapp_pid "$rootdir/scripts/bpf/nvmf_path.bt" &> "$testdir/trace.txt" & dtrace_pid=$! sleep 6 active_port=$($rpc_py nvmf_subsystem_get_listeners $NQN | jq -r '.[] | select (.ana_states[0].ana_state=="'$1'") | .address.trsvcid') - cat $testdir/trace.txt - port=$(cut < $testdir/trace.txt -d ']' -f1 | awk '$1=="@path['$NVMF_FIRST_TARGET_IP'," {print $2}' | sed -n '1p') + cat "$testdir/trace.txt" + port=$(cut < "$testdir/trace.txt" -d ']' -f1 | awk '$1=="@path['$NVMF_FIRST_TARGET_IP'," {print $2}' | sed -n '1p') [[ "$active_port" == "$port" ]] [[ "$port" == "$2" ]] kill $dtrace_pid - rm -f $testdir/trace.txt + rm -f "$testdir/trace.txt" } -$rootdir/examples/bdev/bdevperf/bdevperf.py -t 120 -s $bdevperf_rpc_sock perform_tests & +"$rootdir/examples/bdev/bdevperf/bdevperf.py" -t 120 -s $bdevperf_rpc_sock perform_tests & rpc_pid=$! sleep 1 @@ -113,7 +113,7 @@ sleep 6 confirm_io_on_port "optimized" $NVMF_SECOND_PORT wait $rpc_pid -cat $testdir/try.txt +cat "$testdir/try.txt" killprocess $bdevperf_pid @@ -121,5 +121,5 @@ $rpc_py nvmf_delete_subsystem $NQN trap - SIGINT SIGTERM EXIT -rm -f $testdir/try.txt +rm -f "$testdir/try.txt" nvmftestfini