Skip to contentSkip to conversation

check: add zoned sysfs node checking in _test_dev_is_zoned

PATCH Applied Yi Zhang 3 participants 3 messages Mar 22, 2019 – Mar 25, 2019 Block layer

lore
Share & tools
lore

Yi Zhang

author
#0 lore raw

PATCH 1/1 check: add zoned sysfs node checking in _test_dev_is_zoned

Some kernel may not have zoned sysfs node, e.g. RHEL7, checking if it exists first in _test_dev_is_zoned.

---
 check | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
check +1 -1
index f0ca382..459104d 100755
@@ -405,7 +405,7 @@ _call_test() {
 }
 
 _test_dev_is_zoned() {
-	if grep -qe "none" "${TEST_DEV_SYSFS}/queue/zoned" ; then
+	if [[ ! -f "${TEST_DEV_SYSFS}/queue/zoned" ]] || grep -qe "none" "${TEST_DEV_SYSFS}/queue/zoned" ; then
 		SKIP_REASON="${TEST_DEV} is not a zoned block device"
 		return 1
 	fi
Signature · 1 line
2.17.1
#1 lore raw
Quoted 13 lines · Yi Zhang

Some kernel may not have zoned sysfs node, e.g. RHEL7, checking if it exists first in _test_dev_is_zoned.

---
  check | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
check +0 -0
index f0ca382..459104d 100755

check _call_test() { · line 411

Quoted 8 lines
check +1 -1
@@ -405,7 +405,7 @@ _call_test() {
  }
 
  _test_dev_is_zoned() {
-	if grep -qe "none" "${TEST_DEV_SYSFS}/queue/zoned" ; then
+	if [[ ! -f "${TEST_DEV_SYSFS}/queue/zoned" ]] || grep -qe "none" "${TEST_DEV_SYSFS}/queue/zoned" ; then
  		SKIP_REASON="${TEST_DEV} is not a zoned block device"
  		return 1
  	fi

Hi Yi Zhang. This patch looks good for me.

I have prepared Debian oldstable environment with kernel 3.16, which does not support "zoned" sysfs attribute. With this kernel, test cases that has test_devices() function and does not have CAN_BE_ZONED=1 flag are skipped. This skip is not expected, and the patch avoids it.

Signature · 2 lines
Best Regards,
Shin'ichiro Kawasaki