Commit ca558b61 authored by Wojciech Malikowski's avatar Wojciech Malikowski Committed by Jim Harris
Browse files

bdev_ftl: Added FTL bdev functional tests



This patch introduces functional tests for FTL bdev.

The tests cover various I/O workflows and check data integrity. Several
scripts have been added to test the FTL library:
 * generate_config.sh - prepares configuration scripts for specified
 device
 * restore.sh - tests restoring device's state from the SSD
 * fio.sh - runs tests based on fio and fio_plugin

The tests are run from autotest.sh when the SPDK_TEST_BDEV_FTL flag is
set.

Change-Id: I561d99ed35fe91eadd3756789cc99afe2da8c1db
Signed-off-by: default avatarMateusz Kozlowski <mateusz.kozlowski@intel.com>
Signed-off-by: default avatarWojciech Malikowski <wojciech.malikowski@intel.com>
Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/431330


Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
parent 45d0c054
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -197,6 +197,10 @@ if [ $SPDK_TEST_OCF -eq 1 ]; then
	run_test suite ./test/ocf/ocf.sh
fi

if [ $SPDK_TEST_BDEV_FTL -eq 1 ]; then
	run_test suite ./test/ftl/ftl.sh
fi

run_test suite ./test/json_config/json_config.sh

timing_enter cleanup

scripts/gen_ftl.sh

0 → 100755
+57 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash

set -e

rootdir=$(readlink -f $(dirname $0))/..

function usage {
	echo "Replaces FTL_* variables in config files inside the config/ directory."
	echo "The following varaibles are replaced:"
	echo "- FTL_CONF_DIR - config directory"
	echo "- FTL_TRANSPORT_ADDR - SSD's PCIe address (defaults to first lnvm device)"
	echo "- FTL_BDEV_NAME - name of the bdev"
	echo "- FTL_BDEV_PUNITS - bdev's parallel unit range (e.g. 0-3)"
	echo "- FTL_BDEV_UUID - bdev's uuid (used when in restore mode)"
	echo
	echo "Usage: $0 -a TRANSPORT_ADDR -n BDEV_NAME -l PUNITS [-u UUID]"
	echo "UUID is required when restoring device state"
}

function generate_config {
	fname=$1
	output=${1%.in}

	cp $fname $output
	for var in ${!vmap[@]}; do
		sed -i "s,$var,${vmap[$var]},g" $output
	done
}

while getopts ":a:n:l:m:u:" arg; do
	case "$arg" in
		a)	addr=$OPTARG	;;
		n)	name=$OPTARG	;;
		l)	punits=$OPTARG	;;
		u)	uuid=$OPTARG	;;
		h)	usage
			exit 0		;;
		*)	usage
			exit 1		;;
	esac
done

if [[ -z "$addr" || -z "$name" || -z "$punits" ]]; then
	usage
	exit 1
fi

declare -A vmap
vmap[FTL_CONF_DIR]=$rootdir/test/ftl/config
vmap[FTL_TRANSPORT_ADDR]=$addr
vmap[FTL_BDEV_NAME]=$name
vmap[FTL_BDEV_PUNITS]=$punits
vmap[FTL_BDEV_UUID]=${uuid:-}

for file in $(find $rootdir/test/ftl/config -type f -iname "*.in"); do
	generate_config $file
done
+2 −1
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ fi
: ${SPDK_RUN_INSTALLED_DPDK=1}; export SPDK_RUN_INSTALLED_DPDK
: ${SPDK_TEST_CRYPTO=1}; export SPDK_TEST_CRYPTO
: ${SPDK_TEST_FTL=0}; export SPDK_TEST_FTL
: ${SPDK_TEST_BDEV_FTL=0}; export SPDK_TEST_BDEV_FTL
: ${SPDK_TEST_OCF=1}; export SPDK_TEST_OCF

if [ -z "$DEPENDENCY_DIR" ]; then
@@ -262,7 +263,7 @@ function timing_finish() {
}

function create_test_list() {
	grep -rsh --exclude="autotest_common.sh" --exclude="$rootdir/test/common/autotest_common.sh" -e "report_test_completion" $rootdir | sed 's/report_test_completion//g; s/[[:blank:]]//g; s/"//g;' > $output_dir/all_tests.txt || true
	grep -rshI --exclude="autotest_common.sh" --exclude="$rootdir/test/common/autotest_common.sh" -e "report_test_completion" $rootdir | sed 's/report_test_completion//g; s/[[:blank:]]//g; s/"//g;' > $output_dir/all_tests.txt || true
}

function report_test_completion() {

test/ftl/.gitignore

0 → 100644
+1 −0
Original line number Diff line number Diff line
.testfile_*
+2 −0
Original line number Diff line number Diff line
ftl.conf
fio/*.fio
Loading