test/fuzz: Make test timeout configurable.

We should be able to change the runtime of the application based
on command line arguments without having to update the bash scripts.

Change-Id: I9fbd8e0386d7e3c39da853a89bf4aff08cb916f0
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462791
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Seth Howell 2019-07-21 21:17:03 -07:00 committed by Darek Stojaczyk
parent a3c78e150b
commit e394fb3bed
3 changed files with 33 additions and 6 deletions

View File

@ -5,18 +5,23 @@ rootdir=$(readlink -f $testdir/../..)
source "$rootdir/test/common/autotest_common.sh"
TEST_TIMEOUT=1200
# The term transport is used a bit loosely for vhost tests.
allowed_nvme_transports=("rdma" "tcp")
allowed_vhost_transports=("scsi" "blk" "all")
bad_transport=true
config_params="--enable-asan --enable-ubsan --enable-debug --without-isal"
# This argument is used in addition to the test arguments in autotest_common.sh
# These arguments are used in addition to the test arguments in autotest_common.sh
for i in "$@"; do
case "$i" in
--module=*)
TEST_MODULE="${i#*=}"
;;
--timeout=*)
TEST_TIMEOUT="${i#*=}"
;;
esac
done
@ -55,11 +60,11 @@ timing_exit make
# supply --iso to each test module so that it can run setup.sh.
timing_enter fuzz_module
if [ "$TEST_MODULE" == "nvmf" ]; then
sudo $testdir/autofuzz_nvmf.sh --iso --transport=$TEST_TRANSPORT
sudo $testdir/autofuzz_nvmf.sh --iso --transport=$TEST_TRANSPORT --timeout=$TEST_TIMEOUT
fi
if [ "$TEST_MODULE" == "vhost" ]; then
sudo $testdir/autofuzz_vhost.sh --iso --transport=$TEST_TRANSPORT
sudo $testdir/autofuzz_vhost.sh --iso --transport=$TEST_TRANSPORT --timeout=$TEST_TIMEOUT
fi
timing_exit fuzz_module
timing_exit autofuzz

View File

@ -7,6 +7,16 @@ source $rootdir/test/nvmf/common.sh
rpc_py="$rootdir/scripts/rpc.py"
TEST_TIMEOUT=1200
# This argument is used in addition to the test arguments in autotest_common.sh
for i in "$@"; do
case "$i" in
--timeout=*)
TEST_TIMEOUT="${i#*=}"
esac
done
nvmftestinit
timing_enter nvmf_fuzz_test
@ -29,7 +39,7 @@ $rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc0
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
# Note that we chose a consistent seed to ensure that this test is consistent in nightly builds.
$rootdir/test/app/fuzz/nvme_fuzz/nvme_fuzz -m 0xF0 -r "/var/tmp/nvme_fuzz" -t 12 -C $testdir/nvmf_fuzz.conf -N -a 2>$output_dir/nvmf_autofuzz_logs.txt
$rootdir/test/app/fuzz/nvme_fuzz/nvme_fuzz -m 0xF0 -r "/var/tmp/nvme_fuzz" -t $TEST_TIMEOUT -C $testdir/nvmf_fuzz.conf -N -a 2>$output_dir/nvmf_autofuzz_logs.txt
rm -f $testdir/nvmf_fuzz.conf
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1

View File

@ -4,6 +4,8 @@ rootdir=$(readlink -f $(dirname $0))/../..
source $rootdir/test/common/autotest_common.sh
source "$rootdir/scripts/common.sh"
TEST_TIMEOUT=1200
VHOST_APP="$rootdir/app/vhost/vhost -p 0"
FUZZ_RPC_SOCK="/var/tmp/spdk_fuzz.sock"
FUZZ_APP="$rootdir/test/app/fuzz/vhost_fuzz/vhost_fuzz -r $FUZZ_RPC_SOCK --wait-for-rpc"
@ -12,6 +14,14 @@ 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"
# This argument is used in addition to the test arguments in autotest_common.sh
for i in "$@"; do
case "$i" in
--timeout=*)
TEST_TIMEOUT="${i#*=}"
esac
done
timing_enter vhost_fuzz_test
#todo refactor this to use the vhosttestinit function when it becomes available.
@ -25,7 +35,7 @@ waitforlisten $vhostpid
trap "killprocess $vhostpid; exit 1" SIGINT SIGTERM exit
$FUZZ_APP -t 1200 2>$output_dir/vhost_autofuzz_output1.txt &
$FUZZ_APP -t $TEST_TIMEOUT 2>$output_dir/vhost_autofuzz_output1.txt &
fuzzpid=$!
waitforlisten $fuzzpid $FUZZ_RPC_SOCK
@ -60,7 +70,9 @@ $fuzz_generic_rpc_py start_subsystem_init
wait $fuzzpid
trap - SIGINT SIGTERM exit
set +e
killprocess $vhostpid
echo $?
set -e
killprocess $fuzzpid
timing_exit vhost_fuzz_test