1#!/usr/bin/env bash 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright (C) 2021 Intel Corporation 4# All rights reserved. 5# 6 7testdir=$(readlink -f $(dirname $0)) 8rootdir=$(readlink -f $testdir/../../..) 9source $rootdir/test/common/autotest_common.sh 10source $rootdir/test/nvmf/common.sh 11 12MALLOC_BDEV_SIZE=64 13MALLOC_BLOCK_SIZE=512 14 15nqn=nqn.2021-09.io.spdk:cnode0 16traddr=/var/run/vfio-user 17 18export TEST_TRANSPORT=VFIOUSER 19 20rm -rf $traddr 21 22# Start the target 23"${NVMF_APP[@]}" -m 0x1 > $output_dir/vfio_user_fuzz_tgt_output.txt 2>&1 & 24nvmfpid=$! 25echo "Process pid: $nvmfpid" 26 27trap 'killprocess $nvmfpid; exit 1' SIGINT SIGTERM EXIT 28waitforlisten $nvmfpid 29 30sleep 1 31 32$rpc_py nvmf_create_transport -t $TEST_TRANSPORT 33 34mkdir -p $traddr 35 36$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b malloc0 37$rpc_py nvmf_create_subsystem $nqn -a -s spdk 38$rpc_py nvmf_subsystem_add_ns $nqn malloc0 39$rpc_py nvmf_subsystem_add_listener $nqn -t $TEST_TRANSPORT -a $traddr -s 0 40 41trid="trtype:$TEST_TRANSPORT subnqn:$nqn traddr:$traddr" 42 43$rootdir/test/app/fuzz/nvme_fuzz/nvme_fuzz -m 0x2 -t 30 -S 123456 -F "$trid" -N -a 2> $output_dir/vfio_user_fuzz_log.txt 44$rpc_py nvmf_delete_subsystem $nqn 45 46killprocess $nvmfpid 47 48rm -rf $traddr "$output_dir/"vfio_user_fuzz_*.txt 49 50trap - SIGINT SIGTERM EXIT 51