t/zbd: Combine write and read fio commands for test case #15
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Wed, 15 Jul 2020 04:13:19 +0000 (13:13 +0900)
committerJens Axboe <axboe@kernel.dk>
Fri, 17 Jul 2020 13:32:12 +0000 (07:32 -0600)
The test case #15 called fio twice. Once with write job to prepare data
to read. The other with read job for testing. But the first run has no
effect on the second run when the zone status is reinitialized.

Specify both the write job and the read job to a single fio command using
write_and_run_one_fio_job() helper function instead of run_one_fio_job().

Also apply same test pass condition for both regular block devices and
zoned block devices.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
t/zbd/test-zbd-support

index eccb5178625d71668eaae2fedb33d498a033d006..cd8492ff335eed8c1294026a2b115f2267485b1a 100755 (executable)
@@ -349,30 +349,24 @@ test14() {
 # Sequential read on a mix of empty and full zones.
 test15() {
     local i off size
+    local w_off w_size
 
     for ((i=0;i<4;i++)); do
        [ -n "$is_zbd" ] &&
            reset_zone "$dev" $((first_sequential_zone_sector +
                                 i*sectors_per_zone))
     done
-    off=$(((first_sequential_zone_sector + 2 * sectors_per_zone) * 512))
-    size=$((2 * zone_size))
-    run_one_fio_job "$(ioengine "psync")" --rw=write --bs=$((zone_size / 16))\
-                   --zonemode=zbd --zonesize="${zone_size}" --offset=$off \
-                   --size=$size >>"${logfile}.${test_number}" 2>&1 ||
-       return $?
-    check_written $size || return $?
+    w_off=$(((first_sequential_zone_sector + 2 * sectors_per_zone) * 512))
+    w_size=$((2 * zone_size))
     off=$((first_sequential_zone_sector * 512))
     size=$((4 * zone_size))
-    run_one_fio_job "$(ioengine "psync")" --rw=read --bs=$((zone_size / 16)) \
+    write_and_run_one_fio_job "${w_off}" "${w_size}" \
+                   "$(ioengine "psync")" --rw=read --bs=$((zone_size / 16)) \
                    --zonemode=zbd --zonesize="${zone_size}" --offset=$off \
                    --size=$((size)) >>"${logfile}.${test_number}" 2>&1 ||
        return $?
-    if [ -n "$is_zbd" ]; then
-       check_read $((size / 2))
-    else
-       check_read $size
-    fi
+    check_written $((w_size)) || return $?
+    check_read $((size / 2))
 }
 
 # Random read on a mix of empty and full zones. Must be run after test15.