]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
Add mandatory test description variable to tests
authorOmar Sandoval <osandov@fb.com>
Wed, 10 May 2017 07:22:20 +0000 (00:22 -0700)
committerOmar Sandoval <osandov@fb.com>
Wed, 10 May 2017 07:22:20 +0000 (00:22 -0700)
With this, we can have more meaningful output in the test logs without
having to consult the test script itself.

Signed-off-by: Omar Sandoval <osandov@fb.com>
22 files changed:
check
new
tests/block/001
tests/block/002
tests/block/003
tests/block/004
tests/block/005
tests/block/006
tests/block/007
tests/loop/001
tests/meta/001
tests/meta/002
tests/meta/003
tests/meta/004
tests/meta/005
tests/meta/006
tests/meta/007
tests/meta/008
tests/meta/009
tests/meta/010
tests/meta/011
tests/meta/012

diff --git a/check b/check
index cf9bdc47cda50cd729d7791ef0077d0797a0b19f..bac32e5d9f1cd1c001bc12ff2099bf574f7a2ca1 100755 (executable)
--- a/check
+++ b/check
@@ -80,7 +80,7 @@ _output_status() {
        local test="$1"
        local status="$2"
 
-       printf '%-25s ... %15s' "$test" ''
+       printf '%-60s' "$test ($DESCRIPTION)"
        if [[ -z $status ]]; then
                echo
                return
@@ -296,6 +296,11 @@ _run_test() {
                return
        fi
 
+       if [[ -z $DESCRIPTION ]]; then
+               _warning "${TEST_NAME} does not define DESCRIPTION"
+               return
+       fi
+
        if declare -fF test >/dev/null && declare -fF test_device >/dev/null; then
                _warning "${TEST_NAME} defines both test() and test_device()"
                return
diff --git a/new b/new
index 370ecdf26c27b43a3c4a4aef104376c5be9a78bf..d7583b354514d483e77f43ceee737b5cdc2da9b7 100755 (executable)
--- a/new
+++ b/new
@@ -128,8 +128,8 @@ done
 cat << EOF > "tests/${test_name}"
 #!/bin/bash
 #
-# TODO: provide a brief description of the test here, i.e., what it tests and
-# how. If this is a regression test for a patch, reference the patch title:
+# TODO: provide a description of the test here, i.e., what it tests and how. If
+# this is a regression test for a patch, reference the patch title:
 #
 # Regression test for patch "blk-stat: fix blk_stat_sum() if all samples are
 # batched".
@@ -160,6 +160,10 @@ cat << EOF > "tests/${test_name}"
 # describing what functionality this tests (e.g., "discard" or "hotplug"). Feel
 # free to create new groups if it makes sense.
 TEST_GROUPS=($category auto)
+# TODO: fill in a very brief description of what this test does. The
+# description should complete the sentence "This test will...". For example,
+# "run a mixed read/write workload" would be a good description.
+DESCRIPTION=""
 
 # TODO: dmesg is checked after each test run by default. You can suppress this
 # by defining:
index 8fcb006bbd095828f45ae67d064f8c0c42db941b..a3e8ae6ddc4c1998f0f64ede96e868b5a93d4e3c 100755 (executable)
@@ -22,6 +22,7 @@
 . common/scsi_debug
 
 TEST_GROUPS=(block auto hotplug)
+DESCRIPTION="stress device hotplugging"
 
 prepare() {
        _have_scsi_debug
index e86855e770ed255fe71fc1692ccca4f6d5013d96..d8f6f0c14da030274872f17655e1ac48de213ed9 100755 (executable)
@@ -21,6 +21,7 @@
 . common/scsi_debug
 
 TEST_GROUPS=(block auto quick blktrace hotplug)
+DESCRIPTION="remove a device while running blktrace"
 
 prepare() {
        _have_blktrace && _have_scsi_debug
index 1b0506cde36c5df88fc5e6e29d247afda68278fc..6c856db93474e9ef7b5ab71c35d83c69b0d530ee 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(block auto discard)
+DESCRIPTION="run various discard sizes"
 
 prepare() {
        _have_fio
index 656f26b378f10acaf02da79054091563705f790d..51a7f4fac62021a1c287c17084e274f49c9e4768 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(block auto flush)
+DESCRIPTION="run lots of flushes"
 
 prepare() {
        _have_fio
index 113e77f912b9708ca379502a3270c89035ce1d8c..b4e82cf2f1acfe47b6e468ceb68d7d51e2234e48 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(block auto sched)
+DESCRIPTION="switch schedulers while doing IO"
 
 prepare() {
        _have_fio
index beefd4a49c65135fa5e1ce1d465427c05123183d..21577f8b2f48b334d20c7f52cfdf1f1c7eaac706 100755 (executable)
@@ -21,8 +21,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(block auto)
-
-CHECK_DMESG=1
+DESCRIPTION="run null-blk in blocking mode"
 
 prepare() {
        _have_module null_blk
index 64d4165cbd4214f38f1cc4185c47e7c2425bd985..feff144b4a7ded347c57361be6ff63fd42f9a1e8 100755 (executable)
@@ -20,6 +20,7 @@
 . common/iopoll
 
 TEST_GROUPS=(block auto poll)
+DESCRIPTION="test classic and hybrid IO polling"
 
 prepare() {
        _have_fio_with_poll
index adda2ccbe977a2c2ed53b7e0fdc84c10ecec2f61..2404b77af9f4addddd21e795518ad4abcd6459b0 100755 (executable)
@@ -19,6 +19,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(loop auto quick)
+DESCRIPTION="scan loop device partitions"
 
 prepare() {
        _have_program parted
index e335e5e60110708e442333eaa4a7094c72c002d9..8e45ea7d4eb8ae5663a8d43e46756a158c796aab 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="do nothing"
 
 test() {
        echo "Running ${TEST_NAME}"
index b1c356a58c830f92e9254feee3d451eca849ae33..440f0964252d00e405de7491e124332a3fd8ab79 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="do nothing"
 
 test_device() {
        echo "Running ${TEST_NAME}"
index 4a111d15cd945bd72d8bba7363b365fc068a7794..15e4334551ea9d6893d081613bd68530a93739db 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="exit with non-zero status"
 
 test() {
        echo "Running ${TEST_NAME}"
index 08bd42333ea70d287c65142d5e76eee5b50d330b..bd3faad964de0c43018d5bbb87c186e317fc065b 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="exit with non-zero status"
 
 test_device() {
        echo "Running ${TEST_NAME}"
index 2a59640a51c76a01c3f95d619898b60e11cd3976..0b0108edfb0afe834730ef976f7f5e5f70c6dcd4 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="produce bad output"
 
 test() {
        echo '¯\_(ツ)_/¯'
index 4c915991c6bcaa2c735118cd5e7e5cc4b1673ea7..1a5958245d961e53cfac26d864240db35f207ca8 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="produce lots of bad output"
 
 test() {
        for ((i = 1; i <= 100; i++)); do
index c7b5d6832e78cdf14eb92308c02effcc6cb2a8c6..cd6bb714bfde13aa4876a16603581ad0fca7697c 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="skip in prepare()"
 
 prepare() {
        SKIP_REASON="(╯°□°)╯︵ ┻━┻"
index c1bd7b6bfa087e5112185e234e35ab28ceea92b5..8ba605eb5c0b6064d64e66baaabeae44124085bb 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="skip in prepare_device()"
 
 prepare_device() {
        SKIP_REASON="(╯°□°)╯︵ $TEST_DEV ┻━┻"
index 48048de46e9a73bb9284965c32b3876eaaf7985d..15d3d16f3282e73af7bc64f9c8df80f21aa264fc 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="check dmesg"
 
 prepare() {
        _have_writeable_kmsg
index 10f0d480837243ccd71778dd46c336be23c4f968..557c4f9cf8e12a5dbaebf3ed52539b056ad559da 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="disable check dmesg"
 CHECK_DMESG=0
 
 prepare() {
index 4cd96a83ddd24deecdcd2786bb5ccbf8c4d27abb..db22bea14b7d2ff87a46d8af7900745f7757cda5 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="filter dmesg"
 DMESG_FILTER="grep -v BUG"
 
 prepare() {
index 61cc4e9821ab7306b79177528ac7e495392da11e..fa14f1b883bde430c25e2696eea67af6f60d4695 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 TEST_GROUPS=(meta)
+DESCRIPTION="record pid"
 
 test() {
        echo "Running ${TEST_NAME}"