t/zbd/functions: Make fio_reset_count() return 0 if no resets occurred
authorBart Van Assche <bvanassche@acm.org>
Fri, 28 Sep 2018 21:51:28 +0000 (14:51 -0700)
committerJens Axboe <axboe@kernel.dk>
Sat, 29 Sep 2018 21:16:18 +0000 (15:16 -0600)
This patch avoids that certain bash versions report the following complaint:

t/zbd/test-zbd-support: line 69: [: : integer expression expected

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
t/zbd/functions

index 95f9bf456b9a190ebde9461aebf378457bf316cd..173f0ca64a421dcb863e124b2effe5b42c0bd08c 100644 (file)
@@ -102,5 +102,8 @@ fio_written() {
 }
 
 fio_reset_count() {
-    sed -n 's/^.*write:[^;]*; \([0-9]*\) zone resets$/\1/p'
+    local count
+
+    count=$(sed -n 's/^.*write:[^;]*; \([0-9]*\) zone resets$/\1/p')
+    echo "${count:-0}"
 }