Skip to content

Commit

Permalink
iotests: Make 144 deterministic again
Browse files Browse the repository at this point in the history
Since commit effd60c changed how QMP commands are processed, the order
of the block-commit return value and job events in iotests 144 wasn't
fixed and more and caused the test to fail intermittently.

Change the test to cache events first and then print them in a
predefined order.

Waiting three times for JOB_STATUS_CHANGE is a bit uglier than just
waiting for the JOB_STATUS_CHANGE that has "status": "ready", but the
tooling we have doesn't seem to allow the latter easily.

Fixes: effd60c
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2126
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20240209173103.239994-1-kwolf@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit cc29c12)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
kevmw authored and Michael Tokarev committed Feb 16, 2024
1 parent f030e96 commit d5bc76f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion tests/qemu-iotests/144
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,22 @@ echo
echo === Performing block-commit on active layer ===
echo

capture_events="BLOCK_JOB_READY JOB_STATUS_CHANGE"

# Block commit on active layer, push the new overlay into base
_send_qemu_cmd $h "{ 'execute': 'block-commit',
'arguments': {
'device': 'virtio0'
}
}" "READY"
}" "return"

_wait_event $h "JOB_STATUS_CHANGE"
_wait_event $h "JOB_STATUS_CHANGE"
_wait_event $h "JOB_STATUS_CHANGE"

_wait_event $h "BLOCK_JOB_READY"

capture_events=

_send_qemu_cmd $h "{ 'execute': 'block-job-complete',
'arguments': {
Expand Down
2 changes: 1 addition & 1 deletion tests/qemu-iotests/144.out
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Formatting 'TEST_DIR/tmp.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off co
'device': 'virtio0'
}
}
{"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "virtio0"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "virtio0"}}
{"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "virtio0"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "virtio0", "len": 0, "offset": 0, "speed": 0, "type": "commit"}}
{ 'execute': 'block-job-complete',
Expand Down

0 comments on commit d5bc76f

Please sign in to comment.