block: 028: block integrity funtion test
PATCH 1/1 block: 028: block integrity funtion test
Use scsi_debug's dif/dix to cover block layer's integrity function test, then it can serve as block integrity regeression test.
Signed-off-by Ming Lei <[email protected]>
--- tests/block/028 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/block/028.out | 9 +++++++++ 2 files changed, 51 insertions(+) create mode 100755 tests/block/028 create mode 100644 tests/block/028.out
tests/block/028 new file +42 -0
@@ -0,0 +1,42 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Ming Lei <[email protected]> +# +# Test basic DIF/DIX test. Regression test for commit 7809167da5c86fd6 +# ("block: don't lose track of REQ_INTEGRITY flag") + +. tests/block/rc +. common/scsi_debug + +DESCRIPTION="do scsi_debug dif/dix function test" + +requires() { + _have_scsi_debug +} + +test_pi() { + if ! _init_scsi_debug dev_size_mb=128 dix=$1 dif=$2 delay=0; then + return 1 + fi + + local dev="/dev/${SCSI_DEBUG_DEVICES[0]}" + local nr_sects=`blockdev --getsz $dev` + + dd if=/dev/urandom of=$dev bs=512 count=$nr_sects status=none + dd if=$dev of=/dev/null bs=512 status=none + + _exit_scsi_debug +} + +test() { + echo "Running ${TEST_NAME}" + + for ((dix = 0; dix <= 1; dix++)); do + for ((dif = 0; dif <= 3; dif++)); do + test_pi $dix $dif + echo "Test(dix:$dix dif:$dif) complete" + done + done + + rm -f "$FULL" +}
tests/block/028.out new file +9 -0
@@ -0,0 +1,9 @@ +Running block/028 +Test(dix:0 dif:0) complete +Test(dix:0 dif:1) complete +Test(dix:0 dif:2) complete +Test(dix:0 dif:3) complete +Test(dix:1 dif:0) complete +Test(dix:1 dif:1) complete +Test(dix:1 dif:2) complete +Test(dix:1 dif:3) complete
Signature · 1 line
2.9.5
Quoted 25 lines · Ming Lei
Use scsi_debug's dif/dix to cover block layer's integrity function test, then it can serve as block integrity regeression test.
Signed-off-by Ming Lei <[email protected]>--- tests/block/028 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/block/028.out | 9 +++++++++ 2 files changed, 51 insertions(+) create mode 100755 tests/block/028 create mode 100644 tests/block/028.outtests/block/028 new file +8
-0@@ -0,0 +1,42 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Ming Lei <[email protected]> +# +# Test basic DIF/DIX test. Regression test for commit 7809167da5c86fd6 +# ("block: don't lose track of REQ_INTEGRITY flag") + +. tests/block/rc
tests/block/028 line 18
Quoted 10 lines
tests/block/028 new file +10
-0+. common/scsi_debug + +DESCRIPTION="do scsi_debug dif/dix function test" + +requires() { + _have_scsi_debug +} + +test_pi() { + if ! _init_scsi_debug dev_size_mb=128 dix=$1 dif=$2 delay=0; then
Missing quoting here and elsewhere. make check will catch this.
tests/block/028 line 23
Quoted 5 lines
tests/block/028 new file +5
-0+ return 1 + fi + + local dev="/dev/${SCSI_DEBUG_DEVICES[0]}" + local nr_sects=`blockdev --getsz $dev`
$() instead of ``, please.
tests/block/028 line 32
Quoted 9 lines
tests/block/028 new file +9
-0+ + dd if=/dev/urandom of=$dev bs=512 count=$nr_sects status=none + dd if=$dev of=/dev/null bs=512 status=none + + _exit_scsi_debug +} + +test() { + echo "Running ${TEST_NAME}"
dix and dif should be local.
Fixed and applied, thanks Ming.
Quoted 27 lines
tests/block/028 new file +9
-0+ for ((dix = 0; dix <= 1; dix++)); do + for ((dif = 0; dif <= 3; dif++)); do + test_pi $dix $dif + echo "Test(dix:$dix dif:$dif) complete" + done + done + + rm -f "$FULL" +}tests/block/028.out new file +9
-0@@ -0,0 +1,9 @@ +Running block/028 +Test(dix:0 dif:0) complete +Test(dix:0 dif:1) complete +Test(dix:0 dif:2) complete +Test(dix:0 dif:3) complete +Test(dix:1 dif:0) complete +Test(dix:1 dif:1) complete +Test(dix:1 dif:2) complete +Test(dix:1 dif:3) completeSignature · 1 line
2.9.5