The only thing the escape characters achieve is making the reference
output unreadable and lines that are potentially so long that git
doesn't want to put them into an email any more. Let's filter them out.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/qemu-iotests/028.out | 2 +-
tests/qemu-iotests/130.out | 4 ++--
tests/qemu-iotests/common.filter | 7 +++++++
tests/qemu-iotests/common.qemu | 4 ++--
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/tests/qemu-iotests/028.out b/tests/qemu-iotests/028.out
index acd2870..7d54aeb 100644
--- a/tests/qemu-iotests/028.out
+++ b/tests/qemu-iotests/028.out
@@ -469,7 +469,7 @@ No errors were found on the image.
block-backup
Formatting 'TEST_DIR/t.IMGFMT.copy', fmt=IMGFMT size=4294968832 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT
-(qemu) i[K[Din[K[D[Dinf[K[D[D[Dinfo[K[D[D[D[Dinfo [K[D[D[D[D[Dinfo b[K[D[D[D[D[D[Dinfo bl[K[D[D[D[D[D[D[Dinfo blo[K[D[D[D[D[D[D[D[Dinfo bloc[K[D[D[D[D[D[D[D[D[Dinfo block[K[D[D[D[D[D[D[D[D[D[Dinfo block-[K[D[D[D[D[D[D[D[D[D[D[Dinfo block-j[K[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-jo[K[D[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-job[K[D[D[D[D[D[D[D[D[D[D[D[D[D[Dinfo block-jobs[K
+(qemu) info block-jobs
No active jobs
=== IO: pattern 195
read 512/512 bytes at offset 3221194240
diff --git a/tests/qemu-iotests/130.out b/tests/qemu-iotests/130.out
index ae95b50..93020c3 100644
--- a/tests/qemu-iotests/130.out
+++ b/tests/qemu-iotests/130.out
@@ -9,14 +9,14 @@ virtual size: 64M (67108864 bytes)
=== HMP commit ===
QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) c[K[Dco[K[D[Dcom[K[D[D[Dcomm[K[D[D[D[Dcommi[K[D[D[D[D[Dcommit[K[D[D[D[D[D[Dcommit [K[D[D[D[D[D[D[Dcommit t[K[D[D[D[D[D[D[D[Dcommit te[K[D[D[D[D[D[D[D[D[Dcommit tes[K[D[D[D[D[D[D[D[D[D[Dcommit test[K[D[D[D[D[D[D[D[D[D[D[Dcommit testd[K[D[D[D[D[D[D[D[D[D[D[D[Dcommit testdi[K[D[D[D[D[D[D[D[D[D[D[D[D[Dcommit testdis[K[D[D[D[D[D[D[D[D[D[D[D[D[D[Dcommit testdisk[K
+(qemu) commit testdisk
(qemu)
image: TEST_DIR/t.IMGFMT
file format: IMGFMT
virtual size: 64M (67108864 bytes)
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.orig backing_fmt=raw
QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) c[K[Dco[K[D[Dcom[K[D[D[Dcomm[K[D[D[D[Dcommi[K[D[D[D[D[Dcommit[K[D[D[D[D[D[Dcommit [K[D[D[D[D[D[D[Dcommit t[K[D[D[D[D[D[D[D[Dcommit te[K[D[D[D[D[D[D[D[D[Dcommit tes[K[D[D[D[D[D[D[D[D[D[Dcommit test[K[D[D[D[D[D[D[D[D[D[D[Dcommit testd[K[D[D[D[D[D[D[D[D[D[D[D[Dcommit testdi[K[D[D[D[D[D[D[D[D[D[D[D[D[Dcommit testdis[K[D[D[D[D[D[D[D[D[D[D[D[D[D[Dcommit testdisk[K
+(qemu) commit testdisk
(qemu)
image: TEST_DIR/t.IMGFMT
file format: IMGFMT
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 1040013..78b7bfa 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -86,6 +86,13 @@ _filter_qmp()
-e ' QMP_VERSION'
}
+# readline makes HMP command strings so long that git complains
+_filter_hmp()
+{
+ sed -e 's/(qemu).*\o33\[D/(qemu) /g' \
+ -e 's/\o33\[K//g'
+}
+
# replace block job offset
_filter_block_job_offset()
{
diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
index 4278789..7a78a00 100644
--- a/tests/qemu-iotests/common.qemu
+++ b/tests/qemu-iotests/common.qemu
@@ -59,7 +59,7 @@ function _timed_wait_for()
do
if [ -z "${silent}" ]; then
echo "${resp}" | _filter_testdir | _filter_qemu \
- | _filter_qemu_io | _filter_qmp
+ | _filter_qemu_io | _filter_qmp | _filter_hmp
fi
grep -q "${*}" < <(echo ${resp})
if [ $? -eq 0 ]; then
@@ -217,7 +217,7 @@ function _cleanup_qemu()
if [ -n "${wait}" ]; then
cat <&${QEMU_OUT[$i]} | _filter_testdir | _filter_qemu \
- | _filter_qemu_io | _filter_qmp
+ | _filter_qemu_io | _filter_qmp | _filter_hmp
fi
rm -f "${QEMU_FIFO_IN}_${i}" "${QEMU_FIFO_OUT}_${i}"
eval "exec ${QEMU_IN[$i]}<&-" # close file descriptors
--
1.8.3.1
On 04/13/2017 12:23 PM, Kevin Wolf wrote:
> The only thing the escape characters achieve is making the reference
> output unreadable and lines that are potentially so long that git
> doesn't want to put them into an email any more. Let's filter them out.
Hear! Hear!
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> tests/qemu-iotests/028.out | 2 +-
> tests/qemu-iotests/130.out | 4 ++--
> tests/qemu-iotests/common.filter | 7 +++++++
> tests/qemu-iotests/common.qemu | 4 ++--
> 4 files changed, 12 insertions(+), 5 deletions(-)
Yay! But I think you're incomplete:
What about 051, 068, 142, and 145?
(found by:
git grep -l $'\e' tests/qemu-iotests/*.out
using bash as the shell)
> +++ b/tests/qemu-iotests/common.filter
> @@ -86,6 +86,13 @@ _filter_qmp()
> -e ' QMP_VERSION'
> }
>
> +# readline makes HMP command strings so long that git complains
> +_filter_hmp()
> +{
> + sed -e 's/(qemu).*\o33\[D/(qemu) /g' \
\oNN is a GNU sed-ism, as far as I can tell. Is it portable to our
BSD/MacOS builds?
> + -e 's/\o33\[K//g'
> +}
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
On 04/13/2017 12:38 PM, Eric Blake wrote:
> On 04/13/2017 12:23 PM, Kevin Wolf wrote:
>> The only thing the escape characters achieve is making the reference
>> output unreadable and lines that are potentially so long that git
>> doesn't want to put them into an email any more. Let's filter them out.
>
> Hear! Hear!
>
>> +++ b/tests/qemu-iotests/common.filter
>> @@ -86,6 +86,13 @@ _filter_qmp()
>> -e ' QMP_VERSION'
>> }
>>
>> +# readline makes HMP command strings so long that git complains
>> +_filter_hmp()
>> +{
>> + sed -e 's/(qemu).*\o33\[D/(qemu) /g' \
>
> \oNN is a GNU sed-ism, as far as I can tell. Is it portable to our
> BSD/MacOS builds?
And if it's not, qemu-iotests are running under bash, so writing this as:
sed -e $'s/(qemu).*\e\\[D/(qemu) /g'
>
>> + -e 's/\o33\[K//g'
-e $'s/\e\\[K//g'
is a reliable alternative.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
Am 13.04.2017 um 19:38 hat Eric Blake geschrieben:
> On 04/13/2017 12:23 PM, Kevin Wolf wrote:
> > The only thing the escape characters achieve is making the reference
> > output unreadable and lines that are potentially so long that git
> > doesn't want to put them into an email any more. Let's filter them out.
>
> Hear! Hear!
>
> >
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> > tests/qemu-iotests/028.out | 2 +-
> > tests/qemu-iotests/130.out | 4 ++--
> > tests/qemu-iotests/common.filter | 7 +++++++
> > tests/qemu-iotests/common.qemu | 4 ++--
> > 4 files changed, 12 insertions(+), 5 deletions(-)
>
> Yay! But I think you're incomplete:
>
> What about 051, 068, 142, and 145?
I only converted the cases that use common.qemu, so they failed after
my change. The other test cases you found are running qemu manually and
didn't apply the filter yet, so they wouldn't fail.
For v2, I'll add the new filter to them and change the reference output
accordingly.
> (found by:
> git grep -l $'\e' tests/qemu-iotests/*.out
> using bash as the shell)
>
>
> > +++ b/tests/qemu-iotests/common.filter
> > @@ -86,6 +86,13 @@ _filter_qmp()
> > -e ' QMP_VERSION'
> > }
> >
> > +# readline makes HMP command strings so long that git complains
> > +_filter_hmp()
> > +{
> > + sed -e 's/(qemu).*\o33\[D/(qemu) /g' \
>
> \oNN is a GNU sed-ism, as far as I can tell. Is it portable to our
> BSD/MacOS builds?
I'll use your bash version in v2.
Kevin
© 2016 - 2026 Red Hat, Inc.