Blame 0001-iotests-qsd-jobs-Filter-events-in-the-first-test.patch

c0b654
From 66f18320f751f9649e0f230e814dd556e38bc1fe Mon Sep 17 00:00:00 2001
c0b654
From: Max Reitz <mreitz@redhat.com>
c0b654
Date: Thu, 1 Apr 2021 15:28:39 +0200
c0b654
Subject: [PATCH] iotests/qsd-jobs: Filter events in the first test
c0b654
c0b654
The job may or may not be ready before the 'quit' is issued.  Whether it
c0b654
is is irrelevant; for the purpose of the test, it only needs to still be
c0b654
there.  Filter the job status change and READY events from the output so
c0b654
it becomes reliable.
c0b654
c0b654
Reported-by: Peter Maydell <peter.maydell@linaro.org>
c0b654
Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
c0b654
Signed-off-by: Max Reitz <mreitz@redhat.com>
c0b654
Message-Id: <20210401132839.139939-1-mreitz@redhat.com>
c0b654
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
c0b654
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
c0b654
---
c0b654
 tests/qemu-iotests/tests/qsd-jobs     |  5 ++++-
c0b654
 tests/qemu-iotests/tests/qsd-jobs.out | 10 ----------
c0b654
 2 files changed, 4 insertions(+), 11 deletions(-)
c0b654
c0b654
diff --git a/tests/qemu-iotests/tests/qsd-jobs b/tests/qemu-iotests/tests/qsd-jobs
c0b654
index 972b6b3898..510bf0a9dc 100755
c0b654
--- a/tests/qemu-iotests/tests/qsd-jobs
c0b654
+++ b/tests/qemu-iotests/tests/qsd-jobs
c0b654
@@ -52,9 +52,12 @@ echo "=== Job still present at shutdown ==="
c0b654
 echo
c0b654
 
c0b654
 # Just make sure that this doesn't crash
c0b654
+# (Filter job status and READY events, because their order may differ
c0b654
+# between runs, particularly around when 'quit' is issued)
c0b654
 $QSD --chardev stdio,id=stdio --monitor chardev=stdio \
c0b654
     --blockdev node-name=file0,driver=file,filename="$TEST_IMG" \
c0b654
-    --blockdev node-name=fmt0,driver=qcow2,file=file0 <
c0b654
+    --blockdev node-name=fmt0,driver=qcow2,file=file0 <
c0b654
+    | _filter_qmp | grep -v JOB_STATUS_CHANGE | grep -v BLOCK_JOB_READY
c0b654
 {"execute":"qmp_capabilities"}
c0b654
 {"execute": "block-commit", "arguments": {"device": "fmt0", "job-id": "job0"}}
c0b654
 {"execute": "quit"}
c0b654
diff --git a/tests/qemu-iotests/tests/qsd-jobs.out b/tests/qemu-iotests/tests/qsd-jobs.out
c0b654
index 05e1165e80..5f41491e05 100644
c0b654
--- a/tests/qemu-iotests/tests/qsd-jobs.out
c0b654
+++ b/tests/qemu-iotests/tests/qsd-jobs.out
c0b654
@@ -6,19 +6,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/
c0b654
 
c0b654
 QMP_VERSION
c0b654
 {"return": {}}
c0b654
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}}
c0b654
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}}
c0b654
 {"return": {}}
c0b654
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "job0"}}
c0b654
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "commit"}}
c0b654
 {"return": {}}
c0b654
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "standby", "id": "job0"}}
c0b654
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "ready", "id": "job0"}}
c0b654
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "job0"}}
c0b654
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "job0"}}
c0b654
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "job0", "len": 0, "offset": 0, "speed": 0, "type": "commit"}}
c0b654
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}}
c0b654
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}}
c0b654
 
c0b654
 === Streaming can't get permission on base node ===
c0b654
 
c0b654
-- 
c0b654
2.29.2
c0b654