]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
block: add smoke test for queue_mode=0
authorOmar Sandoval <osandov@fb.com>
Wed, 12 Sep 2018 23:55:00 +0000 (16:55 -0700)
committerOmar Sandoval <osandov@fb.com>
Wed, 12 Sep 2018 23:58:56 +0000 (16:58 -0700)
Linux kernel commit ca4b2a011948 ("null_blk: add zone support") broke
null_blk queue_mode=0. None of the existing tests use bio mode, so add a
test which does a very basic test of all modes.

Signed-off-by: Omar Sandoval <osandov@fb.com>
tests/block/023 [new file with mode: 0755]
tests/block/023.out [new file with mode: 0644]

diff --git a/tests/block/023 b/tests/block/023
new file mode 100755 (executable)
index 0000000..3d01502
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# Smoke test all null_blk queue modes. Regression test for patch "null_blk: fix
+# zoned support for non-rq based operation".
+#
+# Copyright (C) 2018 Omar Sandoval
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+. tests/block/rc
+. common/null_blk
+
+DESCRIPTION="do I/O on all null_blk queue modes"
+QUICK=1
+
+requires() {
+       _have_null_blk
+}
+
+test() {
+       echo "Running ${TEST_NAME}"
+
+       local queue_mode
+       for ((queue_mode = 0; queue_mode <= 2; queue_mode++)); do
+               if _init_null_blk gb=1 queue_mode="$queue_mode"; then
+                       echo "Queue mode $queue_mode"
+                       dd if=/dev/nullb0 of=/dev/null iflag=direct bs=64k status=none
+                       dd if=/dev/null of=/dev/nullb0 oflag=direct bs=64k status=none
+                       _exit_null_blk
+               fi
+       done
+
+       echo "Test complete"
+}
diff --git a/tests/block/023.out b/tests/block/023.out
new file mode 100644 (file)
index 0000000..a2f376d
--- /dev/null
@@ -0,0 +1,5 @@
+Running block/023
+Queue mode 0
+Queue mode 1
+Queue mode 2
+Test complete