All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: Omar Sandoval <osandov@osandov.com>
Cc: Linux Block Layer Mailinglist <linux-block@vger.kernel.org>,
	Linux SCSI Mailinglist <linux-scsi@vger.kernel.org>,
	Johannes Thumshirn <jthumshirn@suse.de>
Subject: [PATCH blktests v2 2/3] tests/sg: add SCSI generic test grouop
Date: Fri, 19 May 2017 15:55:30 +0200	[thread overview]
Message-ID: <adaebafc1753d10d7bbb17bcb33af0fa2e701822.1495201975.git.jthumshirn@suse.de> (raw)
In-Reply-To: <cover.1495201975.git.jthumshirn@suse.de>
In-Reply-To: <cover.1495201975.git.jthumshirn@suse.de>

Add a test group for tests of the SCSI generic driver and and
functions common to the SCSI generic driver and it's test cases.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 common/sg      | 41 +++++++++++++++++++++++++++++++++++++++++
 tests/sg/group | 28 ++++++++++++++++++++++++++++
 2 files changed, 69 insertions(+)
 create mode 100644 common/sg
 create mode 100644 tests/sg/group

diff --git a/common/sg b/common/sg
new file mode 100644
index 000000000000..123735178d96
--- /dev/null
+++ b/common/sg
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+# SCSI generic helper functions.
+#
+# Copyright (C) 2017 Johannes Thumshirn
+#
+# 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/>.
+
+_have_scsi_generic() {
+	_have_module sg
+}
+
+_test_dev_is_scsi() {
+
+	local DEV="$1"
+
+	if [[ -d "/sys/block/$DEV/device/scsi_device" ]]; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+_get_sg_from_blockdev()
+{
+	local sg_path="/sys/block/$1/device/scsi_generic/"
+	local sg_dev=$(ls $sg_path | grep -E 'sg[0-9]+') 
+
+	echo "$sg_dev"
+}
diff --git a/tests/sg/group b/tests/sg/group
new file mode 100644
index 000000000000..3121d799fe25
--- /dev/null
+++ b/tests/sg/group
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# Regression tests for SCSI generic device
+#
+# Copyright (C) 2017 Johannes Thumshirn <jthumshirn@suse.de>
+#
+# 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/>.
+
+. common/sg
+
+group_requires() {
+	_have_scsi_generic
+}
+
+group_device_requires() {
+	_test_dev_is_scsi
+}
-- 
2.12.0

  parent reply	other threads:[~2017-05-19 13:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-19 13:55 [PATCH blktests v2 0/3] Add SCSI generic test group Johannes Thumshirn
2017-05-19 13:55 ` [PATCH blktests v2 1/3] Add ability to build test-cases Johannes Thumshirn
2017-05-19 13:55 ` Johannes Thumshirn [this message]
2017-05-19 13:55 ` [PATCH blktests v2 3/3] sg/001: add regression test for syzcaller generated GPF in sg_read path Johannes Thumshirn
2017-05-22 17:59   ` Omar Sandoval
2017-05-23  6:58     ` Johannes Thumshirn
2017-05-23 14:15       ` Jens Axboe
2017-05-23 14:25         ` Johannes Thumshirn
2017-05-23 14:39           ` Jens Axboe
2017-05-23 14:46             ` Johannes Thumshirn
2017-06-07  6:44 ` [PATCH blktests v2 0/3] Add SCSI generic test group Omar Sandoval
2017-06-07  7:03   ` Johannes Thumshirn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adaebafc1753d10d7bbb17bcb33af0fa2e701822.1495201975.git.jthumshirn@suse.de \
    --to=jthumshirn@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=osandov@osandov.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.