From: Masato Suzuki <[email protected]>

The total time spent on write I/Os for the 3 dd executions will be at most
1500 * 3 * 0.5ms = 2250ms, that is, 2.25s. Due to system overhead and
timer triggers, a total write I/O time larger than this value is generally
reported through I/O stat. However, for a system with very low overhead
and/or very precise timers, the reported value can be under 2.5s, leading
to a rounded value equal to 2s, and not the 3s expected.

To avoid the test to fail due to this problem, increase the number of write
I/Os executed so that the total exact I/O time exceeds 2.5s, leading to a
rounded value equal to 3s. The change increases the number of I/Os of the
second and third dd calls to 1800, leading to an exact write I/O time of
(1500 + 1800 * 2) * 0.5 ms = 2.55s.

Signed-off-by: Masato Suzuki <[email protected]>
---
 tests/block/024 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/block/024 b/tests/block/024
index cf14707..b40a869 100755
--- a/tests/block/024
+++ b/tests/block/024
@@ -53,9 +53,10 @@ test() {
        dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1500 
status=none
        show_times
 
+       # 1800 * 0.5 ms is 0.9 seconds.
        dd if=/dev/nullb0 of=/dev/null bs=4096 iflag=direct count=1500 
status=none &
-       dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1500 
status=none &
-       dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1500 
status=none &
+       dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1800 
status=none &
+       dd if=/dev/zero of=/dev/nullb0 bs=4096 oflag=direct count=1800 
status=none &
        wait
        show_times
 
-- 
2.20.1

Reply via email to