2019-05-15 22:49:30 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rootdir=$(readlink -f $(dirname $0))/../../..
|
|
|
|
source $rootdir/test/common/autotest_common.sh
|
|
|
|
source "$rootdir/scripts/common.sh"
|
|
|
|
|
2020-02-20 10:24:53 +00:00
|
|
|
VHOST_APP+=(-p 0)
|
2019-05-15 22:49:30 +00:00
|
|
|
FUZZ_RPC_SOCK="/var/tmp/spdk_fuzz.sock"
|
2020-03-05 06:55:42 +00:00
|
|
|
VHOST_FUZZ_APP+=(-r "$FUZZ_RPC_SOCK" -g --wait-for-rpc)
|
2019-05-15 22:49:30 +00:00
|
|
|
|
|
|
|
vhost_rpc_py="$rootdir/scripts/rpc.py"
|
|
|
|
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"
|
|
|
|
|
2020-02-20 10:24:53 +00:00
|
|
|
"${VHOST_APP[@]}" >"$output_dir/vhost_fuzz_tgt_output.txt" 2>&1 &
|
2019-05-15 22:49:30 +00:00
|
|
|
vhostpid=$!
|
|
|
|
waitforlisten $vhostpid
|
|
|
|
|
2019-08-09 08:46:01 +00:00
|
|
|
trap 'killprocess $vhostpid; exit 1' SIGINT SIGTERM exit
|
2019-05-15 22:49:30 +00:00
|
|
|
|
2020-02-21 08:22:58 +00:00
|
|
|
"${VHOST_FUZZ_APP[@]}" -t 10 2>"$output_dir/vhost_fuzz_output1.txt" &
|
2019-05-15 22:49:30 +00:00
|
|
|
fuzzpid=$!
|
|
|
|
waitforlisten $fuzzpid $FUZZ_RPC_SOCK
|
|
|
|
|
2019-08-09 08:46:01 +00:00
|
|
|
trap 'killprocess $vhostpid; killprocess $fuzzpid; exit 1' SIGINT SIGTERM exit
|
2019-05-15 22:49:30 +00:00
|
|
|
|
2019-08-09 11:15:35 +00:00
|
|
|
$vhost_rpc_py bdev_malloc_create -b Malloc0 64 512
|
2019-09-30 10:51:55 +00:00
|
|
|
$vhost_rpc_py vhost_create_blk_controller Vhost.1 Malloc0
|
2019-05-15 22:49:30 +00:00
|
|
|
|
2019-08-09 11:15:35 +00:00
|
|
|
$vhost_rpc_py bdev_malloc_create -b Malloc1 64 512
|
2019-09-24 14:29:10 +00:00
|
|
|
$vhost_rpc_py vhost_create_scsi_controller naa.VhostScsi0.1
|
2019-09-27 20:53:41 +00:00
|
|
|
$vhost_rpc_py vhost_scsi_controller_add_target naa.VhostScsi0.1 0 Malloc1
|
2019-05-15 22:49:30 +00:00
|
|
|
|
2019-08-09 11:15:35 +00:00
|
|
|
$vhost_rpc_py bdev_malloc_create -b Malloc2 64 512
|
2019-09-24 14:29:10 +00:00
|
|
|
$vhost_rpc_py vhost_create_scsi_controller naa.VhostScsi0.2
|
2019-09-27 20:53:41 +00:00
|
|
|
$vhost_rpc_py vhost_scsi_controller_add_target naa.VhostScsi0.2 0 Malloc2
|
2019-05-15 22:49:30 +00:00
|
|
|
|
|
|
|
# test the vhost blk controller with valid data buffers.
|
2019-07-31 14:04:56 +00:00
|
|
|
$fuzz_specific_rpc_py fuzz_vhost_create_dev -s $(pwd)/Vhost.1 -b -v
|
2019-05-15 22:49:30 +00:00
|
|
|
# test the vhost scsi I/O queue with valid data buffers on a valid lun.
|
2019-07-31 14:04:56 +00:00
|
|
|
$fuzz_specific_rpc_py fuzz_vhost_create_dev -s $(pwd)/naa.VhostScsi0.1 -l -v
|
2019-05-15 22:49:30 +00:00
|
|
|
# test the vhost scsi management queue with valid data buffers.
|
2019-07-31 14:04:56 +00:00
|
|
|
$fuzz_specific_rpc_py fuzz_vhost_create_dev -s $(pwd)/naa.VhostScsi0.2 -v -m
|
2019-05-15 22:49:30 +00:00
|
|
|
# The test won't actually begin until this option is passed in.
|
2019-09-11 13:30:14 +00:00
|
|
|
$fuzz_generic_rpc_py framework_start_init
|
2019-05-15 22:49:30 +00:00
|
|
|
|
|
|
|
wait $fuzzpid
|
|
|
|
|
2020-02-21 08:22:58 +00:00
|
|
|
"${VHOST_FUZZ_APP[@]}" -j "$rootdir/test/app/fuzz/vhost_fuzz/example.json" 2>"$output_dir/vhost_fuzz_output2.txt" &
|
2019-05-15 22:49:30 +00:00
|
|
|
fuzzpid=$!
|
|
|
|
waitforlisten $fuzzpid $FUZZ_RPC_SOCK
|
|
|
|
|
|
|
|
# re-evaluate fuzzpid
|
2019-08-09 08:46:01 +00:00
|
|
|
trap 'killprocess $vhostpid; killprocess $fuzzpid; exit 1' SIGINT SIGTERM exit
|
2019-05-15 22:49:30 +00:00
|
|
|
|
2019-07-31 14:04:56 +00:00
|
|
|
$fuzz_specific_rpc_py fuzz_vhost_create_dev -s $(pwd)/Vhost.1 -b -v
|
|
|
|
$fuzz_specific_rpc_py fuzz_vhost_create_dev -s $(pwd)/naa.VhostScsi0.1 -l -v
|
|
|
|
$fuzz_specific_rpc_py fuzz_vhost_create_dev -s $(pwd)/naa.VhostScsi0.2 -v -m
|
2019-09-11 13:30:14 +00:00
|
|
|
$fuzz_generic_rpc_py framework_start_init
|
2019-05-15 22:49:30 +00:00
|
|
|
|
|
|
|
wait $fuzzpid
|
|
|
|
|
|
|
|
trap - SIGINT SIGTERM exit
|
|
|
|
|
|
|
|
killprocess $vhostpid
|