qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-block@nongnu.org, qemu-devel@nongnu.org, alex.bennee@linaro.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	peter.maydell@linaro.org, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH] tests/qemu-iotests: Don't use 'seq' in the iotests
Date: Tue, 23 Jul 2019 13:12:01 +0200	[thread overview]
Message-ID: <20190723111201.1926-1-thuth@redhat.com> (raw)

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 <thuth@redhat.com>
---
 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(-)

diff --git a/tests/qemu-iotests/007 b/tests/qemu-iotests/007
index 6abd402423..7d3544b479 100755
--- a/tests/qemu-iotests/007
+++ b/tests/qemu-iotests/007
@@ -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
diff --git a/tests/qemu-iotests/011 b/tests/qemu-iotests/011
index 8b1fce069a..56f704b5b9 100755
--- a/tests/qemu-iotests/011
+++ b/tests/qemu-iotests/011
@@ -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
diff --git a/tests/qemu-iotests/032 b/tests/qemu-iotests/032
index 23c216c549..988a8c5d8f 100755
--- a/tests/qemu-iotests/032
+++ b/tests/qemu-iotests/032
@@ -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 ===
diff --git a/tests/qemu-iotests/035 b/tests/qemu-iotests/035
index ad6fa3115a..d950a0dd1e 100755
--- a/tests/qemu-iotests/035
+++ b/tests/qemu-iotests/035
@@ -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"
diff --git a/tests/qemu-iotests/037 b/tests/qemu-iotests/037
index 819a2a52d2..4946b9be92 100755
--- a/tests/qemu-iotests/037
+++ b/tests/qemu-iotests/037
@@ -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 ))
 
diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046
index 543355c64f..4e03ead7b1 100755
--- a/tests/qemu-iotests/046
+++ b/tests/qemu-iotests/046
@@ -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 ))
 
diff --git a/tests/qemu-iotests/common.pattern b/tests/qemu-iotests/common.pattern
index 25aa0d01c1..4f5e5bcea0 100644
--- a/tests/qemu-iotests/common.pattern
+++ b/tests/qemu-iotests/common.pattern
@@ -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
 }
-- 
2.21.0



             reply	other threads:[~2019-07-23 11:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23 11:12 Thomas Huth [this message]
2019-07-23 11:19 ` [Qemu-devel] [PATCH] tests/qemu-iotests: Don't use 'seq' in the iotests Philippe Mathieu-Daudé
2019-07-23 13:32 ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190723111201.1926-1-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).