xref: /spdk/test/nvmf/target/fabrics_fuzz.sh (revision 7640e3fc9f22ca14c20c87930b6d6108a10f2f0c)
1#!/usr/bin/env bash
2#  SPDX-License-Identifier: BSD-3-Clause
3#  Copyright (C) 2018 Intel Corporation
4#  All rights reserved.
5#
6testdir=$(readlink -f $(dirname $0))
7rootdir=$(readlink -f $testdir/../../..)
8source $rootdir/test/common/autotest_common.sh
9source $rootdir/test/nvmf/common.sh
10
11nvmftestinit
12
13"${NVMF_APP[@]}" -m 0x1 > $output_dir/nvmf_fuzz_tgt_output.txt 2>&1 &
14nvmfpid=$!
15
16trap 'process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; nvmftestfini $1; exit 1' SIGINT SIGTERM EXIT
17
18waitforlisten $nvmfpid
19$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
20
21$rpc_py bdev_malloc_create -b Malloc0 64 512
22
23$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
24$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc0
25$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
26
27trid="trtype:$TEST_TRANSPORT adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode1 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT"
28
29# Note that we chose a consistent seed to ensure that this test is consistent in nightly builds.
30$rootdir/test/app/fuzz/nvme_fuzz/nvme_fuzz -m 0x2 -t 30 -S 123456 -F "$trid" -N -a 2> $output_dir/nvmf_fuzz_logs1.txt
31# We don't specify a seed for this test. Instead we run a static list of commands from example.json.
32$rootdir/test/app/fuzz/nvme_fuzz/nvme_fuzz -m 0x2 -F "$trid" -j $rootdir/test/app/fuzz/nvme_fuzz/example.json -a 2> $output_dir/nvmf_fuzz_logs2.txt
33
34$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1
35
36trap - SIGINT SIGTERM EXIT
37
38nvmftestfini
39rm "$output_dir/"nvmf_fuzz_logs*.txt
40