xref: /spdk/test/fuzz/autofuzz_nvmf.sh (revision 18c8b52afa69f39481ebb75711b2f30b11693f9d)
1#!/usr/bin/env bash
2
3testdir=$(readlink -f $(dirname $0))
4rootdir=$(readlink -f $testdir/../..)
5source $rootdir/test/common/autotest_common.sh
6source $rootdir/test/nvmf/common.sh
7
8TEST_TIMEOUT=1200
9
10# This argument is used in addition to the test arguments in autotest_common.sh
11for i in "$@"; do
12	case "$i" in
13		--timeout=*)
14			TEST_TIMEOUT="${i#*=}"
15			;;
16	esac
17done
18
19nvmftestinit
20
21timing_enter nvmf_fuzz_test
22
23trid="trtype:$TEST_TRANSPORT adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode1 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT"
24
25"${NVMF_APP[@]}" -m 0xF &> "$output_dir/nvmf_autofuzz_tgt_output.txt" &
26nvmfpid=$!
27
28trap 'process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; nvmftestfini $1; exit 1' SIGINT SIGTERM EXIT
29
30waitforlisten $nvmfpid
31$rpc_py nvmf_create_transport -t $TEST_TRANSPORT -u 8192
32
33$rpc_py bdev_malloc_create -b Malloc0 64 512
34
35$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
36$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc0
37$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
38
39# Note that we chose a consistent seed to ensure that this test is consistent in nightly builds.
40$rootdir/test/app/fuzz/nvme_fuzz/nvme_fuzz -m 0xF0 -r "/var/tmp/nvme_fuzz" -t $TEST_TIMEOUT -F "$trid" -N -a 2> $output_dir/nvmf_autofuzz_logs.txt
41
42$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1
43
44trap - SIGINT SIGTERM EXIT
45
46nvmfcleanup
47nvmftestfini
48timing_exit nvmf_fuzz_test
49