test/common: Source *_APP from a common place

Instead of declaring each app in the actual test, source their default
declarations from a single location. Additionally, use them as arrays
now instead for easier cmdline management.

Change-Id: I0ea39403f070dc57987065ebb800e91c35de643a
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/690
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Michal Berger 2020-02-20 11:24:53 +01:00 committed by Tomasz Zawadzki
parent 6f7cb2ad58
commit b4c5509c6e
31 changed files with 69 additions and 58 deletions

View File

@ -0,0 +1,11 @@
# Default set of apps used in functional testing
_root=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
_root=${_root%/test/common}
_app_dir=$_root/app
_test_app_dir=$_root/test/app
FUZZ_APP=("$_test_app_dir/fuzz/vhost_fuzz/vhost_fuzz")
ISCSI_APP=("$_app_dir/iscsi_tgt/iscsi_tgt")
NVMF_APP=("$_app_dir/nvmf_tgt/nvmf_tgt")
VHOST_APP=("$_app_dir/vhost/vhost")

View File

@ -16,6 +16,8 @@ xtrace_disable
set -e set -e
shopt -s expand_aliases shopt -s expand_aliases
source "$rootdir/test/common/applications.sh"
# Dummy function to be called after restoring xtrace just so that it appears in the # Dummy function to be called after restoring xtrace just so that it appears in the
# xtrace log. This way we can consistently track when xtrace is enabled/disabled. # xtrace log. This way we can consistently track when xtrace is enabled/disabled.
function xtrace_enable() { function xtrace_enable() {

View File

@ -24,7 +24,7 @@ timing_enter nvmf_fuzz_test
echo "[Nvme]" > $testdir/nvmf_fuzz.conf echo "[Nvme]" > $testdir/nvmf_fuzz.conf
echo " TransportID \"trtype:$TEST_TRANSPORT adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode1 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT\" Nvme0" >> $testdir/nvmf_fuzz.conf echo " TransportID \"trtype:$TEST_TRANSPORT adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode1 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT\" Nvme0" >> $testdir/nvmf_fuzz.conf
$NVMF_APP -m 0xF &>$output_dir/nvmf_autofuzz_tgt_output.txt & "${NVMF_APP[@]}" -m 0xF &>"$output_dir/nvmf_autofuzz_tgt_output.txt" &
nvmfpid=$! nvmfpid=$!
trap 'process_shm --id $NVMF_APP_SHM_ID; rm -f $testdir/nvmf_fuzz.conf; killprocess $nvmfpid; nvmftestfini $1; exit 1' SIGINT SIGTERM EXIT trap 'process_shm --id $NVMF_APP_SHM_ID; rm -f $testdir/nvmf_fuzz.conf; killprocess $nvmfpid; nvmftestfini $1; exit 1' SIGINT SIGTERM EXIT

View File

@ -6,9 +6,9 @@ source "$rootdir/scripts/common.sh"
TEST_TIMEOUT=1200 TEST_TIMEOUT=1200
VHOST_APP="$rootdir/app/vhost/vhost -p 0" VHOST_APP+=(-p 0)
FUZZ_RPC_SOCK="/var/tmp/spdk_fuzz.sock" FUZZ_RPC_SOCK="/var/tmp/spdk_fuzz.sock"
FUZZ_APP="$rootdir/test/app/fuzz/vhost_fuzz/vhost_fuzz -r $FUZZ_RPC_SOCK --wait-for-rpc" FUZZ_APP+=(-r "$FUZZ_RPC_SOCK" --wait-for-rpc)
vhost_rpc_py="$rootdir/scripts/rpc.py" vhost_rpc_py="$rootdir/scripts/rpc.py"
fuzz_generic_rpc_py="$rootdir/scripts/rpc.py -s $FUZZ_RPC_SOCK" fuzz_generic_rpc_py="$rootdir/scripts/rpc.py -s $FUZZ_RPC_SOCK"
@ -29,13 +29,13 @@ timing_enter setup
$rootdir/scripts/setup.sh $rootdir/scripts/setup.sh
timing_exit setup timing_exit setup
$VHOST_APP &>$output_dir/vhost_fuzz_tgt_output.txt & "${VHOST_APP[@]}" &>"$output_dir/vhost_fuzz_tgt_output.txt" &
vhostpid=$! vhostpid=$!
waitforlisten $vhostpid waitforlisten $vhostpid
trap 'killprocess $vhostpid; exit 1' SIGINT SIGTERM exit trap 'killprocess $vhostpid; exit 1' SIGINT SIGTERM exit
$FUZZ_APP -t $TEST_TIMEOUT 2>$output_dir/vhost_autofuzz_output1.txt & "${FUZZ_APP[@]}" -t $TEST_TIMEOUT 2>"$output_dir/vhost_autofuzz_output1.txt" &
fuzzpid=$! fuzzpid=$!
waitforlisten $fuzzpid $FUZZ_RPC_SOCK waitforlisten $fuzzpid $FUZZ_RPC_SOCK

View File

@ -14,7 +14,7 @@ rpc_py="$rootdir/scripts/rpc.py"
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP -m 0x2 -p 1 -s 512 --wait-for-rpc & "${ISCSI_APP[@]}" -m 0x2 -p 1 -s 512 --wait-for-rpc &
pid=$! pid=$!
echo "iSCSI target launched. pid: $pid" echo "iSCSI target launched. pid: $pid"
trap 'killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT trap 'killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT

View File

@ -28,7 +28,7 @@ echo "IP=$TARGET_IP" >> /usr/local/etc/its.conf
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP -m 0x1 --wait-for-rpc & "${ISCSI_APP[@]}" -m 0x1 --wait-for-rpc &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"

View File

@ -2,7 +2,7 @@
TARGET_INTERFACE="spdk_tgt_int" TARGET_INTERFACE="spdk_tgt_int"
INITIATOR_INTERFACE="spdk_init_int" INITIATOR_INTERFACE="spdk_init_int"
TARGET_NAMESPACE="spdk_iscsi_ns" TARGET_NAMESPACE="spdk_iscsi_ns"
TARGET_NS_CMD="ip netns exec $TARGET_NAMESPACE" TARGET_NS_CMD=(ip netns exec "$TARGET_NAMESPACE")
# iSCSI target configuration # iSCSI target configuration
TARGET_IP=10.0.0.1 TARGET_IP=10.0.0.1
@ -12,9 +12,9 @@ NETMASK=$INITIATOR_IP/32
INITIATOR_TAG=2 INITIATOR_TAG=2
INITIATOR_NAME=ANY INITIATOR_NAME=ANY
PORTAL_TAG=1 PORTAL_TAG=1
ISCSI_APP="$TARGET_NS_CMD ./app/iscsi_tgt/iscsi_tgt" ISCSI_APP=("${TARGET_NS_CMD[@]}" "${ISCSI_APP[@]}")
if [ $SPDK_TEST_VPP -eq 1 ]; then if [ $SPDK_TEST_VPP -eq 1 ]; then
ISCSI_APP+=" -L sock_vpp" ISCSI_APP+=(-L sock_vpp)
fi fi
ISCSI_TEST_CORE_MASK=0xFF ISCSI_TEST_CORE_MASK=0xFF
@ -37,11 +37,11 @@ function create_veth_interfaces() {
# Accept connections from veth interface # Accept connections from veth interface
iptables -I INPUT 1 -i $INITIATOR_INTERFACE -p tcp --dport $ISCSI_PORT -j ACCEPT iptables -I INPUT 1 -i $INITIATOR_INTERFACE -p tcp --dport $ISCSI_PORT -j ACCEPT
$TARGET_NS_CMD ip link set $TARGET_INTERFACE up "${TARGET_NS_CMD[@]}" ip link set $TARGET_INTERFACE up
if [ "$1" == "posix" ]; then if [ "$1" == "posix" ]; then
$TARGET_NS_CMD ip link set lo up "${TARGET_NS_CMD[@]}" ip link set lo up
$TARGET_NS_CMD ip addr add $TARGET_IP/24 dev $TARGET_INTERFACE "${TARGET_NS_CMD[@]}" ip addr add $TARGET_IP/24 dev $TARGET_INTERFACE
# Verify connectivity # Verify connectivity
ping -c 1 $TARGET_IP ping -c 1 $TARGET_IP
@ -112,7 +112,7 @@ function start_vpp() {
ethtool -k $INITIATOR_INTERFACE ethtool -k $INITIATOR_INTERFACE
# Start VPP process in SPDK target network namespace # Start VPP process in SPDK target network namespace
$TARGET_NS_CMD vpp \ "${TARGET_NS_CMD[@]}" vpp \
unix { nodaemon cli-listen /run/vpp/cli.sock } \ unix { nodaemon cli-listen /run/vpp/cli.sock } \
dpdk { no-pci } \ dpdk { no-pci } \
session { evt_qs_memfd_seg } \ session { evt_qs_memfd_seg } \

View File

@ -53,7 +53,7 @@ fio_py="$rootdir/scripts/fio.py"
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc & "${ISCSI_APP[@]}" -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"

View File

@ -14,7 +14,7 @@ node_base="iqn.2013-06.com.intel.ch.spdk"
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP --wait-for-rpc & "${ISCSI_APP[@]}" --wait-for-rpc &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"

View File

@ -27,7 +27,7 @@ function remove_backends() {
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc & "${ISCSI_APP[@]}" -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"

View File

@ -28,7 +28,7 @@ function running_config() {
timing_enter start_iscsi_tgt2 timing_enter start_iscsi_tgt2
$ISCSI_APP --wait-for-rpc & "${ISCSI_APP[@]}" --wait-for-rpc &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"
trap 'iscsicleanup; killprocess $pid; delete_tmp_files; exit 1' SIGINT SIGTERM EXIT trap 'iscsicleanup; killprocess $pid; delete_tmp_files; exit 1' SIGINT SIGTERM EXIT
@ -62,7 +62,7 @@ fio_py="$rootdir/scripts/fio.py"
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP --wait-for-rpc & "${ISCSI_APP[@]}" --wait-for-rpc &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"

View File

@ -16,7 +16,7 @@ rpc_py="$rootdir/scripts/rpc.py"
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP -m 0x2 -p 1 -s 512 --wait-for-rpc & "${ISCSI_APP[@]}" -m 0x2 -p 1 -s 512 --wait-for-rpc &
pid=$! pid=$!
echo "iSCSI target launched. pid: $pid" echo "iSCSI target launched. pid: $pid"
trap 'killprocess $pid;exit 1' SIGINT SIGTERM EXIT trap 'killprocess $pid;exit 1' SIGINT SIGTERM EXIT

View File

@ -14,7 +14,8 @@ fio_py="$rootdir/scripts/fio.py"
# Namespaces are NOT used here on purpose. This test requires changes to detect # Namespaces are NOT used here on purpose. This test requires changes to detect
# ifc_index for interface that was put into namespace. Needed for net_interface_add_ip_address. # ifc_index for interface that was put into namespace. Needed for net_interface_add_ip_address.
ISCSI_APP="$rootdir/app/iscsi_tgt/iscsi_tgt" # Reset ISCSI_APP[] to use only the plain app for this test without TARGET_NS_CMD preset.
source "$rootdir/test/common/applications.sh"
NETMASK=127.0.0.0/24 NETMASK=127.0.0.0/24
MIGRATION_ADDRESS=127.0.0.2 MIGRATION_ADDRESS=127.0.0.2
@ -82,7 +83,7 @@ for ((i = 0; i < 2; i++)); do
rpc_addr="/var/tmp/spdk${i}.sock" rpc_addr="/var/tmp/spdk${i}.sock"
# TODO: run the different iSCSI instances on non-overlapping CPU masks # TODO: run the different iSCSI instances on non-overlapping CPU masks
$ISCSI_APP -r $rpc_addr -i $i -m $ISCSI_TEST_CORE_MASK --wait-for-rpc & "${ISCSI_APP[@]}" -r $rpc_addr -i $i -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"

View File

@ -24,7 +24,7 @@ fio_py="$rootdir/scripts/fio.py"
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc & "${ISCSI_APP[@]}" -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"

View File

@ -35,7 +35,7 @@ function remove_backends() {
} }
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP --wait-for-rpc & "${ISCSI_APP[@]}" --wait-for-rpc &
iscsipid=$! iscsipid=$!
echo "iSCSI target launched. pid: $iscsipid" echo "iSCSI target launched. pid: $iscsipid"
trap 'remove_backends; iscsicleanup; killprocess $iscsipid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT trap 'remove_backends; iscsicleanup; killprocess $iscsipid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT

View File

@ -23,8 +23,7 @@ function run_nvme_remote() {
echo "now use $1 method to run iscsi tgt." echo "now use $1 method to run iscsi tgt."
iscsi_rpc_addr="/var/tmp/spdk-iscsi.sock" iscsi_rpc_addr="/var/tmp/spdk-iscsi.sock"
ISCSI_APP="$rootdir/app/iscsi_tgt/iscsi_tgt" "${ISCSI_APP[@]}" -r "$iscsi_rpc_addr" -m 0x1 -p 0 -s 512 --wait-for-rpc &
$ISCSI_APP -r "$iscsi_rpc_addr" -m 0x1 -p 0 -s 512 --wait-for-rpc &
iscsipid=$! iscsipid=$!
echo "iSCSI target launched. pid: $iscsipid" echo "iSCSI target launched. pid: $iscsipid"
trap 'killprocess $iscsipid; iscsitestfini $1 $2; nvmftestfini; exit 1' SIGINT SIGTERM EXIT trap 'killprocess $iscsipid; iscsitestfini $1 $2; nvmftestfini; exit 1' SIGINT SIGTERM EXIT
@ -54,8 +53,7 @@ function run_nvme_remote() {
} }
# Start the NVMf target # Start the NVMf target
NVMF_APP="$rootdir/app/nvmf_tgt/nvmf_tgt" "${NVMF_APP[@]}" -m 0x2 -p 1 -s 512 --wait-for-rpc &
$NVMF_APP -m 0x2 -p 1 -s 512 --wait-for-rpc &
nvmfpid=$! nvmfpid=$!
echo "NVMf target launched. pid: $nvmfpid" echo "NVMf target launched. pid: $nvmfpid"
trap 'iscsitestfini $1 $2; nvmftestfini; exit 1' SIGINT SIGTERM EXIT trap 'iscsitestfini $1 $2; nvmftestfini; exit 1' SIGINT SIGTERM EXIT

View File

@ -16,7 +16,7 @@ rpc_py="$rootdir/scripts/rpc.py"
fio_py="$rootdir/scripts/fio.py" fio_py="$rootdir/scripts/fio.py"
timing_enter start_iscsi_target timing_enter start_iscsi_target
$ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc & "${ISCSI_APP[@]}" -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"

View File

@ -59,7 +59,7 @@ fio_py="$rootdir/scripts/fio.py"
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP & "${ISCSI_APP[@]}" &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"
trap 'killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT trap 'killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT

View File

@ -24,7 +24,7 @@ fio_py="$rootdir/scripts/fio.py"
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc & "${ISCSI_APP[@]}" -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$! pid=$!
trap 'killprocess $pid; rbd_cleanup; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT trap 'killprocess $pid; rbd_cleanup; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT

View File

@ -21,7 +21,7 @@ fi
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP --wait-for-rpc & "${ISCSI_APP[@]}" --wait-for-rpc &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"

View File

@ -23,7 +23,7 @@ rpc_config_py="$testdir/rpc_config.py"
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
$ISCSI_APP --wait-for-rpc & "${ISCSI_APP[@]}" --wait-for-rpc &
pid=$! pid=$!
echo "Process pid: $pid" echo "Process pid: $pid"

View File

@ -81,7 +81,7 @@ if [ "$TEST_TYPE" != "posix" ] && [ "$TEST_TYPE" != "vpp" ]; then
exit 1 exit 1
fi fi
HELLO_SOCK_APP="$TARGET_NS_CMD $rootdir/examples/sock/hello_world/hello_sock" HELLO_SOCK_APP="${TARGET_NS_CMD[*]} $rootdir/examples/sock/hello_world/hello_sock"
if [ $SPDK_TEST_VPP -eq 1 ]; then if [ $SPDK_TEST_VPP -eq 1 ]; then
HELLO_SOCK_APP+=" -L sock_vpp" HELLO_SOCK_APP+=" -L sock_vpp"
fi fi

View File

@ -38,7 +38,7 @@ fio_py="$rootdir/scripts/fio.py"
timing_enter start_iscsi_tgt timing_enter start_iscsi_tgt
echo "start iscsi_tgt with trace enabled" echo "start iscsi_tgt with trace enabled"
$ISCSI_APP -m 0xf --num-trace-entries $NUM_TRACE_ENTRIES --tpoint-group-mask 0xf & "${ISCSI_APP[@]}" -m 0xf --num-trace-entries $NUM_TRACE_ENTRIES --tpoint-group-mask 0xf &
iscsi_pid=$! iscsi_pid=$!
echo "Process pid: $iscsi_pid" echo "Process pid: $iscsi_pid"

View File

@ -8,14 +8,15 @@ NVMF_SERIAL=SPDK00000000000001
function build_nvmf_app_args() function build_nvmf_app_args()
{ {
if [ $SPDK_RUN_NON_ROOT -eq 1 ]; then if [ $SPDK_RUN_NON_ROOT -eq 1 ]; then
echo "sudo -u $(logname) ./app/nvmf_tgt/nvmf_tgt -i $NVMF_APP_SHM_ID -e 0xFFFF" NVMF_APP=(sudo -u "$USER" "${NVMF_APP[@]}")
NVMF_APP+=(-i "$NVMF_APP_SHM_ID" -e 0xFFFF)
else else
echo "./app/nvmf_tgt/nvmf_tgt -i $NVMF_APP_SHM_ID -e 0xFFFF" NVMF_APP+=(-i "$NVMF_APP_SHM_ID" -e 0xFFFF)
fi fi
} }
: ${NVMF_APP_SHM_ID="0"}; export NVMF_APP_SHM_ID : ${NVMF_APP_SHM_ID="0"}; export NVMF_APP_SHM_ID
: ${NVMF_APP="$(build_nvmf_app_args)"}; export NVMF_APP build_nvmf_app_args
have_pci_nics=0 have_pci_nics=0
@ -207,7 +208,7 @@ function nvmftestinit()
function nvmfappstart() function nvmfappstart()
{ {
timing_enter start_nvmf_tgt timing_enter start_nvmf_tgt
$NVMF_APP $1 & "${NVMF_APP[@]}" $1 &
nvmfpid=$! nvmfpid=$!
trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT
waitforlisten $nvmfpid waitforlisten $nvmfpid

View File

@ -17,7 +17,7 @@ fi
timing_enter start_nvmf_tgt timing_enter start_nvmf_tgt
$NVMF_APP -m 0xF & "${NVMF_APP[@]}" -m 0xF &
nvmfpid=$! nvmfpid=$!
trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT

View File

@ -14,7 +14,7 @@ nvmftestinit
timing_enter start_nvmf_tgt timing_enter start_nvmf_tgt
$NVMF_APP -m 0xF & "${NVMF_APP[@]}" -m 0xF &
nvmfpid=$! nvmfpid=$!
trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT

View File

@ -9,7 +9,7 @@ rpc_py="$rootdir/scripts/rpc.py"
nvmftestinit nvmftestinit
$NVMF_APP -m 0xF >$output_dir/nvmf_fuzz_tgt_output.txt 2>&1 & "${NVMF_APP[@]}" -m 0xF >$output_dir/nvmf_fuzz_tgt_output.txt 2>&1 &
nvmfpid=$! nvmfpid=$!
trap 'process_shm --id $NVMF_APP_SHM_ID; rm -f $testdir/nvmf_fuzz.conf; killprocess $nvmfpid; nvmftestfini $1; exit 1' SIGINT SIGTERM EXIT trap 'process_shm --id $NVMF_APP_SHM_ID; rm -f $testdir/nvmf_fuzz.conf; killprocess $nvmfpid; nvmftestfini $1; exit 1' SIGINT SIGTERM EXIT

View File

@ -26,7 +26,7 @@ timing_exit nvme_identify
timing_enter start_nvmf_tgt timing_enter start_nvmf_tgt
$NVMF_APP -m 0xF --wait-for-rpc & "${NVMF_APP[@]}" -m 0xF --wait-for-rpc &
nvmfpid=$! nvmfpid=$!
trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT

View File

@ -18,13 +18,13 @@ NVMF_SOCK="/tmp/nvmf_rpc.sock"
NVMF_RPC="$rootdir/scripts/rpc.py -s $NVMF_SOCK" NVMF_RPC="$rootdir/scripts/rpc.py -s $NVMF_SOCK"
VHOST_SOCK="/tmp/vhost_rpc.sock" VHOST_SOCK="/tmp/vhost_rpc.sock"
VHOST_APP="$rootdir/app/vhost/vhost -p 0 -r $VHOST_SOCK -u" VHOST_APP+=(-p 0 -r "$VHOST_SOCK" -u)
VHOST_RPC="$rootdir/scripts/rpc.py -s $VHOST_SOCK" VHOST_RPC="$rootdir/scripts/rpc.py -s $VHOST_SOCK"
nvmftestinit nvmftestinit
# Start Apps # Start Apps
$NVMF_APP -r $NVMF_SOCK & "${NVMF_APP[@]}" -r $NVMF_SOCK &
nvmfpid=$! nvmfpid=$!
waitforlisten $nvmfpid $NVMF_SOCK waitforlisten $nvmfpid $NVMF_SOCK
@ -32,7 +32,7 @@ trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EX
mkdir -p "$(get_vhost_dir 3)" mkdir -p "$(get_vhost_dir 3)"
$VHOST_APP -S "$(get_vhost_dir 3)" & "${VHOST_APP[@]}" -S "$(get_vhost_dir 3)" &
vhostpid=$! vhostpid=$!
waitforlisten $vhostpid $NVMF_SOCK waitforlisten $vhostpid $NVMF_SOCK

View File

@ -5,21 +5,21 @@ rootdir=$(readlink -f $(dirname $0))/../../..
source $rootdir/test/common/autotest_common.sh source $rootdir/test/common/autotest_common.sh
source "$rootdir/scripts/common.sh" source "$rootdir/scripts/common.sh"
VHOST_APP="$rootdir/app/vhost/vhost -p 0" VHOST_APP+=(-p 0)
FUZZ_RPC_SOCK="/var/tmp/spdk_fuzz.sock" FUZZ_RPC_SOCK="/var/tmp/spdk_fuzz.sock"
FUZZ_APP="$rootdir/test/app/fuzz/vhost_fuzz/vhost_fuzz -r $FUZZ_RPC_SOCK --wait-for-rpc" FUZZ_APP+=(-r "$FUZZ_RPC_SOCK" --wait-for-rpc)
vhost_rpc_py="$rootdir/scripts/rpc.py" vhost_rpc_py="$rootdir/scripts/rpc.py"
fuzz_generic_rpc_py="$rootdir/scripts/rpc.py -s $FUZZ_RPC_SOCK" fuzz_generic_rpc_py="$rootdir/scripts/rpc.py -s $FUZZ_RPC_SOCK"
fuzz_specific_rpc_py="$rootdir/test/app/fuzz/common/fuzz_rpc.py -s $FUZZ_RPC_SOCK" fuzz_specific_rpc_py="$rootdir/test/app/fuzz/common/fuzz_rpc.py -s $FUZZ_RPC_SOCK"
$VHOST_APP >$output_dir/vhost_fuzz_tgt_output.txt 2>&1 & "${VHOST_APP[@]}" >"$output_dir/vhost_fuzz_tgt_output.txt" 2>&1 &
vhostpid=$! vhostpid=$!
waitforlisten $vhostpid waitforlisten $vhostpid
trap 'killprocess $vhostpid; exit 1' SIGINT SIGTERM exit trap 'killprocess $vhostpid; exit 1' SIGINT SIGTERM exit
$FUZZ_APP -t 10 2>$output_dir/vhost_fuzz_output1.txt & "${FUZZ_APP[@]}" -t 10 2>"$output_dir/vhost_fuzz_output1.txt" &
fuzzpid=$! fuzzpid=$!
waitforlisten $fuzzpid $FUZZ_RPC_SOCK waitforlisten $fuzzpid $FUZZ_RPC_SOCK
@ -47,7 +47,7 @@ $fuzz_generic_rpc_py framework_start_init
wait $fuzzpid wait $fuzzpid
$FUZZ_APP -j $rootdir/test/app/fuzz/vhost_fuzz/example.json 2>$output_dir/vhost_fuzz_output2.txt & "${FUZZ_APP[@]}" -j "$rootdir/test/app/fuzz/vhost_fuzz/example.json" 2>"$output_dir/vhost_fuzz_output2.txt" &
fuzzpid=$! fuzzpid=$!
waitforlisten $fuzzpid $FUZZ_RPC_SOCK waitforlisten $fuzzpid $FUZZ_RPC_SOCK

View File

@ -36,30 +36,28 @@ vhosttestinit
trap error_exit ERR trap error_exit ERR
VHOST_APP="$rootdir/app/vhost/vhost"
notice "Testing vhost command line arguments" notice "Testing vhost command line arguments"
# Printing help will force vhost to exit without error # Printing help will force vhost to exit without error
$VHOST_APP -c /path/to/non_existing_file/conf -S $testdir -e 0x0 -s 1024 -d -h --silence-noticelog "${VHOST_APP[@]}" -c /path/to/non_existing_file/conf -S $testdir -e 0x0 -s 1024 -d -h --silence-noticelog
# Testing vhost create pid file option. Vhost will exit with error as invalid config path is given # Testing vhost create pid file option. Vhost will exit with error as invalid config path is given
if $VHOST_APP -c /path/to/non_existing_file/conf -f $VHOST_DIR/vhost/vhost.pid; then if "${VHOST_APP[@]}" -c /path/to/non_existing_file/conf -f "$VHOST_DIR/vhost/vhost.pid"; then
fail "vhost started when specifying invalid config file" fail "vhost started when specifying invalid config file"
fi fi
rm -f $VHOST_DIR/vhost/vhost.pid rm -f $VHOST_DIR/vhost/vhost.pid
# Testing vhost start with invalid config. Vhost will exit with error as bdev module init failed # Testing vhost start with invalid config. Vhost will exit with error as bdev module init failed
if $VHOST_APP -c $testdir/invalid.config; then if "${VHOST_APP[@]}" -c $testdir/invalid.config; then
fail "vhost started when specifying invalid config file" fail "vhost started when specifying invalid config file"
fi fi
# Expecting vhost to fail if an incorrect argument is given # Expecting vhost to fail if an incorrect argument is given
if $VHOST_APP -x -h; then if "${VHOST_APP[@]}" -x -h; then
fail "vhost started with invalid -x command line option" fail "vhost started with invalid -x command line option"
fi fi
# Passing trace flags if spdk is build without CONFIG_DEBUG=y option make vhost exit with error # Passing trace flags if spdk is build without CONFIG_DEBUG=y option make vhost exit with error
if ! $VHOST_APP -t vhost_scsi -h; then if ! "${VHOST_APP[@]}" -t vhost_scsi -h; then
warning "vhost did not started with trace flags enabled but ignoring this as it might not be a debug build" warning "vhost did not started with trace flags enabled but ignoring this as it might not be a debug build"
fi fi