diff mbox series

[blktests,2/5] zbd/004: Add zone condition "Closed" for sequential write required zones

Message ID 20190220081231.15366-3-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series Fix failures found with zoned block devices | expand

Commit Message

Shin'ichiro Kawasaki Feb. 20, 2019, 8:12 a.m. UTC
The test case zbd/004 executes write operations for two sequential write
required zones across the zone boundary between them. After the write
operation, the second zone has non-zero write pointer. At that status,
the zone can have not only "Implicit Open" condition but also "Closed"
condition based on zone status management logic of the block zoned device.

Add "Closed" condition to the zone condition check logic in zbd/004. Add
ZONE_COND_CLOSED constant definition in zbd/rc.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/zbd/004 | 9 ++++++++-
 tests/zbd/rc  | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tests/zbd/004 b/tests/zbd/004
index 291626d..ac0cf50 100755
--- a/tests/zbd/004
+++ b/tests/zbd/004
@@ -83,7 +83,14 @@  test_device() {
 	_put_blkzone_report
 	_get_blkzone_report "${TEST_DEV}" || return $?
 	_check_zone_cond "${idx}" "${ZONE_COND_FULL}" || return $?
-	_check_zone_cond "$((idx+1))" "${ZONE_COND_IMPLICIT_OPEN}" || return $?
+	if ((ZONE_CONDS[idx+1] != ZONE_COND_IMPLICIT_OPEN)) && \
+		   ((ZONE_CONDS[idx+1] != ZONE_COND_CLOSED)); then
+		echo -n "Zone ${idx+1} condition is neither "
+		echo -n "${ZONE_COND_ARRAY[ZONE_COND_IMPLICIT_OPEN]} nor "
+		echo -n "${ZONE_COND_ARRAY[ZONE_COND_CLOSED]} "
+		echo "cond: ${ZONE_COND_ARRAY[ZONE_CONDS[idx+1]]}"
+		return 1
+	fi
 	if [[ ${ZONE_WPTRS[idx+1]} -ne ${phys_blk_sectors} ]]; then
 		echo -n "Unexpected write pointer for zone $((idx+1)) "
 		echo "wp: ${ZONE_WPTRS[idx+1]}"
diff --git a/tests/zbd/rc b/tests/zbd/rc
index 1d6f80a..c32bf31 100644
--- a/tests/zbd/rc
+++ b/tests/zbd/rc
@@ -39,6 +39,7 @@  export ZONE_TYPE_SEQ_WRITE_PREFERRED=3
 
 export ZONE_COND_EMPTY=1
 export ZONE_COND_IMPLICIT_OPEN=2
+export ZONE_COND_CLOSED=4
 export ZONE_COND_FULL=14
 
 export ZONE_TYPE_ARRAY=(