Commit 87ffce61 authored by Tomasz Zawadzki's avatar Tomasz Zawadzki Committed by Jim Harris
Browse files

test/blobstore: modernize the three blobstore scripts



Only intended as general cleanup, as those scripts were bit outdated compared
to current test scripts in SPDK. The tests should run exactly the same after
this change.

One highlight is removal of exception for FreeBSD, lvol tests use aio/nbd and
other similar tools so the SPDK_TEST_LVOL flag at least for now will cannot be
enabled there anyway. No need to make an exception for blobstore tests here.

Change-Id: Ic92c02f7504b4a1815c6d8c487577794b9da5f43
Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@nutanix.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26550


Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
parent b734189a
Loading
Loading
Loading
Loading
+28 −22
Original line number Diff line number Diff line
@@ -3,51 +3,57 @@
#  Copyright (C) 2018 Intel Corporation
#  All rights reserved.
#
testdir=$(readlink -f "$(dirname "$0")")
rootdir=$(readlink -f "$testdir/../../..")

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

truncate -s 64M $testdir/aio.bdev
function cleanup() {
	rm -f "$testdir/bdevperf.json"
	rm -f "$testdir/aio.bdev"
}

$rootdir/test/app/bdev_svc/bdev_svc --wait-for-rpc &
bdevperf="$_examples_dir/bdevperf"

truncate -s 64M "$testdir/aio.bdev"

"$rootdir/test/app/bdev_svc/bdev_svc" --wait-for-rpc &
bdev_svc_pid=$!

trap 'rm -f $testdir/bdevperf.json; rm -f $testdir/aio.bdev; killprocess $bdev_svc_pid; exit 1' SIGINT SIGTERM EXIT
trap 'cleanup; killprocess "$bdev_svc_pid"; exit 1' SIGINT SIGTERM EXIT

waitforlisten $bdev_svc_pid
waitforlisten "$bdev_svc_pid"
# Minimal number of bdev io pool (128) and cache (1)
$rpc_py iobuf_set_options --small-pool-count 8192 --large-pool-count 1024
$rpc_py bdev_set_options --bdev-io-pool-size 128 --bdev-io-cache-size 1
$rpc_py framework_start_init
$rpc_py bdev_aio_create $testdir/aio.bdev aio0 4096
$rpc_py bdev_aio_create "$testdir/aio.bdev" aio0 4096
$rpc_py bdev_lvol_create_lvstore aio0 lvs0
$rpc_py bdev_lvol_create -l lvs0 lvol0 32
$rpc_py save_config > $testdir/bdevperf.json
$rpc_py save_config > "$testdir/bdevperf.json"

killprocess $bdev_svc_pid
killprocess "$bdev_svc_pid"

$rootdir/build/examples/bdevperf --json $testdir/bdevperf.json -q 128 -o 4096 -w write -t 5 -r /var/tmp/spdk.sock &
$bdevperf --json "$testdir/bdevperf.json" -q 128 -o 4096 -w write -t 5 -r /var/tmp/spdk.sock &
bdev_perf_pid=$!
waitforlisten $bdev_perf_pid
waitforlisten "$bdev_perf_pid"
$rpc_py bdev_enable_histogram aio0 -e
sleep 2
$rpc_py bdev_get_histogram aio0 | $rootdir/scripts/histogram.py
$rpc_py bdev_get_histogram aio0 | "$rootdir/scripts/histogram.py"
$rpc_py bdev_enable_histogram aio0 -d
wait $bdev_perf_pid
wait "$bdev_perf_pid"

$rootdir/build/examples/bdevperf --json $testdir/bdevperf.json -q 128 -o 4096 -w read -t 5 -r /var/tmp/spdk.sock &
$bdevperf --json "$testdir/bdevperf.json" -q 128 -o 4096 -w read -t 5 -r /var/tmp/spdk.sock &
bdev_perf_pid=$!
waitforlisten $bdev_perf_pid
waitforlisten "$bdev_perf_pid"
$rpc_py bdev_enable_histogram aio0 -e
sleep 2
$rpc_py bdev_get_histogram aio0 | $rootdir/scripts/histogram.py
$rpc_py bdev_get_histogram aio0 | "$rootdir/scripts/histogram.py"
$rpc_py bdev_enable_histogram aio0 -d
wait $bdev_perf_pid

$rootdir/build/examples/bdevperf --json $testdir/bdevperf.json -q 128 -o 4096 -w unmap -t 1
wait "$bdev_perf_pid"

$bdevperf --json "$testdir/bdevperf.json" -q 128 -o 4096 -w unmap -t 1
sync
rm -f $testdir/bdevperf.json
rm -f $testdir/aio.bdev

trap - SIGINT SIGTERM EXIT
cleanup
+21 −19
Original line number Diff line number Diff line
@@ -3,17 +3,18 @@
#  Copyright (C) 2017 Intel Corporation
#  All rights reserved.
#
SYSTEM=$(uname -s)
if [ $SYSTEM = "FreeBSD" ]; then
	echo "blobstore.sh cannot run on FreeBSD currently."
	exit 0
fi

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

source "$rootdir/test/common/autotest_common.sh"
source "$rootdir/test/dd/common.sh"

function cleanup() {
	rm -rf "$testdir/btest.out"
	rm -rf "$testdir/*.blob"
	rm -rf "$testdir/test.pattern"
}

# Create malloc bdev with 128MiB in size and 512B block size
declare -A method_bdev_malloc_create_0=(
	["name"]=Malloc0
@@ -21,17 +22,18 @@ declare -A method_bdev_malloc_create_0=(
	["block_size"]=512
)

# generate random data file for import/export diff
dd if=/dev/urandom of=$testdir/test.pattern bs=1M count=1
trap 'cleanup; exit 1' SIGINT SIGTERM EXIT

# Create test data file (1MiB random data)
dd if=/dev/urandom of="$testdir/test.pattern" bs=1M count=1

(cd $testdir \
	&& $SPDK_EXAMPLE_DIR/blobcli -j <(gen_conf) -b Malloc0 -T $testdir/test.bs > $testdir/btest.out)
(cd "$testdir" \
	&& "$_examples_dir/blobcli" -j <(gen_conf) -b Malloc0 -T "$testdir/test.bs" > "$testdir/btest.out")

# the test script will import the test pattern generated by dd and then export
# The test script will import the test pattern generated by dd and then export
# it to a file so we can compare and confirm basic read and write
$rootdir/test/app/match/match -v $testdir/btest.out.match
diff $testdir/test.pattern $testdir/test.pattern.blob
"$rootdir/test/app/match/match" -v "$testdir/btest.out.match"
diff "$testdir/test.pattern" "$testdir/test.pattern.blob"

rm -rf $testdir/btest.out
rm -rf $testdir/*.blob
rm -rf $testdir/test.pattern
trap - SIGINT SIGTERM EXIT
cleanup
+14 −13
Original line number Diff line number Diff line
@@ -2,46 +2,47 @@
#  SPDX-License-Identifier: BSD-3-Clause
#  All rights reserved.
#
testdir=$(readlink -f "$(dirname "$0")")
rootdir=$(readlink -f "$testdir/../../..")

SYSTEM=$(uname -s)
if [ $SYSTEM = "FreeBSD" ]; then
	echo "blob_io_wait.sh cannot run on FreeBSD currently."
	exit 0
fi
source "$rootdir/test/common/autotest_common.sh"

testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
rpc_py="$rootdir/scripts/rpc.py"

$rootdir/test/app/bdev_svc/bdev_svc &
"$rootdir/test/app/bdev_svc/bdev_svc" &
bdev_svc_pid=$!

trap 'killprocess $bdev_svc_pid; exit 1' SIGINT SIGTERM EXIT

waitforlisten $bdev_svc_pid
waitforlisten "$bdev_svc_pid"

# Create LVS spanning single Malloc
$rpc_py bdev_malloc_create --name malloc0 128 4096
$rpc_py bdev_malloc_create --name malloc1 128 4096
$rpc_py bdev_malloc_create --name malloc2 128 4096
$rpc_py bdev_raid_create --name concat0 --raid-level concat --base-bdevs malloc0 --strip-size-kb 4
$rpc_py bdev_lvol_create_lvstore --cluster-sz 4194304 --clear-method unmap concat0 lvs0 --md-pages-per-cluster-ratio 300
free_clusters=$($rpc_py bdev_lvol_get_lvstores --lvs-name lvs0 | jq -rM '.[0].free_clusters')
test $free_clusters -eq 31
$rpc_py bdev_raid_delete concat0

# Grow LVS to cover two Malloc bdevs
$rpc_py bdev_malloc_create --name malloc1 128 4096
$rpc_py bdev_raid_create --name concat0 --raid-level concat --base-bdevs "malloc0 malloc1" --strip-size-kb 4
$rpc_py bdev_lvol_grow_lvstore -l lvs0
free_clusters=$($rpc_py bdev_lvol_get_lvstores --lvs-name lvs0 | jq -rM '.[0].free_clusters')
test $free_clusters -eq 63

# Grow LVS to cover three Malloc bdevs, while single thin lvol bdev exists
$rpc_py bdev_lvol_create --lvs-name lvs0 --thin-provision --clear-method unmap lv0 8192
$rpc_py bdev_raid_delete concat0
$rpc_py bdev_malloc_create --name malloc2 128 4096
$rpc_py bdev_raid_create --name concat0 --raid-level concat --base-bdevs "malloc0 malloc1 malloc2" --strip-size-kb 4
$rpc_py bdev_lvol_grow_lvstore -l lvs0
free_clusters=$($rpc_py bdev_lvol_get_lvstores --lvs-name lvs0 | jq -rM '.[0].free_clusters')
test $free_clusters -eq 95

bdev_cnt=$($rpc_py bdev_get_bdevs --name lvs0/lv0 | jq -rM '. | length')
test $bdev_cnt -eq 1

killprocess $bdev_svc_pid
killprocess "$bdev_svc_pid"

trap - SIGINT SIGTERM EXIT