* [PATCH] t/zbd: Avoid magic number of test case count
@ 2019-09-26 1:00 Shin'ichiro Kawasaki
2019-09-26 6:47 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Shin'ichiro Kawasaki @ 2019-09-26 1:00 UTC (permalink / raw)
To: fio, Jens Axboe; +Cc: Damien Le Moal, Shinichiro Kawasaki
In the test script t/zbd/test-zbd-support, the number of test cases is
defined as a raw constant. Every time a new test case is added, need to
update the constant but this chore tends to be overlooked. When test
case 47 was added recently, the number was not incremented from 46. Then
the test script does not run the test case 47.
To avoid the constant increment chore, automate the test case number
counting. List bash functions which implement test cases and convert the
list to test case numbers.
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
t/zbd/test-zbd-support | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/t/zbd/test-zbd-support b/t/zbd/test-zbd-support
index 90f9f87b..5d079a8b 100755
--- a/t/zbd/test-zbd-support
+++ b/t/zbd/test-zbd-support
@@ -826,9 +826,8 @@ case "$(<"/sys/class/block/$basename/queue/zoned")" in
esac
if [ "${#tests[@]}" = 0 ]; then
- for ((i=1;i<=46;i++)); do
- tests+=("$i")
- done
+ readarray -t tests < <(declare -F | grep "test[0-9]*" | \
+ tr -c -d "[:digit:]\n" | sort -n)
fi
logfile=$0.log
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] t/zbd: Avoid magic number of test case count
2019-09-26 1:00 [PATCH] t/zbd: Avoid magic number of test case count Shin'ichiro Kawasaki
@ 2019-09-26 6:47 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-09-26 6:47 UTC (permalink / raw)
To: Shin'ichiro Kawasaki, fio; +Cc: Damien Le Moal
On 9/26/19 3:00 AM, Shin'ichiro Kawasaki wrote:
> In the test script t/zbd/test-zbd-support, the number of test cases is
> defined as a raw constant. Every time a new test case is added, need to
> update the constant but this chore tends to be overlooked. When test
> case 47 was added recently, the number was not incremented from 46. Then
> the test script does not run the test case 47.
>
> To avoid the constant increment chore, automate the test case number
> counting. List bash functions which implement test cases and convert the
> list to test case numbers.
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-26 6:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-26 1:00 [PATCH] t/zbd: Avoid magic number of test case count Shin'ichiro Kawasaki
2019-09-26 6:47 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox