tests/qemu-iotests: Don't use 'seq' in the iotests
PATCH 1/1 tests/qemu-iotests: Don't use 'seq' in the iotests
The 'seq' command is not available by default on OpenBSD, so these iotests are currently failing there. It could be installed as 'gseq' from the coreutils package - but since it is using a different name there and we are running the iotests with the "bash" shell anyway, let's simply use the built-in double parentheses for the for-loops instead.
--- tests/qemu-iotests/007 | 2 +- tests/qemu-iotests/011 | 2 +- tests/qemu-iotests/032 | 2 +- tests/qemu-iotests/035 | 2 +- tests/qemu-iotests/037 | 2 +- tests/qemu-iotests/046 | 2 +- tests/qemu-iotests/common.pattern | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-)
tests/qemu-iotests/007 +1 -1
@@ -48,7 +48,7 @@ echo echo "creating image" _make_test_img 1M -for i in `seq 1 10`; do +for ((i=1;i<=10;i++)); do echo "savevm $i" $QEMU -nographic -hda "$TEST_IMG" -serial none -monitor stdio >/dev/null 2>&1 <<EOF savevm test-$i
tests/qemu-iotests/011 +1 -1
@@ -49,7 +49,7 @@ _make_test_img $size echo echo "overlapping I/O" -for i in `seq 1 10`; do +for ((i=1;i<=10;i++)); do let mb=1024*1024 let off1=$i*$mb let off2=$off1+512
tests/qemu-iotests/032 +1 -1
@@ -52,7 +52,7 @@ _make_test_img 64M # Allocate every other cluster so that afterwards a big write request will # actually loop a while and issue many I/O requests for the lower layer -for i in $(seq 0 128 4096); do echo "write ${i}k 64k"; done | $QEMU_IO "$TEST_IMG" | _filter_qemu_io +for ((i=0;i<=4096;i+=128)); do echo "write ${i}k 64k"; done | $QEMU_IO "$TEST_IMG" | _filter_qemu_io echo echo === AIO request during close ===
tests/qemu-iotests/035 +1 -1
@@ -49,7 +49,7 @@ echo "creating image" _make_test_img $size generate_requests() { - for i in $(seq 0 63); do + for ((i=0;i<=63;i++)); do echo "aio_write ${i}M 512" echo "aio_write ${i}M 512" echo "aio_write ${i}M 512"
tests/qemu-iotests/037 +1 -1
@@ -61,7 +61,7 @@ backing_io() local pattern=0 local cur_sec=0 - for i in $(seq 0 $((sectors - 1))); do + for ((i=0;i<=$((sectors - 1));i++)); do cur_sec=$((offset / 512 + i)) pattern=$(( ( (cur_sec % 256) + (cur_sec / 256)) % 256 ))
tests/qemu-iotests/046 +1 -1
@@ -55,7 +55,7 @@ backing_io() local pattern=0 local cur_sec=0 - for i in $(seq 0 $((sectors - 1))); do + for ((i=0;i<=$((sectors - 1));i++)); do cur_sec=$((offset / 65536 + i)) pattern=$(( ( (cur_sec % 128) + (cur_sec / 128)) % 128 ))
tests/qemu-iotests/common.pattern +2 -2
@@ -22,7 +22,7 @@ do_is_allocated() { local step=$3 local count=$4 - for i in `seq 1 $count`; do + for ((i=1;i<=$count;i++)); do echo alloc $(( start + (i - 1) * step )) $size done }
@@ -40,7 +40,7 @@ do_io() { local pattern=$6 echo === IO: pattern $pattern >&2 - for i in `seq 1 $count`; do + for ((i=1;i<=$count;i++)); do echo $op -P $pattern $(( start + (i - 1) * step )) $size done }
Signature · 1 line
2.21.0
Cc'ing Brad, the OpenBSD maintainer.
Quoted 119 lines · Thomas Huth
The 'seq' command is not available by default on OpenBSD, so these iotests are currently failing there. It could be installed as 'gseq' from the coreutils package - but since it is using a different name there and we are running the iotests with the "bash" shell anyway, let's simply use the built-in double parentheses for the for-loops instead.
Signed-off-by Thomas Huth <[email protected]>--- tests/qemu-iotests/007 | 2 +- tests/qemu-iotests/011 | 2 +- tests/qemu-iotests/032 | 2 +- tests/qemu-iotests/035 | 2 +- tests/qemu-iotests/037 | 2 +- tests/qemu-iotests/046 | 2 +- tests/qemu-iotests/common.pattern | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-)tests/qemu-iotests/007 +1
-1@@ -48,7 +48,7 @@ echo echo "creating image" _make_test_img 1M -for i in `seq 1 10`; do +for ((i=1;i<=10;i++)); do echo "savevm $i" $QEMU -nographic -hda "$TEST_IMG" -serial none -monitor stdio >/dev/null 2>&1 <<EOF savevm test-$itests/qemu-iotests/011 +1
-1@@ -49,7 +49,7 @@ _make_test_img $size echo echo "overlapping I/O" -for i in `seq 1 10`; do +for ((i=1;i<=10;i++)); do let mb=1024*1024 let off1=$i*$mb let off2=$off1+512tests/qemu-iotests/032 +1
-1@@ -52,7 +52,7 @@ _make_test_img 64M # Allocate every other cluster so that afterwards a big write request will # actually loop a while and issue many I/O requests for the lower layer -for i in $(seq 0 128 4096); do echo "write ${i}k 64k"; done | $QEMU_IO "$TEST_IMG" | _filter_qemu_io +for ((i=0;i<=4096;i+=128)); do echo "write ${i}k 64k"; done | $QEMU_IO "$TEST_IMG" | _filter_qemu_io echo echo === AIO request during close ===tests/qemu-iotests/035 +1
-1@@ -49,7 +49,7 @@ echo "creating image" _make_test_img $size generate_requests() { - for i in $(seq 0 63); do + for ((i=0;i<=63;i++)); do echo "aio_write ${i}M 512" echo "aio_write ${i}M 512" echo "aio_write ${i}M 512"tests/qemu-iotests/037 +1
-1@@ -61,7 +61,7 @@ backing_io() local pattern=0 local cur_sec=0 - for i in $(seq 0 $((sectors - 1))); do + for ((i=0;i<=$((sectors - 1));i++)); do cur_sec=$((offset / 512 + i)) pattern=$(( ( (cur_sec % 256) + (cur_sec / 256)) % 256 ))tests/qemu-iotests/046 +1
-1@@ -55,7 +55,7 @@ backing_io() local pattern=0 local cur_sec=0 - for i in $(seq 0 $((sectors - 1))); do + for ((i=0;i<=$((sectors - 1));i++)); do cur_sec=$((offset / 65536 + i)) pattern=$(( ( (cur_sec % 128) + (cur_sec / 128)) % 128 ))tests/qemu-iotests/common.pattern +2
-2@@ -22,7 +22,7 @@ do_is_allocated() { local step=$3 local count=$4 - for i in `seq 1 $count`; do + for ((i=1;i<=$count;i++)); do echo alloc $(( start + (i - 1) * step )) $size done }@@ -40,7 +40,7 @@ do_io() { local pattern=$6 echo === IO: pattern $pattern >&2 - for i in `seq 1 $count`; do + for ((i=1;i<=$count;i++)); do echo $op -P $pattern $(( start + (i - 1) * step )) $size done }
Quoted 23 lines · Thomas Huth
The 'seq' command is not available by default on OpenBSD, so these iotests are currently failing there. It could be installed as 'gseq' from the coreutils package - but since it is using a different name there and we are running the iotests with the "bash" shell anyway, let's simply use the built-in double parentheses for the for-loops instead.
Signed-off-by Thomas Huth <[email protected]>--- tests/qemu-iotests/007 | 2 +- tests/qemu-iotests/011 | 2 +- tests/qemu-iotests/032 | 2 +- tests/qemu-iotests/035 | 2 +- tests/qemu-iotests/037 | 2 +- tests/qemu-iotests/046 | 2 +- tests/qemu-iotests/common.pattern | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-)tests/qemu-iotests/007 +0
-0
tests/qemu-iotests/007 echo · line 51
Quoted 5 lines
tests/qemu-iotests/007 +1
-1@@ -48,7 +48,7 @@ echo echo "creating image" _make_test_img 1M -for i in `seq 1 10`; do +for ((i=1;i<=10;i++)); do
Stylistically, I would have preferred spaces after the ';'. But that's not a show-stopper.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org