]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
common: Add _test_dev_is_partition() helper function
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 5 Mar 2019 05:24:46 +0000 (14:24 +0900)
committerOmar Sandoval <osandov@fb.com>
Thu, 7 Mar 2019 19:24:23 +0000 (11:24 -0800)
To control test conditions unique for partition devices, introduce the
_test_dev_is_partition() helper function. Refer TEST_DEV_PART_SYSFS
variable to tell if the TEST_DEV is a partition device or not.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
common/rc

index 153a3235851961ab30eaf7b61ab8740980e75920..0c354a26ded4812eea2b01d562113d49eb63bd83 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -208,6 +208,14 @@ _test_dev_in_hotplug_slot() {
        return 0
 }
 
+_test_dev_is_partition() {
+       if [[ -z ${TEST_DEV_PART_SYSFS} ]]; then
+               SKIP_REASON="${TEST_DEV} is not a partition device"
+               return 1
+       fi
+       return 0
+}
+
 # Older versions of xfs_io use pwrite64 and such, so the error messages won't
 # match current versions of xfs_io. See c52086226bc6 ("filter: xfs_io output
 # has dropped "64" from error messages") in xfstests.