[dm-devel] [PATCH blktests v2] tests/dm: add a regression test

Shinichiro Kawasaki shinichiro.kawasaki at wdc.com
Mon May 1 04:34:38 UTC 2023


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



More information about the dm-devel mailing list