* [Qemu-devel] [PATCH v2 0/1] qemu-iotests: fix 067 on s390x
@ 2016-02-19 13:01 Sascha Silbe
2016-02-19 13:01 ` [Qemu-devel] [PATCH v2 1/1] qemu-iotests: 067: ignore QMP events Sascha Silbe
0 siblings, 1 reply; 3+ messages in thread
From: Sascha Silbe @ 2016-02-19 13:01 UTC (permalink / raw)
To: Max Reitz, qemu-devel, qemu-block, Kevin Wolf, Eric Blake; +Cc: Tu Bo
qemu-iotests test case 067 fails on s390x because the ordering of its
output is architecture-dependent (asynchronous vs. synchronous hotplug
handling). This series fixes the failure by filtering events from QMP
output for 067.
v1->v2:
- use tr / sed trick for filtering multi-line JSON to avoid
switching to single-line JSON which is hard to read
- roll _filter_qmp_events() into 067 as the multi-line version isn't
robust enough for general use
Sascha Silbe (1):
qemu-iotests: 067: ignore QMP events
tests/qemu-iotests/067 | 11 +++-
tests/qemu-iotests/067.out | 144 ---------------------------------------------
2 files changed, 10 insertions(+), 145 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH v2 1/1] qemu-iotests: 067: ignore QMP events
2016-02-19 13:01 [Qemu-devel] [PATCH v2 0/1] qemu-iotests: fix 067 on s390x Sascha Silbe
@ 2016-02-19 13:01 ` Sascha Silbe
2016-02-20 14:39 ` Max Reitz
0 siblings, 1 reply; 3+ messages in thread
From: Sascha Silbe @ 2016-02-19 13:01 UTC (permalink / raw)
To: Max Reitz, qemu-devel, qemu-block, Kevin Wolf, Eric Blake; +Cc: Tu Bo
The relative ordering of "device_del" return value and the
"DEVICE_DELETED" QMP event depends on the architecture being
tested. On x86 unplugging virtio disks is asynchronous
(=qdev_unplug()= → =hotplug_handler_unplug_request()=) while on s390x
it is synchronous (=qdev_unplug()= → =hotplug_handler_unplug()=). This
leads to the actual output on s390x consistently differing from the
reference output (that was probably produced on x86).
The easiest way to address this is to filter out QMP events in
067. The DEVICE_DELETED event is already getting explicitly tested by
the Python-based test case 139, so the test coverage should be
unaffected. Make use of the recently introduced _filter_qmp_events()
to remove QMP events from the test case output and adjust the
reference output accordingly.
The tr / sed / tr trick used for filtering was suggested by Max Reitz
<mreitz@redhat.com>.
Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
---
v1->v2:
- squashed the two patches
- using tr + sed incantation so we can keep the pretty-printing, but
moved the filter into 067 as it's not general enough for
common.filter
---
tests/qemu-iotests/067 | 11 +++-
tests/qemu-iotests/067.out | 144 ---------------------------------------------
2 files changed, 10 insertions(+), 145 deletions(-)
diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067
index 3788534..77dec0d 100755
--- a/tests/qemu-iotests/067
+++ b/tests/qemu-iotests/067
@@ -45,11 +45,20 @@ function do_run_qemu()
echo
}
+# Remove QMP events from (pretty-printed) output. Doesn't handle
+# nested dicts correctly, but we don't get any of those in this test.
+_filter_qmp_events()
+{
+ tr '\n' '\t' | sed -e \
+ 's/{\s*"timestamp":\s*{[^}]*},\s*"event":[^,}]*\(,\s*"data":\s*{[^}]*}\)\?\s*}\s*//g' \
+ | tr '\t' '\n'
+}
+
function run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | _filter_qemu \
| sed -e 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g' \
- | _filter_generated_node_ids
+ | _filter_generated_node_ids | _filter_qmp_events
}
size=128M
diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out
index ae3fccb..7e25a49 100644
--- a/tests/qemu-iotests/067.out
+++ b/tests/qemu-iotests/067.out
@@ -70,34 +70,6 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virti
}
}
{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "DEVICE_DELETED",
- "data": {
- "path": "/machine/peripheral/virtio0/virtio-backend"
- }
-}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "DEVICE_DELETED",
- "data": {
- "device": "virtio0",
- "path": "/machine/peripheral/virtio0"
- }
-}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "RESET"
-}
-{
"return": [
]
}
@@ -105,14 +77,6 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virti
"return": {
}
}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "SHUTDOWN"
-}
-
=== -drive/device_add and device_del ===
@@ -186,34 +150,6 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk
}
}
{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "DEVICE_DELETED",
- "data": {
- "path": "/machine/peripheral/virtio0/virtio-backend"
- }
-}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "DEVICE_DELETED",
- "data": {
- "device": "virtio0",
- "path": "/machine/peripheral/virtio0"
- }
-}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "RESET"
-}
-{
"return": [
]
}
@@ -221,14 +157,6 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk
"return": {
}
}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "SHUTDOWN"
-}
-
=== drive_add/device_add and device_del ===
@@ -305,34 +233,6 @@ Testing:
}
}
{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "DEVICE_DELETED",
- "data": {
- "path": "/machine/peripheral/virtio0/virtio-backend"
- }
-}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "DEVICE_DELETED",
- "data": {
- "device": "virtio0",
- "path": "/machine/peripheral/virtio0"
- }
-}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "RESET"
-}
-{
"return": [
]
}
@@ -340,14 +240,6 @@ Testing:
"return": {
}
}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "SHUTDOWN"
-}
-
=== blockdev_add/device_add and device_del ===
@@ -425,34 +317,6 @@ Testing:
}
}
{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "DEVICE_DELETED",
- "data": {
- "path": "/machine/peripheral/virtio0/virtio-backend"
- }
-}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "DEVICE_DELETED",
- "data": {
- "device": "virtio0",
- "path": "/machine/peripheral/virtio0"
- }
-}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "RESET"
-}
-{
"return": [
{
"io-status": "ok",
@@ -506,12 +370,4 @@ Testing:
"return": {
}
}
-{
- "timestamp": {
- "seconds": TIMESTAMP,
- "microseconds": TIMESTAMP
- },
- "event": "SHUTDOWN"
-}
-
*** done
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/1] qemu-iotests: 067: ignore QMP events
2016-02-19 13:01 ` [Qemu-devel] [PATCH v2 1/1] qemu-iotests: 067: ignore QMP events Sascha Silbe
@ 2016-02-20 14:39 ` Max Reitz
0 siblings, 0 replies; 3+ messages in thread
From: Max Reitz @ 2016-02-20 14:39 UTC (permalink / raw)
To: Sascha Silbe, qemu-devel, qemu-block, Kevin Wolf, Eric Blake; +Cc: Tu Bo
[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]
On 19.02.2016 14:01, Sascha Silbe wrote:
> The relative ordering of "device_del" return value and the
> "DEVICE_DELETED" QMP event depends on the architecture being
> tested. On x86 unplugging virtio disks is asynchronous
> (=qdev_unplug()= → =hotplug_handler_unplug_request()=) while on s390x
> it is synchronous (=qdev_unplug()= → =hotplug_handler_unplug()=). This
> leads to the actual output on s390x consistently differing from the
> reference output (that was probably produced on x86).
>
> The easiest way to address this is to filter out QMP events in
> 067. The DEVICE_DELETED event is already getting explicitly tested by
> the Python-based test case 139, so the test coverage should be
> unaffected. Make use of the recently introduced _filter_qmp_events()
> to remove QMP events from the test case output and adjust the
> reference output accordingly.
>
> The tr / sed / tr trick used for filtering was suggested by Max Reitz
> <mreitz@redhat.com>.
>
> Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
> ---
> v1->v2:
> - squashed the two patches
> - using tr + sed incantation so we can keep the pretty-printing, but
> moved the filter into 067 as it's not general enough for
> common.filter
> ---
> tests/qemu-iotests/067 | 11 +++-
> tests/qemu-iotests/067.out | 144 ---------------------------------------------
> 2 files changed, 10 insertions(+), 145 deletions(-)
Thanks, applied to my block tree:
https://github.com/XanClic/qemu/commits/block
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-20 14:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-19 13:01 [Qemu-devel] [PATCH v2 0/1] qemu-iotests: fix 067 on s390x Sascha Silbe
2016-02-19 13:01 ` [Qemu-devel] [PATCH v2 1/1] qemu-iotests: 067: ignore QMP events Sascha Silbe
2016-02-20 14:39 ` Max Reitz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.