|
|
9bac43 |
From 1d27a8067135c09ecbb2aa7e4af6184aba67e86c Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
Date: Mon, 11 Dec 2017 09:06:23 +0100
|
|
|
9bac43 |
Subject: [PATCH 06/21] qemu-iotest: add test for blockjob coroutine race
|
|
|
9bac43 |
condition
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Jeffrey Cody <jcody@redhat.com>
|
|
|
9bac43 |
Message-id: <bb398a83a095183453bbf2cab4656dd60dfd4637.1511985875.git.jcody@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 78042
|
|
|
9bac43 |
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 06/11] qemu-iotest: add test for blockjob coroutine race condition
|
|
|
9bac43 |
Bugzilla: 1506531
|
|
|
9bac43 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Jeff Cody <jcody@redhat.com>
|
|
|
9bac43 |
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
(cherry picked from commit d975301dc8ae56fb3154348878e47a6211843c0b)
|
|
|
9bac43 |
Signed-off-by: Jeff Cody <jcody@redhat.com>
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
tests/qemu-iotests/200 | 99 ++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
9bac43 |
tests/qemu-iotests/200.out | 14 +++++++
|
|
|
9bac43 |
tests/qemu-iotests/group | 1 +
|
|
|
9bac43 |
3 files changed, 114 insertions(+)
|
|
|
9bac43 |
create mode 100644 tests/qemu-iotests/200
|
|
|
9bac43 |
create mode 100644 tests/qemu-iotests/200.out
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200
|
|
|
9bac43 |
new file mode 100644
|
|
|
9bac43 |
index 0000000..d8787dd
|
|
|
9bac43 |
--- /dev/null
|
|
|
9bac43 |
+++ b/tests/qemu-iotests/200
|
|
|
9bac43 |
@@ -0,0 +1,99 @@
|
|
|
9bac43 |
+#!/bin/bash
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+# Block job co-routine race condition test.
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+# See: https://bugzilla.redhat.com/show_bug.cgi?id=1508708
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+# Copyright (C) 2017 Red Hat, Inc.
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
9bac43 |
+# it under the terms of the GNU General Public License as published by
|
|
|
9bac43 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
9bac43 |
+# (at your option) any later version.
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+# This program is distributed in the hope that it will be useful,
|
|
|
9bac43 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
9bac43 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
9bac43 |
+# GNU General Public License for more details.
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+# You should have received a copy of the GNU General Public License
|
|
|
9bac43 |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
9bac43 |
+#
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+# creator
|
|
|
9bac43 |
+owner=jcody@redhat.com
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+seq=`basename $0`
|
|
|
9bac43 |
+echo "QA output created by $seq"
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+here=`pwd`
|
|
|
9bac43 |
+status=1 # failure is the default!
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+_cleanup()
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ _cleanup_qemu
|
|
|
9bac43 |
+ rm -f "${TEST_IMG}" "${BACKING_IMG}"
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
+trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+# get standard environment, filters and checks
|
|
|
9bac43 |
+. ./common.rc
|
|
|
9bac43 |
+. ./common.filter
|
|
|
9bac43 |
+. ./common.qemu
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+_supported_fmt qcow2 qed
|
|
|
9bac43 |
+_supported_proto file
|
|
|
9bac43 |
+_supported_os Linux
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+BACKING_IMG="${TEST_DIR}/backing.img"
|
|
|
9bac43 |
+TEST_IMG="${TEST_DIR}/test.img"
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+${QEMU_IMG} create -f $IMGFMT "${BACKING_IMG}" 512M | _filter_img_create
|
|
|
9bac43 |
+${QEMU_IMG} create -f $IMGFMT -F $IMGFMT "${TEST_IMG}" -b "${BACKING_IMG}" 512M | _filter_img_create
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+${QEMU_IO} -c "write -P 0xa5 512 300M" "${BACKING_IMG}" | _filter_qemu_io
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+echo
|
|
|
9bac43 |
+echo === Starting QEMU VM ===
|
|
|
9bac43 |
+echo
|
|
|
9bac43 |
+qemu_comm_method="qmp"
|
|
|
9bac43 |
+_launch_qemu -device pci-bridge,id=bridge1,chassis_nr=1,bus=pci.0 \
|
|
|
9bac43 |
+ -object iothread,id=iothread0 \
|
|
|
9bac43 |
+ -device virtio-scsi-pci,bus=bridge1,addr=0x1f,id=scsi0,iothread=iothread0 \
|
|
|
9bac43 |
+ -drive file="${TEST_IMG}",media=disk,if=none,cache=none,id=drive_sysdisk,aio=native,format=$IMGFMT \
|
|
|
9bac43 |
+ -device scsi-hd,drive=drive_sysdisk,bus=scsi0.0,id=sysdisk,bootindex=0
|
|
|
9bac43 |
+h1=$QEMU_HANDLE
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+_send_qemu_cmd $h1 "{ 'execute': 'qmp_capabilities' }" 'return'
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+echo
|
|
|
9bac43 |
+echo === Sending stream/cancel, checking for SIGSEGV only ===
|
|
|
9bac43 |
+echo
|
|
|
9bac43 |
+for (( i=1;i<500;i++ ))
|
|
|
9bac43 |
+do
|
|
|
9bac43 |
+ mismatch_only='y' qemu_error_no_exit='n' _send_qemu_cmd $h1 \
|
|
|
9bac43 |
+ "{
|
|
|
9bac43 |
+ 'execute': 'block-stream',
|
|
|
9bac43 |
+ 'arguments': {
|
|
|
9bac43 |
+ 'device': 'drive_sysdisk',
|
|
|
9bac43 |
+ 'speed': 10000000,
|
|
|
9bac43 |
+ 'on-error': 'report',
|
|
|
9bac43 |
+ 'job-id': 'job-$i'
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+ {
|
|
|
9bac43 |
+ 'execute': 'block-job-cancel',
|
|
|
9bac43 |
+ 'arguments': {
|
|
|
9bac43 |
+ 'device': 'job-$i'
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+ }" \
|
|
|
9bac43 |
+ "{.*{.*}.*}" # should match all well-formed QMP responses
|
|
|
9bac43 |
+done
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+silent='y' _send_qemu_cmd $h1 "{ 'execute': 'quit' }" 'return'
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+echo "$i iterations performed"
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+echo "*** done"
|
|
|
9bac43 |
+rm -f $seq.full
|
|
|
9bac43 |
+status=0
|
|
|
9bac43 |
diff --git a/tests/qemu-iotests/200.out b/tests/qemu-iotests/200.out
|
|
|
9bac43 |
new file mode 100644
|
|
|
9bac43 |
index 0000000..af6a809
|
|
|
9bac43 |
--- /dev/null
|
|
|
9bac43 |
+++ b/tests/qemu-iotests/200.out
|
|
|
9bac43 |
@@ -0,0 +1,14 @@
|
|
|
9bac43 |
+QA output created by 200
|
|
|
9bac43 |
+Formatting 'TEST_DIR/backing.img', fmt=IMGFMT size=536870912
|
|
|
9bac43 |
+Formatting 'TEST_DIR/test.img', fmt=IMGFMT size=536870912 backing_file=TEST_DIR/backing.img backing_fmt=IMGFMT
|
|
|
9bac43 |
+wrote 314572800/314572800 bytes at offset 512
|
|
|
9bac43 |
+300 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+=== Starting QEMU VM ===
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+{"return": {}}
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+=== Sending stream/cancel, checking for SIGSEGV only ===
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+500 iterations performed
|
|
|
9bac43 |
+*** done
|
|
|
9bac43 |
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
|
|
|
9bac43 |
index 491a5f5..39b61ce 100644
|
|
|
9bac43 |
--- a/tests/qemu-iotests/group
|
|
|
9bac43 |
+++ b/tests/qemu-iotests/group
|
|
|
9bac43 |
@@ -190,3 +190,4 @@
|
|
|
9bac43 |
194 rw auto migration quick
|
|
|
9bac43 |
195 rw auto quick
|
|
|
9bac43 |
198 rw auto
|
|
|
9bac43 |
+200 rw auto
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|