From: Maxim Levitsky Date: Wed, 4 Nov 2020 18:50:25 +0000 (+0200) Subject: iotests: rewrite iotest 240 in python X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c6ac463631a124eaa47cae8a9a4aaac4d0761d28;p=qemu.git iotests: rewrite iotest 240 in python The recent changes that brought RCU delayed device deletion, broke few tests and this test breakage went unnoticed. Fix this test by rewriting it in python (which allows to wait for DEVICE_DELETED events before continuing). Signed-off-by: Maxim Levitsky Tested-by: Christian Borntraeger Reviewed-by: Paolo Bonzini Message-Id: <20201104185025.434703-3-mlevitsk@redhat.com> Signed-off-by: Max Reitz --- diff --git a/tests/qemu-iotests/240 b/tests/qemu-iotests/240 index 8b4337b58d..c0f71f0461 100755 --- a/tests/qemu-iotests/240 +++ b/tests/qemu-iotests/240 @@ -1,5 +1,5 @@ -#!/usr/bin/env bash -# +#!/usr/bin/env python3 + # Test hot plugging and unplugging with iothreads # # Copyright (C) 2019 Igalia, S.L. @@ -17,133 +17,90 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# -# creator -owner=berto@igalia.com - -seq=`basename $0` -echo "QA output created by $seq" - -status=1 # failure is the default! - -_cleanup() -{ - rm -f "$SOCK_DIR/nbd" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common.rc -. ./common.filter - -_supported_fmt generic -_supported_proto generic - -do_run_qemu() -{ - echo Testing: "$@" - $QEMU -nographic -qmp stdio -serial none "$@" - 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' -} - -run_qemu() -{ - do_run_qemu "$@" 2>&1 | _filter_qmp | _filter_qmp_events -} - -case "$QEMU_DEFAULT_MACHINE" in - s390-ccw-virtio) - virtio_scsi=virtio-scsi-ccw - ;; - *) - virtio_scsi=virtio-scsi-pci - ;; -esac - -echo -echo === Unplug a SCSI disk and then plug it again === -echo - -run_qemu <