test/raid: switch from config file to RPC

bdev_raid.sh was using configuration file (bdev.conf.in)
made for blockdev.sh. Changes in that config file affected
the raid tests.

Since the test actually only used two malloc devices as
raid bases, switching to RPC makes it simpler clearer
to understand what is used in tests. Additionally
making raid tests standalone from blockdev.sh.

Fixes issue #777

Change-Id: Ia4c5858852241a9fd8212690aefbf015c98d1b57
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453644
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Tomasz Zawadzki 2019-05-08 04:07:52 -04:00 committed by Darek Stojaczyk
parent a394f62868
commit 9011f2401b

View File

@ -55,28 +55,34 @@ function on_error_exit() {
killprocess $raid_pid
fi
rm -f $testdir/bdev.conf
rm -f $tmp_file
print_backtrace
exit 1
}
function configure_raid_bdev() {
rm -rf $testdir/rpcs.txt
echo construct_malloc_bdev 32 512 -b Base_1 >> $testdir/rpcs.txt
echo construct_malloc_bdev 32 512 -b Base_2 >> $testdir/rpcs.txt
echo construct_raid_bdev -z 64 -r 0 -b \"Base_1 Base_2\" -n raid0 >> $testdir/rpcs.txt
$rpc_py < $testdir/rpcs.txt
rm -rf $testdir/rpcs.txt
}
function raid_function_test() {
if [ $(uname -s) = Linux ] && modprobe -n nbd; then
local conf=$1
local nbd=/dev/nbd0
local raid_bdev
if [ ! -e $conf ]; then
return 1
fi
modprobe nbd
$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 -c ${conf} -L bdev_raid &
$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 -L bdev_raid &
raid_pid=$!
echo "Process raid pid: $raid_pid"
waitforlisten $raid_pid $rpc_server
configure_raid_bdev
raid_bdev=$($rpc_py get_raid_bdevs online | cut -d ' ' -f 1)
if [ $raid_bdev = "" ]; then
echo "No raid0 device in SPDK app"
@ -108,10 +114,8 @@ function raid_function_test() {
timing_enter bdev_raid
trap 'on_error_exit;' ERR
cp $testdir/bdev.conf.in $testdir/bdev.conf
raid_function_test $testdir/bdev.conf
raid_function_test
rm -f $testdir/bdev.conf
rm -f $tmp_file
report_test_completion "bdev_raid"
timing_exit bdev_raid