public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Ming Lei <ming.lei@redhat.com>
Cc: Omar Sandoval <osandov@fb.com>, linux-block@vger.kernel.org
Subject: Re: [PATCH] block: 028: block integrity funtion test
Date: Tue, 22 Jan 2019 15:24:56 -0800	[thread overview]
Message-ID: <20190122232456.GB5884@vader> (raw)
In-Reply-To: <20190117034425.18376-1-ming.lei@redhat.com>

On Thu, Jan 17, 2019 at 11:44:25AM +0800, Ming Lei wrote:
> 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 <ming.lei@redhat.com>
> ---
>  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
> 
> diff --git a/tests/block/028 b/tests/block/028
> new file mode 100755
> index 000000000000..9b76b93d9eb6
> --- /dev/null
> +++ b/tests/block/028
> @@ -0,0 +1,42 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (C) 2019 Ming Lei <ming.lei@redhat.com>
> +#
> +# 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

Missing quoting here and elsewhere. `make check` will catch this.

> +		return 1
> +	fi
> +
> +	local dev="/dev/${SCSI_DEBUG_DEVICES[0]}"
> +	local nr_sects=`blockdev --getsz $dev`

$() instead of ``, please.

> +
> +	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.

> +	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"
> +}
> diff --git a/tests/block/028.out b/tests/block/028.out
> new file mode 100644
> index 000000000000..d2512334b9f5
> --- /dev/null
> +++ b/tests/block/028.out
> @@ -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
> -- 
> 2.9.5
> 

      reply	other threads:[~2019-01-22 23:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17  3:44 [PATCH] block: 028: block integrity funtion test Ming Lei
2019-01-22 23:24 ` Omar Sandoval [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190122232456.GB5884@vader \
    --to=osandov@osandov.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=osandov@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox