diff options
author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2011-02-04 12:55:02 +0000 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-02-23 10:29:46 +0100 |
commit | dd0c35d69b31cfccaca30842787f0450ab70056c (patch) | |
tree | 1e0e01e85f5c4e01b973670b701dd6823e5abe68 /tests/qemu-iotests/028 | |
parent | 9cdfa1b34e22bc09e80042b1ef3e4a5096f260d5 (diff) |
qemu-iotests: Use zero-based offsets for IO patterns
The io_pattern style functions have the following loop:
for i in `seq 1 $count`; do
echo ... $(( start + i * step )) ...
done
Offsets are 1-based so start=1024, step=512, count=4 yields:
1536, 2048, 2560, 3072
Normally we expect:
1024, 1536, 2048, 2560
Most tests ignore this detail, which means that they perform I/O to a
slightly different range than expected by the test author.
Later on things got less innocent and tests started trying to compensate
for the 1-based indexing. This included negative start values in test
024 and my own attempt with count-1 in test 028!
The end result is that tests that use io_pattern are hard to reason
about and don't work the way you'd expect. It's time to clean this mess
up.
This patch switches io_pattern to 0-based offsets. This requires
adjusting the golden outputs since I/O ranges are now shifted and output
differs.
Verifying these output diffs is easy, however. Each diff hunk moves one
I/O from beyond the end of the pattern range to the beginning.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'tests/qemu-iotests/028')
-rwxr-xr-x | tests/qemu-iotests/028 | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028 index 8321c93d46..07c5bb6975 100755 --- a/tests/qemu-iotests/028 +++ b/tests/qemu-iotests/028 @@ -64,7 +64,7 @@ echo "Filling base image" echo # Fill end of base image with a pattern, skipping every other sector -io writev $offset 512 1024 31 +io writev $offset 512 1024 32 _check_test_img @@ -78,7 +78,7 @@ echo "Filling test image" echo # Write every other sector around where the base image ends -io writev $(( offset + 512 )) 512 1024 63 +io writev $(( offset + 512 )) 512 1024 64 _check_test_img @@ -86,13 +86,13 @@ echo "Reading" echo # Base image sectors -io readv $(( offset )) 512 1024 31 +io readv $(( offset )) 512 1024 32 # Image sectors -io readv $(( offset + 512 )) 512 1024 63 +io readv $(( offset + 512 )) 512 1024 64 # Zero sectors beyond end of base image -io_zero readv $(( offset + 32 * 1024 )) 512 1024 31 +io_zero readv $(( offset + 32 * 1024 )) 512 1024 32 _check_test_img |