qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-block@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: [PATCH 1/6] tests/qemu-iotests: Improve the check for GNU sed
Date: Tue,  8 Feb 2022 11:13:06 +0100	[thread overview]
Message-ID: <20220208101311.1511083-2-thuth@redhat.com> (raw)
In-Reply-To: <20220208101311.1511083-1-thuth@redhat.com>

Instead of failing the iotests if GNU sed is not available (or skipping
them completely in the check-block.sh script), it would be better to
simply skip the bash-based tests, so that the python-based tests could
still be run. Thus add the check for BusyBox sed to common.rc and mark
the tests as "not run" if GNU sed is not available. Then we can also
remove the sed checks from the check-block.sh script.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/check-block.sh         | 12 ------------
 tests/qemu-iotests/common.rc | 26 +++++++++++++-------------
 2 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/tests/check-block.sh b/tests/check-block.sh
index 720a46bc36..af0c574812 100755
--- a/tests/check-block.sh
+++ b/tests/check-block.sh
@@ -52,18 +52,6 @@ if LANG=C bash --version | grep -q 'GNU bash, version [123]' ; then
     skip "bash version too old ==> Not running the qemu-iotests."
 fi
 
-if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then
-    if ! command -v gsed >/dev/null 2>&1; then
-        skip "GNU sed not available ==> Not running the qemu-iotests."
-    fi
-else
-    # Double-check that we're not using BusyBox' sed which says
-    # that "This is not GNU sed version 4.0" ...
-    if sed --version | grep -q 'not GNU sed' ; then
-        skip "BusyBox sed not supported ==> Not running the qemu-iotests."
-    fi
-fi
-
 cd tests/qemu-iotests
 
 # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 9885030b43..9ea504810c 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -17,17 +17,27 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+# bail out, setting up .notrun file
+_notrun()
+{
+    echo "$*" >"$OUTPUT_DIR/$seq.notrun"
+    echo "$seq not run: $*"
+    status=0
+    exit
+}
+
+# We need GNU sed for the iotests. Make sure to not use BusyBox sed
+# which says that "This is not GNU sed version 4.0"
 SED=
 for sed in sed gsed; do
-    ($sed --version | grep 'GNU sed') > /dev/null 2>&1
+    ($sed --version | grep -v "not GNU sed" | grep 'GNU sed') > /dev/null 2>&1
     if [ "$?" -eq 0 ]; then
         SED=$sed
         break
     fi
 done
 if [ -z "$SED" ]; then
-    echo "$0: GNU sed not found"
-    exit 1
+    _notrun "GNU sed not found"
 fi
 
 dd()
@@ -722,16 +732,6 @@ _img_info()
         done
 }
 
-# bail out, setting up .notrun file
-#
-_notrun()
-{
-    echo "$*" >"$OUTPUT_DIR/$seq.notrun"
-    echo "$seq not run: $*"
-    status=0
-    exit
-}
-
 # bail out, setting up .casenotrun file
 # The function _casenotrun() is used as a notifier. It is the
 # caller's responsibility to make skipped a particular test.
-- 
2.27.0



  reply	other threads:[~2022-02-08 10:49 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 10:13 [PATCH 0/6] Improve integration of iotests in the meson test harness Thomas Huth
2022-02-08 10:13 ` Thomas Huth [this message]
2022-02-08 11:46   ` [PATCH 1/6] tests/qemu-iotests: Improve the check for GNU sed Hanna Reitz
2022-02-08 12:13     ` Thomas Huth
2022-02-08 12:28       ` Hanna Reitz
2022-02-08 12:38         ` Thomas Huth
2022-02-08 13:11           ` Philippe Mathieu-Daudé via
2022-02-08 14:52             ` Thomas Huth
2022-02-11 16:14               ` Eric Blake
2022-02-11 16:48                 ` Thomas Huth
2022-02-15 13:28                   ` Thomas Huth
2022-02-15 13:51                     ` Daniel P. Berrangé
2022-02-15 16:09                       ` Thomas Huth
2022-02-08 10:13 ` [PATCH 2/6] tests/qemu-iotests/meson.build: Improve the indentation Thomas Huth
2022-02-08 10:51   ` Philippe Mathieu-Daudé via
2022-02-08 12:00   ` Hanna Reitz
2022-02-08 10:13 ` [PATCH 3/6] tests/qemu-iotests: Allow to run "./check -n" from the source directory, too Thomas Huth
2022-02-08 12:26   ` Hanna Reitz
2022-02-08 10:13 ` [PATCH 4/6] tests/qemu-iotests/meson.build: Call the 'check' script directly Thomas Huth
2022-02-08 12:36   ` Paolo Bonzini
2022-02-08 15:10     ` Thomas Huth
2022-02-08 16:19       ` Paolo Bonzini
2022-02-08 13:12   ` Hanna Reitz
2022-02-08 15:46     ` Thomas Huth
2022-02-08 10:13 ` [PATCH 5/6] tests: Do not treat the iotests as separate meson test target anymore Thomas Huth
2022-02-08 10:26   ` Peter Maydell
2022-02-08 11:16     ` Thomas Huth
2022-02-08 11:33       ` Peter Maydell
2022-02-08 12:37       ` Paolo Bonzini
2022-02-08 10:13 ` [PATCH 6/6] tests: Remove check-block.sh Thomas Huth

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=20220208101311.1511083-2-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --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).