test/vfio_user: add vfio-user fuzzing test
Change-Id: Ia1431a9aad103ebc80e9071b984ee152c7a27a53 Signed-off-by: Mao Jiang <maox.jiang@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9891 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
72a5fa1397
commit
1fa4d590d8
@ -32,7 +32,7 @@ if [[ $SPDK_TEST_URING -eq 0 ]]; then
|
||||
fi
|
||||
|
||||
if [ $RUN_NIGHTLY -eq 1 ]; then
|
||||
run_test "nvmf_fuzz" test/nvmf/target/fuzz.sh "${TEST_ARGS[@]}"
|
||||
run_test "nvmf_fuzz" test/nvmf/target/fabrics_fuzz.sh "${TEST_ARGS[@]}"
|
||||
run_test "nvmf_multiconnection" test/nvmf/target/multiconnection.sh "${TEST_ARGS[@]}"
|
||||
run_test "nvmf_initiator_timeout" test/nvmf/target/initiator_timeout.sh "${TEST_ARGS[@]}"
|
||||
fi
|
||||
@ -52,6 +52,7 @@ fi
|
||||
if [[ $SPDK_TEST_VFIOUSER -eq 1 && $SPDK_TEST_URING -eq 0 ]]; then
|
||||
run_test "nvmf_vfio_user" test/nvmf/target/nvmf_vfio_user.sh "${TEST_ARGS[@]}"
|
||||
run_test "nvmf_vfio_user_nvme_compliance" test/nvme/compliance/compliance.sh "${TEST_ARGS[@]}"
|
||||
run_test "nvmf_vfio_user_fuzz" test/nvmf/target/vfio_user_fuzz.sh "${TEST_ARGS[@]}"
|
||||
fi
|
||||
|
||||
if ! check_ip_is_soft_roce $NVMF_FIRST_TARGET_IP; then
|
||||
|
47
test/nvmf/target/vfio_user_fuzz.sh
Executable file
47
test/nvmf/target/vfio_user_fuzz.sh
Executable file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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
|
||||
|
||||
rpc_py="$rootdir/scripts/rpc.py"
|
||||
nqn=nqn.2021-09.io.spdk:cnode0
|
||||
traddr=/var/run/vfio-user
|
||||
|
||||
export TEST_TRANSPORT=VFIOUSER
|
||||
|
||||
rm -rf $traddr
|
||||
|
||||
# Start the target
|
||||
"${NVMF_APP[@]}" -m 0x1 > $output_dir/vfio_user_fuzz_tgt_output.txt 2>&1 &
|
||||
nvmfpid=$!
|
||||
echo "Process pid: $nvmfpid"
|
||||
|
||||
trap 'killprocess $nvmfpid; exit 1' SIGINT SIGTERM EXIT
|
||||
waitforlisten $nvmfpid
|
||||
|
||||
sleep 1
|
||||
|
||||
$rpc_py nvmf_create_transport -t $TEST_TRANSPORT
|
||||
|
||||
mkdir -p $traddr
|
||||
|
||||
$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b malloc0
|
||||
$rpc_py nvmf_create_subsystem $nqn -a -s spdk
|
||||
$rpc_py nvmf_subsystem_add_ns $nqn malloc0
|
||||
$rpc_py nvmf_subsystem_add_listener $nqn -t $TEST_TRANSPORT -a $traddr -s 0
|
||||
|
||||
trid="trtype:$TEST_TRANSPORT subnqn:$nqn traddr:$traddr"
|
||||
|
||||
$rootdir/test/app/fuzz/nvme_fuzz/nvme_fuzz -m 0x2 -r "/var/tmp/vfio_user_fuzz" -t 30 -S 123456 -F "$trid" -N -a 2> $output_dir/vfio_user_fuzz_log.txt
|
||||
$rpc_py nvmf_delete_subsystem $nqn
|
||||
|
||||
killprocess $nvmfpid
|
||||
|
||||
rm -rf $traddr
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
Loading…
Reference in New Issue
Block a user