autotest: Move the llvm_nvme_fuzz to test/fuzz

Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: I2ccdd807a6585dd7b24c01f3880df721147b1c71
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14555
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Michal Berger 2022-09-19 13:13:40 +02:00 committed by Tomasz Zawadzki
parent 6f445382a8
commit f72f154719
7 changed files with 52 additions and 9 deletions

View File

@ -344,13 +344,7 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
fi fi
if [[ $SPDK_TEST_FUZZER -eq 1 ]]; then if [[ $SPDK_TEST_FUZZER -eq 1 ]]; then
# TODO: Consider re-using test/fuzz directory for all fuzzing tests with proper run_test "llvm_fuzz" test/fuzz/llvm.sh
# structure, e.g.: test/fuzz/nvmf/*, test/fuzz/vfio/*, etc.
if [[ $SPDK_TEST_VFIOUSER -eq 1 ]]; then
run_test "nvmf_vfio_llvm_fuzz" test/nvmf/target/llvm_vfio_fuzz.sh
else
run_test "nvmf_llvm_fuzz" test/nvmf/target/llvm_nvme_fuzz.sh
fi
fi fi
if [[ $SPDK_TEST_RAID5 -eq 1 ]]; then if [[ $SPDK_TEST_RAID5 -eq 1 ]]; then

View File

@ -171,6 +171,9 @@ export SPDK_TEST_SMA
export SPDK_TEST_DAOS export SPDK_TEST_DAOS
: ${SPDK_TEST_XNVME:=0} : ${SPDK_TEST_XNVME:=0}
export SPDK_TEST_XNVME export SPDK_TEST_XNVME
# Comma-separated list of fuzzer targets matching test/fuzz/llvm/$target
: ${SPDK_TEST_FUZZER_TARGET:=}
export SPDK_TEST_FUZZER_TARGET
# always test with SPDK shared objects. # always test with SPDK shared objects.
export SPDK_LIB_DIR="$rootdir/build/lib" export SPDK_LIB_DIR="$rootdir/build/lib"
@ -504,10 +507,42 @@ function get_config_params() {
config_params+=' --with-xnvme' config_params+=' --with-xnvme'
fi fi
if [[ $SPDK_TEST_FUZZER -eq 1 ]]; then
config_params+=" $(get_fuzzer_target_config)"
fi
echo "$config_params" echo "$config_params"
xtrace_restore xtrace_restore
} }
function get_fuzzer_target_config() {
local -A fuzzer_targets_to_config=()
local config target
fuzzer_targets_to_config["vfio"]="--with-vfio-user"
for target in $(get_fuzzer_targets); do
[[ -n ${fuzzer_targets_to_config["$target"]} ]] || continue
config+=("${fuzzer_targets_to_config["$target"]}")
done
if ((${#config[@]} > 0)); then
echo "${config[*]}"
fi
}
function get_fuzzer_targets() {
local fuzzers=()
if [[ -n $SPDK_TEST_FUZZER_TARGET ]]; then
IFS="," read -ra fuzzers <<< "$SPDK_TEST_FUZZER_TARGET"
else
fuzzers=("$rootdir/test/fuzz/llvm/"*)
fuzzers=("${fuzzers[@]##*/}")
fi
echo "${fuzzers[*]}"
}
function rpc_cmd() { function rpc_cmd() {
xtrace_disable xtrace_disable
local rsp rc=1 local rsp rc=1

14
test/fuzz/llvm.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
testdir=$(readlink -f "$(dirname "$0")")
rootdir=$(readlink -f "$testdir/../../")
source "$rootdir/test/common/autotest_common.sh"
fuzzers=($(get_fuzzer_targets))
for fuzzer in "${fuzzers[@]}"; do
case "$fuzzer" in
nvmf) run_test "nvmf_fuzz" "$testdir/llvm/$fuzzer/run.sh" ;;
vfio) run_test "vfio_fuzz" "$testdir/llvm/$fuzzer/run.sh" ;;
esac
done

View File

@ -44,7 +44,7 @@ function run_fuzz() {
} }
testdir=$(readlink -f $(dirname $0)) testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..) rootdir=$(readlink -f $testdir/../../../../)
source $rootdir/test/common/autotest_common.sh source $rootdir/test/common/autotest_common.sh
fuzzfile=$rootdir/test/app/fuzz/llvm_nvme_fuzz/llvm_nvme_fuzz.c fuzzfile=$rootdir/test/app/fuzz/llvm_nvme_fuzz/llvm_nvme_fuzz.c

View File

@ -48,7 +48,7 @@ function run_fuzz() {
} }
testdir=$(readlink -f $(dirname $0)) testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..) rootdir=$(readlink -f $testdir/../../../../)
source $rootdir/test/common/autotest_common.sh source $rootdir/test/common/autotest_common.sh
fuzzfile=$rootdir/test/app/fuzz/llvm_vfio_fuzz/llvm_vfio_fuzz.c fuzzfile=$rootdir/test/app/fuzz/llvm_vfio_fuzz/llvm_vfio_fuzz.c