Skip to content

Commit

Permalink
t/zbd: skip tests that need too many sequential zones
Browse files Browse the repository at this point in the history
Test cases #3, #4, #28, #29 and #48 require rather large numbers of
sequential zones to run properly and they fail if the test target
device has not enough of such zones in its zone configuration.

Check how many sequential zones are present on the test device and
skip any test cases for which this number is not enough.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
kawasaki authored and axboe committed Jan 29, 2021
1 parent d480b01 commit 1200ac6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions t/zbd/test-zbd-support
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,17 @@ require_regular_block_dev() {
return 0
}

require_seq_zones() {
local req_seq_zones=${1}
local seq_bytes=$((disk_size - first_sequential_zone_sector * 512))

if ((req_seq_zones > seq_bytes / zone_size)); then
SKIP_REASON="$dev does not have $req_seq_zones sequential zones"
return 1
fi
return 0
}

# Check whether buffered writes are refused.
test1() {
run_fio --name=job1 --filename="$dev" --rw=write --direct=0 --bs=4K \
Expand Down Expand Up @@ -265,6 +276,7 @@ test2() {
test3() {
local off opts=() rc

require_seq_zones 129 || return $SKIP_TESTCASE
off=$((first_sequential_zone_sector * 512 + 128 * zone_size))
size=$((zone_size))
[ -n "$is_zbd" ] && reset_zone "$dev" $((off / 512))
Expand All @@ -282,6 +294,7 @@ test3() {
test4() {
local off opts=()

require_seq_zones 130 || return $SKIP_TESTCASE
off=$((first_sequential_zone_sector * 512 + 129 * zone_size))
size=$((zone_size))
[ -n "$is_zbd" ] && reset_zone "$dev" $((off / 512))
Expand Down Expand Up @@ -631,6 +644,7 @@ test27() {
test28() {
local i jobs=16 off opts

require_seq_zones 65 || return $SKIP_TESTCASE
off=$((first_sequential_zone_sector * 512 + 64 * zone_size))
[ -n "$is_zbd" ] && reset_zone "$dev" $((off / 512))
prep_write
Expand All @@ -655,6 +669,7 @@ test28() {
test29() {
local i jobs=16 off opts=()

require_seq_zones 80 || return $SKIP_TESTCASE
off=$((first_sequential_zone_sector * 512 + 64 * zone_size))
size=$((16*zone_size))
prep_write
Expand Down Expand Up @@ -931,6 +946,7 @@ test48() {
local i jobs=16 off opts=()

require_zbd || return $SKIP_TESTCASE
require_seq_zones 80 || return $SKIP_TESTCASE

off=$((first_sequential_zone_sector * 512 + 64 * zone_size))
size=$((16*zone_size))
Expand Down

0 comments on commit 1200ac6

Please sign in to comment.