From: David Edmondson <david.edmondson@oracle.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
David Edmondson <david.edmondson@oracle.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [PATCH v2 2/2] tests: Collapse echoed JSON input to a single line
Date: Mon, 21 Dec 2020 13:49:31 +0000 [thread overview]
Message-ID: <20201221134931.1194806-3-david.edmondson@oracle.com> (raw)
In-Reply-To: <20201221134931.1194806-1-david.edmondson@oracle.com>
When sending JSON to running qemu, qemu-io, etc. instances, flatten
the echoed input to a single line to ensure that comparisons with the
expected input (which is always a single line) are successful.
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
---
tests/qemu-iotests/common.filter | 6 ++++++
tests/qemu-iotests/common.qemu | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 172ea5752e..d51df59769 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -332,5 +332,11 @@ for fname in fnames:
sys.stdout.write(result)'
}
+# Convert multi-line input to a single line.
+_filter_collapse_lines()
+{
+ (tr -d '\n'; echo)
+}
+
# make sure this script returns success
true
diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
index de680cf1c7..9604c78b8a 100644
--- a/tests/qemu-iotests/common.qemu
+++ b/tests/qemu-iotests/common.qemu
@@ -159,7 +159,7 @@ _send_qemu_cmd()
# input back to output); decide based on leading '{'
if [ -z "$silent" ] && [ -z "$mismatch_only" ] &&
[ "$cmd" != "${cmd#\{}" ]; then
- echo "${cmd}" | _filter_testdir | _filter_imgfmt
+ echo "${cmd}" | _filter_testdir | _filter_imgfmt | _filter_collapse_lines
fi
while [ ${count} -gt 0 ]
do
--
2.29.2
next prev parent reply other threads:[~2020-12-21 13:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-21 13:49 [PATCH v2 0/2] block: report errno when flock fcntl fails David Edmondson
2020-12-21 13:49 ` [PATCH v2 1/2] " David Edmondson
2020-12-22 14:31 ` Philippe Mathieu-Daudé
2021-01-06 9:48 ` Max Reitz
2021-01-06 11:58 ` David Edmondson
2020-12-21 13:49 ` David Edmondson [this message]
2021-01-06 9:49 ` [PATCH v2 2/2] tests: Collapse echoed JSON input to a single line Max Reitz
2021-01-06 17:20 ` David Edmondson
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=20201221134931.1194806-3-david.edmondson@oracle.com \
--to=david.edmondson@oracle.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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).