All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH blktests v2] tests/dm: add a regression test
@ 2023-04-27  2:41 ` Yu Kuai
  0 siblings, 0 replies; 10+ messages in thread
From: Yu Kuai @ 2023-04-27  2:41 UTC (permalink / raw)
  To: shinichiro, snitzer, linux-block, dm-devel

From: Yu Kuai <yukuai3@huawei.com>

Verify that reload a dm with maps to itself will fail.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 tests/dm/001     | 29 +++++++++++++++++++++++++++++
 tests/dm/001.out |  2 ++
 tests/dm/rc      | 13 +++++++++++++
 3 files changed, 44 insertions(+)
 create mode 100644 tests/dm/001
 create mode 100644 tests/dm/001.out
 create mode 100644 tests/dm/rc

diff --git a/tests/dm/001 b/tests/dm/001
new file mode 100644
index 0000000..6deab1f
--- /dev/null
+++ b/tests/dm/001
@@ -0,0 +1,29 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 Yu Kuai
+#
+# Regression test for commit 077a4033541f ("block: don't allow a disk link
+# holder to itself")
+
+. tests/dm/rc
+
+DESCRIPTION="reload a dm with maps to itself"
+QUICK=1
+
+requires() {
+	_have_kver 6 2
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+
+	dmsetup create test --table "0 8192 linear ${TEST_DEV} 0"
+	dmsetup suspend test
+	dmsetup reload test --table "0 8192 linear /dev/mapper/test 0" &> /dev/null
+	if [ $? -eq 0 ]; then
+		echo "reload a dm with maps to itself succeed."
+	fi
+	dmsetup remove test
+
+	echo "Test complete"
+}
diff --git a/tests/dm/001.out b/tests/dm/001.out
new file mode 100644
index 0000000..4bd2c08
--- /dev/null
+++ b/tests/dm/001.out
@@ -0,0 +1,2 @@
+Running dm/001
+Test complete
diff --git a/tests/dm/rc b/tests/dm/rc
new file mode 100644
index 0000000..0486db0
--- /dev/null
+++ b/tests/dm/rc
@@ -0,0 +1,13 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 Yu Kuai
+#
+# Tests for device-mapper
+
+. common/rc
+
+group_requires() {
+	_have_root
+	_have_program dmsetup
+	_have_driver dm-mod
+}
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [dm-devel] [PATCH blktests v2] tests/dm: add a regression test
@ 2023-04-27  2:41 ` Yu Kuai
  0 siblings, 0 replies; 10+ messages in thread
From: Yu Kuai @ 2023-04-27  2:41 UTC (permalink / raw)
  To: shinichiro, snitzer, linux-block, dm-devel

From: Yu Kuai <yukuai3@huawei.com>

Verify that reload a dm with maps to itself will fail.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 tests/dm/001     | 29 +++++++++++++++++++++++++++++
 tests/dm/001.out |  2 ++
 tests/dm/rc      | 13 +++++++++++++
 3 files changed, 44 insertions(+)
 create mode 100644 tests/dm/001
 create mode 100644 tests/dm/001.out
 create mode 100644 tests/dm/rc

diff --git a/tests/dm/001 b/tests/dm/001
new file mode 100644
index 0000000..6deab1f
--- /dev/null
+++ b/tests/dm/001
@@ -0,0 +1,29 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 Yu Kuai
+#
+# Regression test for commit 077a4033541f ("block: don't allow a disk link
+# holder to itself")
+
+. tests/dm/rc
+
+DESCRIPTION="reload a dm with maps to itself"
+QUICK=1
+
+requires() {
+	_have_kver 6 2
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+
+	dmsetup create test --table "0 8192 linear ${TEST_DEV} 0"
+	dmsetup suspend test
+	dmsetup reload test --table "0 8192 linear /dev/mapper/test 0" &> /dev/null
+	if [ $? -eq 0 ]; then
+		echo "reload a dm with maps to itself succeed."
+	fi
+	dmsetup remove test
+
+	echo "Test complete"
+}
diff --git a/tests/dm/001.out b/tests/dm/001.out
new file mode 100644
index 0000000..4bd2c08
--- /dev/null
+++ b/tests/dm/001.out
@@ -0,0 +1,2 @@
+Running dm/001
+Test complete
diff --git a/tests/dm/rc b/tests/dm/rc
new file mode 100644
index 0000000..0486db0
--- /dev/null
+++ b/tests/dm/rc
@@ -0,0 +1,13 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 Yu Kuai
+#
+# Tests for device-mapper
+
+. common/rc
+
+group_requires() {
+	_have_root
+	_have_program dmsetup
+	_have_driver dm-mod
+}
-- 
2.39.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH blktests v2] tests/dm: add a regression test
  2023-04-27  2:41 ` [dm-devel] " Yu Kuai
@ 2023-04-29 14:27   ` kernel test robot
  -1 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2023-04-29 14:27 UTC (permalink / raw)
  To: Yu Kuai, shinichiro, snitzer, linux-block, dm-devel; +Cc: oe-kbuild-all

Hi Yu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on device-mapper-dm/for-next]
[also build test WARNING on linus/master v6.3 next-20230428]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yu-Kuai/tests-dm-add-a-regression-test/20230427-104508
base:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
patch link:    https://lore.kernel.org/r/20230427024126.1417646-1-yukuai1%40huaweicloud.com
patch subject: [PATCH blktests v2] tests/dm: add a regression test
reproduce:
        scripts/spdxcheck.py

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304292230.Ai7aIFbo-lkp@intel.com/

spdxcheck warnings: (new ones prefixed by >>)
>> tests/dm/001: 2:27 Invalid License ID: GPL-3.0+
>> tests/dm/rc: 2:27 Invalid License ID: GPL-3.0+

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dm-devel] [PATCH blktests v2] tests/dm: add a regression test
@ 2023-04-29 14:27   ` kernel test robot
  0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2023-04-29 14:27 UTC (permalink / raw)
  To: Yu Kuai, shinichiro, snitzer, linux-block, dm-devel; +Cc: oe-kbuild-all

Hi Yu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on device-mapper-dm/for-next]
[also build test WARNING on linus/master v6.3 next-20230428]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yu-Kuai/tests-dm-add-a-regression-test/20230427-104508
base:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
patch link:    https://lore.kernel.org/r/20230427024126.1417646-1-yukuai1%40huaweicloud.com
patch subject: [PATCH blktests v2] tests/dm: add a regression test
reproduce:
        scripts/spdxcheck.py

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304292230.Ai7aIFbo-lkp@intel.com/

spdxcheck warnings: (new ones prefixed by >>)
>> tests/dm/001: 2:27 Invalid License ID: GPL-3.0+
>> tests/dm/rc: 2:27 Invalid License ID: GPL-3.0+

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH blktests v2] tests/dm: add a regression test
  2023-04-27  2:41 ` [dm-devel] " Yu Kuai
@ 2023-05-01  4:34   ` Shinichiro Kawasaki
  -1 siblings, 0 replies; 10+ messages in thread
From: Shinichiro Kawasaki @ 2023-05-01  4:34 UTC (permalink / raw)
  To: Yu Kuai; +Cc: shinichiro, snitzer, linux-block, dm-devel

Yu, thanks for the patch. I have three minor comments below. Other than that,
the patch looks good to me. If you do not mind, I can do these edits. Please let
me know your thoughts.

1) Let's describe a bit more in the commit title, like,
   "tests/dm: add dm test group and a test for self-map"
2) From historical reason, we add executable mode to the test script files.
   Let's add the file mode 755 to the tests/dm/001 file.
3) Please run "make check" to find script issues. With the command, shellcheck
   reports a warning:

   tests/dm/001:23:7: note: Check exit code directly with e.g. 'if mycmd;', not indirectly
   with $?. [SC2181]

A hunk below will avoid the warning.

diff --git a/tests/dm/001 b/tests/dm/001
index 09731d8..f69f30f 100644
--- a/tests/dm/001
+++ b/tests/dm/001
@@ -19,8 +19,8 @@ test_device() {
 
 	dmsetup create test --table "0 8192 linear ${TEST_DEV} 0"
 	dmsetup suspend test
-	dmsetup reload test --table "0 8192 linear /dev/mapper/test 0" &> /dev/null
-	if [ $? -eq 0 ]; then
+	if dmsetup reload test --table "0 8192 linear /dev/mapper/test 0" \
+	   &> /dev/null; then
 		echo "reload a dm with maps to itself succeed."
 	fi
 	dmsetup remove test

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [dm-devel] [PATCH blktests v2] tests/dm: add a regression test
@ 2023-05-01  4:34   ` Shinichiro Kawasaki
  0 siblings, 0 replies; 10+ messages in thread
From: Shinichiro Kawasaki @ 2023-05-01  4:34 UTC (permalink / raw)
  To: Yu Kuai; +Cc: linux-block, dm-devel, snitzer, shinichiro

Yu, thanks for the patch. I have three minor comments below. Other than that,
the patch looks good to me. If you do not mind, I can do these edits. Please let
me know your thoughts.

1) Let's describe a bit more in the commit title, like,
   "tests/dm: add dm test group and a test for self-map"
2) From historical reason, we add executable mode to the test script files.
   Let's add the file mode 755 to the tests/dm/001 file.
3) Please run "make check" to find script issues. With the command, shellcheck
   reports a warning:

   tests/dm/001:23:7: note: Check exit code directly with e.g. 'if mycmd;', not indirectly
   with $?. [SC2181]

A hunk below will avoid the warning.

diff --git a/tests/dm/001 b/tests/dm/001
index 09731d8..f69f30f 100644
--- a/tests/dm/001
+++ b/tests/dm/001
@@ -19,8 +19,8 @@ test_device() {
 
 	dmsetup create test --table "0 8192 linear ${TEST_DEV} 0"
 	dmsetup suspend test
-	dmsetup reload test --table "0 8192 linear /dev/mapper/test 0" &> /dev/null
-	if [ $? -eq 0 ]; then
+	if dmsetup reload test --table "0 8192 linear /dev/mapper/test 0" \
+	   &> /dev/null; then
 		echo "reload a dm with maps to itself succeed."
 	fi
 	dmsetup remove test

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH blktests v2] tests/dm: add a regression test
  2023-05-01  4:34   ` [dm-devel] " Shinichiro Kawasaki
@ 2023-05-04  3:18     ` Yu Kuai
  -1 siblings, 0 replies; 10+ messages in thread
From: Yu Kuai @ 2023-05-04  3:18 UTC (permalink / raw)
  To: Shinichiro Kawasaki, Yu Kuai
  Cc: shinichiro, snitzer, linux-block, dm-devel, yukuai (C)

Hi,

在 2023/05/01 12:34, Shinichiro Kawasaki 写道:
> Yu, thanks for the patch. I have three minor comments below. Other than that,
> the patch looks good to me. If you do not mind, I can do these edits. Please let
> me know your thoughts.

I'm good with your comments.

Thanks,
Kuai
> 
> 1) Let's describe a bit more in the commit title, like,
>     "tests/dm: add dm test group and a test for self-map"
> 2) From historical reason, we add executable mode to the test script files.
>     Let's add the file mode 755 to the tests/dm/001 file.
> 3) Please run "make check" to find script issues. With the command, shellcheck
>     reports a warning:
> 
>     tests/dm/001:23:7: note: Check exit code directly with e.g. 'if mycmd;', not indirectly
>     with $?. [SC2181]
> 
> A hunk below will avoid the warning.
> 
> diff --git a/tests/dm/001 b/tests/dm/001
> index 09731d8..f69f30f 100644
> --- a/tests/dm/001
> +++ b/tests/dm/001
> @@ -19,8 +19,8 @@ test_device() {
>   
>   	dmsetup create test --table "0 8192 linear ${TEST_DEV} 0"
>   	dmsetup suspend test
> -	dmsetup reload test --table "0 8192 linear /dev/mapper/test 0" &> /dev/null
> -	if [ $? -eq 0 ]; then
> +	if dmsetup reload test --table "0 8192 linear /dev/mapper/test 0" \
> +	   &> /dev/null; then
>   		echo "reload a dm with maps to itself succeed."
>   	fi
>   	dmsetup remove test
> 
> .
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dm-devel] [PATCH blktests v2] tests/dm: add a regression test
@ 2023-05-04  3:18     ` Yu Kuai
  0 siblings, 0 replies; 10+ messages in thread
From: Yu Kuai @ 2023-05-04  3:18 UTC (permalink / raw)
  To: Shinichiro Kawasaki, Yu Kuai
  Cc: linux-block, yukuai (C), dm-devel, snitzer, shinichiro

Hi,

在 2023/05/01 12:34, Shinichiro Kawasaki 写道:
> Yu, thanks for the patch. I have three minor comments below. Other than that,
> the patch looks good to me. If you do not mind, I can do these edits. Please let
> me know your thoughts.

I'm good with your comments.

Thanks,
Kuai
> 
> 1) Let's describe a bit more in the commit title, like,
>     "tests/dm: add dm test group and a test for self-map"
> 2) From historical reason, we add executable mode to the test script files.
>     Let's add the file mode 755 to the tests/dm/001 file.
> 3) Please run "make check" to find script issues. With the command, shellcheck
>     reports a warning:
> 
>     tests/dm/001:23:7: note: Check exit code directly with e.g. 'if mycmd;', not indirectly
>     with $?. [SC2181]
> 
> A hunk below will avoid the warning.
> 
> diff --git a/tests/dm/001 b/tests/dm/001
> index 09731d8..f69f30f 100644
> --- a/tests/dm/001
> +++ b/tests/dm/001
> @@ -19,8 +19,8 @@ test_device() {
>   
>   	dmsetup create test --table "0 8192 linear ${TEST_DEV} 0"
>   	dmsetup suspend test
> -	dmsetup reload test --table "0 8192 linear /dev/mapper/test 0" &> /dev/null
> -	if [ $? -eq 0 ]; then
> +	if dmsetup reload test --table "0 8192 linear /dev/mapper/test 0" \
> +	   &> /dev/null; then
>   		echo "reload a dm with maps to itself succeed."
>   	fi
>   	dmsetup remove test
> 
> .
> 

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH blktests v2] tests/dm: add a regression test
  2023-05-04  3:18     ` [dm-devel] " Yu Kuai
@ 2023-05-05  7:22       ` Shinichiro Kawasaki
  -1 siblings, 0 replies; 10+ messages in thread
From: Shinichiro Kawasaki @ 2023-05-05  7:22 UTC (permalink / raw)
  To: Yu Kuai; +Cc: shinichiro, snitzer, linux-block, dm-devel, yukuai (C)

On May 04, 2023 / 11:18, Yu Kuai wrote:
> Hi,
> 
> 在 2023/05/01 12:34, Shinichiro Kawasaki 写道:
> > Yu, thanks for the patch. I have three minor comments below. Other than that,
> > the patch looks good to me. If you do not mind, I can do these edits. Please let
> > me know your thoughts.
> 
> I'm good with your comments.

All right, I've applied the patches with the edits. Thanks!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dm-devel] [PATCH blktests v2] tests/dm: add a regression test
@ 2023-05-05  7:22       ` Shinichiro Kawasaki
  0 siblings, 0 replies; 10+ messages in thread
From: Shinichiro Kawasaki @ 2023-05-05  7:22 UTC (permalink / raw)
  To: Yu Kuai; +Cc: linux-block, yukuai (C), dm-devel, snitzer, shinichiro

On May 04, 2023 / 11:18, Yu Kuai wrote:
> Hi,
> 
> 在 2023/05/01 12:34, Shinichiro Kawasaki 写道:
> > Yu, thanks for the patch. I have three minor comments below. Other than that,
> > the patch looks good to me. If you do not mind, I can do these edits. Please let
> > me know your thoughts.
> 
> I'm good with your comments.

All right, I've applied the patches with the edits. Thanks!
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-05-09  0:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-27  2:41 [PATCH blktests v2] tests/dm: add a regression test Yu Kuai
2023-04-27  2:41 ` [dm-devel] " Yu Kuai
2023-04-29 14:27 ` kernel test robot
2023-04-29 14:27   ` [dm-devel] " kernel test robot
2023-05-01  4:34 ` Shinichiro Kawasaki
2023-05-01  4:34   ` [dm-devel] " Shinichiro Kawasaki
2023-05-04  3:18   ` Yu Kuai
2023-05-04  3:18     ` [dm-devel] " Yu Kuai
2023-05-05  7:22     ` Shinichiro Kawasaki
2023-05-05  7:22       ` [dm-devel] " Shinichiro Kawasaki

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.