From 25f4d2351747116dd452760288ca97a1b2bc4696 Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Fri, 18 Nov 2022 12:13:02 +0100 Subject: [PATCH] test/ftl: use spdk_dd in dirty_shutdown test Use spdk_dd instead of plain dd to reduce test execution time. Signed-off-by: Karol Latecki Change-Id: I54979b68b3c328aa9618e704e2bc55e794aa232c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15524 Tested-by: SPDK CI Jenkins Reviewed-by: Mateusz Kozlowski Reviewed-by: Krzysztof Karas Reviewed-by: Pawel Piatek Reviewed-by: Tomasz Zawadzki Reviewed-by: Konrad Sztyber --- test/ftl/dirty_shutdown.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/ftl/dirty_shutdown.sh b/test/ftl/dirty_shutdown.sh index e74d6c914..7e5b5a73a 100755 --- a/test/ftl/dirty_shutdown.sh +++ b/test/ftl/dirty_shutdown.sh @@ -6,6 +6,7 @@ source $rootdir/test/common/autotest_common.sh source $testdir/common.sh rpc_py=$rootdir/scripts/rpc.py +spdk_dd="$SPDK_BIN_DIR/spdk_dd" while getopts ':u:c:' opt; do case $opt in @@ -19,6 +20,7 @@ shift $((OPTIND - 1)) device=$1 timeout=240 +block_size=4096 chunk_size=262144 data_size=$((chunk_size * 2)) @@ -36,7 +38,7 @@ restore_kill() { trap "restore_kill; exit 1" SIGINT SIGTERM EXIT -"$SPDK_BIN_DIR/spdk_tgt" & +"$SPDK_BIN_DIR/spdk_tgt" -m 0x1 & svcpid=$! # Wait until spdk_tgt starts waitforlisten $svcpid @@ -67,9 +69,9 @@ $rpc_py nbd_start_disk ftl0 /dev/nbd0 waitfornbd nbd0 # Write and calculate checksum of the data written -dd if=/dev/urandom of=$testdir/testfile bs=4K count=$data_size +$spdk_dd -m 0x2 -r /var/tmp/spdk_dd.sock --if=/dev/urandom --of=$testdir/testfile --bs=$block_size --count=$data_size md5sum $testdir/testfile > $testdir/testfile.md5 -dd if=$testdir/testfile of=/dev/nbd0 bs=4K count=$data_size oflag=dsync +$spdk_dd -m 0x2 -r /var/tmp/spdk_dd.sock --if=$testdir/testfile --of=/dev/nbd0 --bs=$block_size --count=$data_size --oflag=dsync $rpc_py nbd_stop_disk /dev/nbd0 # Force kill bdev service (dirty shutdown) and start it again @@ -77,15 +79,15 @@ kill -9 $svcpid rm -f /dev/shm/spdk_tgt_trace.pid$svcpid # Write extra data after restore -dd if=/dev/urandom of=$testdir/testfile2 bs=4K count=$chunk_size -"$SPDK_BIN_DIR/spdk_dd" --if=$testdir/testfile2 --ob=ftl0 --count=$chunk_size --seek=$data_size --json=$testdir/config/ftl.json +$spdk_dd --if=/dev/urandom --of=$testdir/testfile2 --bs=$block_size --count=$chunk_size +$spdk_dd --if=$testdir/testfile2 --ob=ftl0 --count=$chunk_size --seek=$data_size --json=$testdir/config/ftl.json # Save md5 data md5sum $testdir/testfile2 > $testdir/testfile2.md5 # Verify that the checksum matches and the data is consistent -"$SPDK_BIN_DIR/spdk_dd" --ib=ftl0 --of=$testdir/testfile --count=$data_size --json=$testdir/config/ftl.json +$spdk_dd --ib=ftl0 --of=$testdir/testfile --count=$data_size --json=$testdir/config/ftl.json md5sum -c $testdir/testfile.md5 -"$SPDK_BIN_DIR/spdk_dd" --ib=ftl0 --of=$testdir/testfile2 --count=$chunk_size --skip=$data_size --json=$testdir/config/ftl.json +$spdk_dd --ib=ftl0 --of=$testdir/testfile2 --count=$chunk_size --skip=$data_size --json=$testdir/config/ftl.json md5sum -c $testdir/testfile2.md5 trap - SIGINT SIGTERM EXIT