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>
70 lines
1.5 KiB
Bash
Executable File
70 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
rootdir=$(readlink -f $testdir/../..)
|
|
rpc_py=$rootdir/scripts/rpc.py
|
|
|
|
source $rootdir/test/common/autotest_common.sh
|
|
|
|
mount_dir=$(mktemp -d)
|
|
device=$1
|
|
uuid=$2
|
|
|
|
restore_kill() {
|
|
if mount | grep $mount_dir; then
|
|
umount $mount_dir
|
|
fi
|
|
rm -rf $mount_dir
|
|
rm -f $testdir/testfile.md5
|
|
|
|
$rpc_py delete_ftl_bdev -b nvme0
|
|
killprocess $svcpid
|
|
rmmod nbd || true
|
|
}
|
|
|
|
trap "restore_kill; exit 1" SIGINT SIGTERM EXIT
|
|
|
|
$rootdir/test/app/bdev_svc/bdev_svc --max-delay=0 & svcpid=$!
|
|
# Wait until bdev_svc starts
|
|
waitforlisten $svcpid
|
|
|
|
if [ -n "$uuid" ]; then
|
|
$rpc_py construct_ftl_bdev -b nvme0 -a $device -l 0-3 -u $uuid
|
|
else
|
|
uuid=$($rpc_py construct_ftl_bdev -b nvme0 -a $device -l 0-3 | jq -r '.uuid')
|
|
fi
|
|
|
|
# Load the nbd driver
|
|
modprobe nbd
|
|
$rpc_py start_nbd_disk nvme0 /dev/nbd0
|
|
waitfornbd nbd0
|
|
|
|
# Prepare the disk by creating ext4 fs and putting a file on it
|
|
mkfs.ext4 -F /dev/nbd0
|
|
mount /dev/nbd0 $mount_dir
|
|
dd if=/dev/urandom of=$mount_dir/testfile bs=4K count=256K
|
|
sync
|
|
mount -o remount /dev/nbd0 $mount_dir
|
|
md5sum $mount_dir/testfile > $testdir/testfile.md5
|
|
|
|
# Kill bdev service and start it again
|
|
umount $mount_dir
|
|
killprocess $svcpid
|
|
|
|
$rootdir/test/app/bdev_svc/bdev_svc --max-delay=0 & svcpid=$!
|
|
# Wait until bdev_svc starts
|
|
waitforlisten $svcpid
|
|
$rpc_py construct_ftl_bdev -b nvme0 -a $device -l 0-3 -u $uuid
|
|
|
|
$rpc_py start_nbd_disk nvme0 /dev/nbd0
|
|
|
|
mount /dev/nbd0 $mount_dir
|
|
md5sum -c $testdir/testfile.md5
|
|
|
|
report_test_completion occsd_restore
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
restore_kill
|