numam-spdk/scripts/gen_ftl.sh
Wojciech Malikowski ca558b6163 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: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/431330
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2019-01-29 17:33:10 +00:00

58 lines
1.3 KiB
Bash
Executable File

#!/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