Commit f72f1547 authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

autotest: Move the llvm_nvme_fuzz to test/fuzz



Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Change-Id: I2ccdd807a6585dd7b24c01f3880df721147b1c71
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14555


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 6f445382
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -344,13 +344,7 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
	fi

	if [[ $SPDK_TEST_FUZZER -eq 1 ]]; then
		# TODO: Consider re-using test/fuzz directory for all fuzzing tests with proper
		# 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
		run_test "llvm_fuzz" test/fuzz/llvm.sh
	fi

	if [[ $SPDK_TEST_RAID5 -eq 1 ]]; then
+35 −0
Original line number Diff line number Diff line
@@ -171,6 +171,9 @@ export SPDK_TEST_SMA
export SPDK_TEST_DAOS
: ${SPDK_TEST_XNVME:=0}
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.
export SPDK_LIB_DIR="$rootdir/build/lib"
@@ -504,10 +507,42 @@ function get_config_params() {
		config_params+=' --with-xnvme'
	fi

	if [[ $SPDK_TEST_FUZZER -eq 1 ]]; then
		config_params+=" $(get_fuzzer_target_config)"
	fi

	echo "$config_params"
	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() {
	xtrace_disable
	local rsp rc=1

test/fuzz/llvm.sh

0 → 100755
+14 −0
Original line number Diff line number Diff line
#!/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
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ function run_fuzz() {
}

testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
rootdir=$(readlink -f $testdir/../../../../)
source $rootdir/test/common/autotest_common.sh

fuzzfile=$rootdir/test/app/fuzz/llvm_nvme_fuzz/llvm_nvme_fuzz.c
Loading