* [PATCH V2] blktests: add userspace IO test
@ 2019-03-05 1:50 Ming Lei
2019-03-11 20:55 ` Omar Sandoval
0 siblings, 1 reply; 5+ messages in thread
From: Ming Lei @ 2019-03-05 1:50 UTC (permalink / raw)
To: Omar Sandoval; +Cc: linux-block, Ming Lei
Add one test to cover changes on block passthrough IO interface,
such as blk_rq_map_user(), blk_rq_map_user_iov(), blk_rq_unmap_user()
and blk_rq_map_kern().
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
tests/block/029 | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/block/029.out | 4 ++
2 files changed, 115 insertions(+)
create mode 100755 tests/block/029
create mode 100644 tests/block/029.out
diff --git a/tests/block/029 b/tests/block/029
new file mode 100755
index 000000000000..c7c674464285
--- /dev/null
+++ b/tests/block/029
@@ -0,0 +1,111 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2019 Ming Lei <ming.lei@redhat.com>
+#
+# Test userspace IO on NVMe loop device
+
+. tests/nvme/rc
+
+DESCRIPTION="test userspace IO via nvme-cli read/write interface"
+QUICK=1
+
+requires() {
+ _have_program nvme && _have_modules loop nvme-loop nvmet && \
+ _have_configfs
+}
+
+__test_user_io()
+{
+ local disk="$1"
+ local start=$2
+ local cnt=$3
+
+ local bs=$(blockdev --getss $disk)
+ local size=$(($cnt * $bs))
+
+ local img=`mktemp /tmp/blk_img_XXXXXX`
+ local img1=`mktemp /tmp/blk_img_XXXXXX`
+
+ dd if=/dev/urandom of=$img bs=$bs count=$cnt status=none
+
+ cnt=$(($cnt - 1))
+
+ nvme write --start-block=$start --block-count=$cnt --data-size=$size --data=$img $disk
+ [ $? -ne 0 ] && return -1
+ nvme read --start-block=$start --block-count=$cnt --data-size=$size --data=$img1 $disk
+ [ $? -ne 0 ] && return -1
+
+ diff -q -u $img $img1
+ res=$?
+
+ rm -f $img $img1
+ return $res
+}
+
+test_user_io()
+{
+ local dev="$1"
+
+ __test_user_io $dev 1 512 > "$FULL" 2>&1
+ [ -$? -ne 0 ] && echo "FAIL"
+
+ __test_user_io $dev 1 511 > "$FULL" 2>&1
+ [ -$? -ne 0 ] && echo "FAIL"
+
+ __test_user_io $dev 1 513 > "$FULL" 2>&1
+ [ -$? -ne 0 ] && echo "FAIL"
+
+ __test_user_io $dev 511 1024 > "$FULL" 2>&1
+ [ -$? -ne 0 ] && echo "FAIL"
+
+ __test_user_io $dev 511 1023 > "$FULL" 2>&1
+ [ -$? -ne 0 ] && echo "FAIL"
+
+ __test_user_io $dev 511 1025 > "$FULL" 2>&1
+ [ -$? -ne 0 ] && echo "FAIL"
+}
+
+test() {
+ echo "Running ${TEST_NAME}"
+
+ modprobe nvmet
+ modprobe nvme-loop
+
+ local port
+ local nvmedev
+ local loop_dev
+ local file_path="$TMPDIR/img"
+ local subsys_name="blktests-subsystem-1"
+
+ truncate -s 1G "${file_path}"
+
+ loop_dev="$(losetup -f --show "${file_path}")"
+
+ _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
+ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+ port="$(_create_nvmet_port "loop")"
+ _add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+ nvme connect -t loop -n "${subsys_name}"
+
+ nvmedev="$(_find_nvme_loop_dev)"
+ cat "/sys/block/${nvmedev}n1/uuid"
+ cat "/sys/block/${nvmedev}n1/wwid"
+
+ test_user_io "/dev/${nvmedev}n1"
+
+ nvme disconnect -n "${subsys_name}" >> "$FULL" 2>&1
+
+ _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+ _remove_nvmet_subsystem "${subsys_name}"
+ _remove_nvmet_port "${port}"
+
+ losetup -d "${loop_dev}"
+
+ rm "${file_path}"
+
+ modprobe -r nvme-loop
+ modprobe -r nvmet
+
+ echo "Test complete"
+}
diff --git a/tests/block/029.out b/tests/block/029.out
new file mode 100644
index 000000000000..6defa8e84f0a
--- /dev/null
+++ b/tests/block/029.out
@@ -0,0 +1,4 @@
+Running block/029
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+Test complete
--
2.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2] blktests: add userspace IO test
2019-03-05 1:50 [PATCH V2] blktests: add userspace IO test Ming Lei
@ 2019-03-11 20:55 ` Omar Sandoval
2019-03-21 22:36 ` Omar Sandoval
0 siblings, 1 reply; 5+ messages in thread
From: Omar Sandoval @ 2019-03-11 20:55 UTC (permalink / raw)
To: Ming Lei; +Cc: Omar Sandoval, linux-block
On Tue, Mar 05, 2019 at 09:50:26AM +0800, Ming Lei wrote:
> Add one test to cover changes on block passthrough IO interface,
> such as blk_rq_map_user(), blk_rq_map_user_iov(), blk_rq_unmap_user()
> and blk_rq_map_kern().
>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> tests/block/029 | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/block/029.out | 4 ++
> 2 files changed, 115 insertions(+)
> create mode 100755 tests/block/029
> create mode 100644 tests/block/029.out
>
> diff --git a/tests/block/029 b/tests/block/029
> new file mode 100755
> index 000000000000..c7c674464285
> --- /dev/null
> +++ b/tests/block/029
> @@ -0,0 +1,111 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2019 Ming Lei <ming.lei@redhat.com>
> +#
> +# Test userspace IO on NVMe loop device
This is still missing a reference to the patch it's testing.
> +. tests/nvme/rc
Shouldn't this be in the nvme group?
> +DESCRIPTION="test userspace IO via nvme-cli read/write interface"
> +QUICK=1
> +
> +requires() {
> + _have_program nvme && _have_modules loop nvme-loop nvmet && \
> + _have_configfs
> +}
> +
> +__test_user_io()
> +{
> + local disk="$1"
> + local start=$2
> + local cnt=$3
> +
> + local bs=$(blockdev --getss $disk)
This still has a ton of missing quoting and shellcheck errors.
I fixed all of this and pushed to
https://github.com/osandov/blktests/tree/user-io. Let me know if this
looks fine and I'll push it to master.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] blktests: add userspace IO test
2019-03-11 20:55 ` Omar Sandoval
@ 2019-03-21 22:36 ` Omar Sandoval
2019-03-22 1:04 ` Ming Lei
0 siblings, 1 reply; 5+ messages in thread
From: Omar Sandoval @ 2019-03-21 22:36 UTC (permalink / raw)
To: Ming Lei; +Cc: Omar Sandoval, linux-block
On Mon, Mar 11, 2019 at 01:55:05PM -0700, Omar Sandoval wrote:
> On Tue, Mar 05, 2019 at 09:50:26AM +0800, Ming Lei wrote:
> > Add one test to cover changes on block passthrough IO interface,
> > such as blk_rq_map_user(), blk_rq_map_user_iov(), blk_rq_unmap_user()
> > and blk_rq_map_kern().
> >
> > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > ---
> > tests/block/029 | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> > tests/block/029.out | 4 ++
> > 2 files changed, 115 insertions(+)
> > create mode 100755 tests/block/029
> > create mode 100644 tests/block/029.out
> >
> > diff --git a/tests/block/029 b/tests/block/029
> > new file mode 100755
> > index 000000000000..c7c674464285
> > --- /dev/null
> > +++ b/tests/block/029
> > @@ -0,0 +1,111 @@
> > +#!/bin/bash
> > +# SPDX-License-Identifier: GPL-2.0+
> > +# Copyright (c) 2019 Ming Lei <ming.lei@redhat.com>
> > +#
> > +# Test userspace IO on NVMe loop device
>
> This is still missing a reference to the patch it's testing.
>
> > +. tests/nvme/rc
>
> Shouldn't this be in the nvme group?
>
> > +DESCRIPTION="test userspace IO via nvme-cli read/write interface"
> > +QUICK=1
> > +
> > +requires() {
> > + _have_program nvme && _have_modules loop nvme-loop nvmet && \
> > + _have_configfs
> > +}
> > +
> > +__test_user_io()
> > +{
> > + local disk="$1"
> > + local start=$2
> > + local cnt=$3
> > +
> > + local bs=$(blockdev --getss $disk)
>
> This still has a ton of missing quoting and shellcheck errors.
>
> I fixed all of this and pushed to
> https://github.com/osandov/blktests/tree/user-io. Let me know if this
> looks fine and I'll push it to master.
Ping.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] blktests: add userspace IO test
2019-03-21 22:36 ` Omar Sandoval
@ 2019-03-22 1:04 ` Ming Lei
2019-03-25 17:29 ` Omar Sandoval
0 siblings, 1 reply; 5+ messages in thread
From: Ming Lei @ 2019-03-22 1:04 UTC (permalink / raw)
To: Omar Sandoval; +Cc: Omar Sandoval, linux-block
On Thu, Mar 21, 2019 at 03:36:26PM -0700, Omar Sandoval wrote:
> On Mon, Mar 11, 2019 at 01:55:05PM -0700, Omar Sandoval wrote:
> > On Tue, Mar 05, 2019 at 09:50:26AM +0800, Ming Lei wrote:
> > > Add one test to cover changes on block passthrough IO interface,
> > > such as blk_rq_map_user(), blk_rq_map_user_iov(), blk_rq_unmap_user()
> > > and blk_rq_map_kern().
> > >
> > > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > > ---
> > > tests/block/029 | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> > > tests/block/029.out | 4 ++
> > > 2 files changed, 115 insertions(+)
> > > create mode 100755 tests/block/029
> > > create mode 100644 tests/block/029.out
> > >
> > > diff --git a/tests/block/029 b/tests/block/029
> > > new file mode 100755
> > > index 000000000000..c7c674464285
> > > --- /dev/null
> > > +++ b/tests/block/029
> > > @@ -0,0 +1,111 @@
> > > +#!/bin/bash
> > > +# SPDX-License-Identifier: GPL-2.0+
> > > +# Copyright (c) 2019 Ming Lei <ming.lei@redhat.com>
> > > +#
> > > +# Test userspace IO on NVMe loop device
> >
> > This is still missing a reference to the patch it's testing.
> >
> > > +. tests/nvme/rc
> >
> > Shouldn't this be in the nvme group?
> >
> > > +DESCRIPTION="test userspace IO via nvme-cli read/write interface"
> > > +QUICK=1
> > > +
> > > +requires() {
> > > + _have_program nvme && _have_modules loop nvme-loop nvmet && \
> > > + _have_configfs
> > > +}
> > > +
> > > +__test_user_io()
> > > +{
> > > + local disk="$1"
> > > + local start=$2
> > > + local cnt=$3
> > > +
> > > + local bs=$(blockdev --getss $disk)
> >
> > This still has a ton of missing quoting and shellcheck errors.
> >
> > I fixed all of this and pushed to
> > https://github.com/osandov/blktests/tree/user-io. Let me know if this
> > looks fine and I'll push it to master.
Yeah, it is fine for me.
Thanks,
Ming
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] blktests: add userspace IO test
2019-03-22 1:04 ` Ming Lei
@ 2019-03-25 17:29 ` Omar Sandoval
0 siblings, 0 replies; 5+ messages in thread
From: Omar Sandoval @ 2019-03-25 17:29 UTC (permalink / raw)
To: Ming Lei; +Cc: Omar Sandoval, linux-block
On Fri, Mar 22, 2019 at 09:04:54AM +0800, Ming Lei wrote:
> On Thu, Mar 21, 2019 at 03:36:26PM -0700, Omar Sandoval wrote:
> > On Mon, Mar 11, 2019 at 01:55:05PM -0700, Omar Sandoval wrote:
> > > On Tue, Mar 05, 2019 at 09:50:26AM +0800, Ming Lei wrote:
> > > > Add one test to cover changes on block passthrough IO interface,
> > > > such as blk_rq_map_user(), blk_rq_map_user_iov(), blk_rq_unmap_user()
> > > > and blk_rq_map_kern().
> > > >
> > > > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > > > ---
> > > > tests/block/029 | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> > > > tests/block/029.out | 4 ++
> > > > 2 files changed, 115 insertions(+)
> > > > create mode 100755 tests/block/029
> > > > create mode 100644 tests/block/029.out
> > > >
> > > > diff --git a/tests/block/029 b/tests/block/029
> > > > new file mode 100755
> > > > index 000000000000..c7c674464285
> > > > --- /dev/null
> > > > +++ b/tests/block/029
> > > > @@ -0,0 +1,111 @@
> > > > +#!/bin/bash
> > > > +# SPDX-License-Identifier: GPL-2.0+
> > > > +# Copyright (c) 2019 Ming Lei <ming.lei@redhat.com>
> > > > +#
> > > > +# Test userspace IO on NVMe loop device
> > >
> > > This is still missing a reference to the patch it's testing.
> > >
> > > > +. tests/nvme/rc
> > >
> > > Shouldn't this be in the nvme group?
> > >
> > > > +DESCRIPTION="test userspace IO via nvme-cli read/write interface"
> > > > +QUICK=1
> > > > +
> > > > +requires() {
> > > > + _have_program nvme && _have_modules loop nvme-loop nvmet && \
> > > > + _have_configfs
> > > > +}
> > > > +
> > > > +__test_user_io()
> > > > +{
> > > > + local disk="$1"
> > > > + local start=$2
> > > > + local cnt=$3
> > > > +
> > > > + local bs=$(blockdev --getss $disk)
> > >
> > > This still has a ton of missing quoting and shellcheck errors.
> > >
> > > I fixed all of this and pushed to
> > > https://github.com/osandov/blktests/tree/user-io. Let me know if this
> > > looks fine and I'll push it to master.
>
> Yeah, it is fine for me.
>
Thanks, applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-03-25 17:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-05 1:50 [PATCH V2] blktests: add userspace IO test Ming Lei
2019-03-11 20:55 ` Omar Sandoval
2019-03-21 22:36 ` Omar Sandoval
2019-03-22 1:04 ` Ming Lei
2019-03-25 17:29 ` Omar Sandoval
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.