Message ID | 20230427024126.1417646-1-yukuai1@huaweicloud.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [blktests,v2] tests/dm: add a regression test | expand |
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+
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
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 > > . >
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!
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 +}