]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
scsi: regression test for SCSI device blacklisting
authorHannes Reinecke <hare@suse.de>
Wed, 9 Aug 2017 10:50:06 +0000 (12:50 +0200)
committerOmar Sandoval <osandov@fb.com>
Fri, 29 Jun 2018 07:16:37 +0000 (00:16 -0700)
SCSI device blacklisting seems to be a tricky subject, with lots of
potential for messing up the selection algorithm. This adds a test for
catching regressions here.

Signed-off-by: Hannes Reinecke <hare@suse.com>
[Omar: updated to use improved scsi_debug helpers]
Signed-off-by: Omar Sandoval <osandov@fb.com>
tests/scsi/005 [new file with mode: 0644]
tests/scsi/005.out [new file with mode: 0644]

diff --git a/tests/scsi/005 b/tests/scsi/005
new file mode 100644 (file)
index 0000000..98b22d0
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# Regression test for patch "scsi_devinfo: fixup string compare".
+#
+# Copyright (C) 2017 Hannes Reinecke, SUSE Linux GmbH
+#
+# 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/scsi/rc
+. common/scsi_debug
+
+DESCRIPTION="test SCSI device blacklisting"
+QUICK=1
+
+requires() {
+       _have_scsi_debug && _have_module_param scsi_debug inq_vendor
+}
+
+test() {
+       echo "Running ${TEST_NAME}"
+
+       local inqs=(
+               "                        "
+               "AAAAAAAABBBBBBBBBBBBBBBB"
+               "HITACHI OPEN-V          "
+               "        Scanner         "
+               "Inateck                 "
+               "Promise STEX            "
+               "HITA    OPEN-V          "
+               "ABCD    Scanner         "
+       )
+
+       local inq vendor model blacklist
+       for inq in "${inqs[@]}"; do
+               vendor="${inq:0:8}"
+               model="${inq:8:16}"
+               if ! _init_scsi_debug inq_vendor="$vendor" inq_product="$model"; then
+                       continue
+               fi
+               vendor="$(cat "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/vendor")"
+               model="$(cat "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/model")"
+               blacklist="$(cat "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/blacklist")"
+               echo "$vendor $model $blacklist"
+               _exit_scsi_debug
+       done
+
+       echo "Test complete"
+       return 0
+}
diff --git a/tests/scsi/005.out b/tests/scsi/005.out
new file mode 100644 (file)
index 0000000..a0d2116
--- /dev/null
@@ -0,0 +1,10 @@
+Running scsi/005
+                          
+AAAAAAAA BBBBBBBBBBBBBBBB 
+HITACHI  OPEN-V           REPORTLUN2 TRY_VPD_PAGES
+         Scanner          NOLUN
+Inateck                   
+Promise  STEX             SPARSELUN
+HITA     OPEN-V           
+ABCD     Scanner          
+Test complete