From nobody Thu May 2 20:15:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 150825806875569.39491935445483; Tue, 17 Oct 2017 09:34:28 -0700 (PDT) Received: from localhost ([::1]:40454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Uow-0007w9-HL for importer@patchew.org; Tue, 17 Oct 2017 12:34:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Umu-0006hN-FQ for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4Umt-00065F-RZ for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38124) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4Umm-0005tp-Tk; Tue, 17 Oct 2017 12:32:09 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CA8233A178; Tue, 17 Oct 2017 16:32:08 +0000 (UTC) Received: from localhost (ovpn-117-62.phx2.redhat.com [10.3.117.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DC2E78005; Tue, 17 Oct 2017 16:32:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0CA8233A178 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jcody@redhat.com From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 12:31:46 -0400 Message-Id: <399631b6632f0a605339391ff76c90468ebd54ee.1508257445.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 17 Oct 2017 16:32:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 01/10] qemu-iotests: refuse to run if TEST_DIR contains spaces X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently, not all qemu-iotests work if TEST_DIR has spaces, and they also might not be safe. Refuse to run if TEST_DIR in this case, at least until all tests are fixed sometime in the future. Signed-off-by: Jeff Cody --- tests/qemu-iotests/check | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index e6b6ff7..e2163cc 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -102,6 +102,14 @@ if [ -z "$TEST_DIR" ]; then TEST_DIR=3D`pwd`/scratch fi =20 +case $TEST_DIR in + *[[:blank:]]*) + echo "The TEST_DIR pathname '$TEST_DIR' contains whitespace. " + echo "This is currently unsupported by qemu-iotests" + exit 1 + ;; +esac + if [ ! -e "$TEST_DIR" ]; then mkdir "$TEST_DIR" fi --=20 2.9.5 From nobody Thu May 2 20:15:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508258400975724.284086790922; Tue, 17 Oct 2017 09:40:00 -0700 (PDT) Received: from localhost ([::1]:40489 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4UuG-00045O-T4 for importer@patchew.org; Tue, 17 Oct 2017 12:39:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Un2-0006lg-8X for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4Un1-0006HK-GD for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54400) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4Umt-00063D-Fm; Tue, 17 Oct 2017 12:32:15 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B7AD13A88; Tue, 17 Oct 2017 16:32:14 +0000 (UTC) Received: from localhost (ovpn-117-62.phx2.redhat.com [10.3.117.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC2A26F124; Tue, 17 Oct 2017 16:32:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8B7AD13A88 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jcody@redhat.com From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 12:31:47 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 17 Oct 2017 16:32:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 02/10] qemu-iotests: set TEST_DIR to a unique dir for each test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Right now, all qemu-iotests output data into the same scratch directory, and so each test needs to be responsible for cleaning up its own files. Have each test use 'scratch/$seq' as its temp directory, so the check script can do simple cleanup of removing the whole temporary directory. Reviewed-by: Eric Blake Signed-off-by: Jeff Cody --- tests/qemu-iotests/check | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index e2163cc..5ae34bf 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -713,6 +713,7 @@ seq=3D"check" =20 for seq in $list do + TEST_DIR_SEQ=3D$TEST_DIR/$seq err=3Dfalse printf %s "$seq" if [ -n "$TESTS_REMAINING_LOG" ] ; then @@ -756,13 +757,23 @@ do fi export OUTPUT_DIR=3D$PWD if $debug; then - (cd "$source_iotests"; + ( + export TEST_DIR=3D$TEST_DIR_SEQ + cd "$source_iotests"; + . ./common.config + . ./common.rc MALLOC_PERTURB_=3D${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \ - $run_command -d 2>&1 | tee $tmp.out) + $run_command -d 2>&1 | tee $tmp.out + ) else - (cd "$source_iotests"; + ( + export TEST_DIR=3D$TEST_DIR_SEQ + cd "$source_iotests"; + . ./common.config + . ./common.rc MALLOC_PERTURB_=3D${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \ - $run_command >$tmp.out 2>&1) + $run_command >$tmp.out 2>&1 + ) fi sts=3D$? $timestamp && _timestamp @@ -826,6 +837,8 @@ do fi fi =20 + rm -rf "$TEST_DIR_SEQ" + fi =20 # come here for each test, except when $showme is true --=20 2.9.5 From nobody Thu May 2 20:15:54 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508258084600583.1634054456543; Tue, 17 Oct 2017 09:34:44 -0700 (PDT) Received: from localhost ([::1]:40455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Uoy-0007xE-HT for importer@patchew.org; Tue, 17 Oct 2017 12:34:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Un2-0006ls-HK for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4Un1-0006HL-Ga for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17066) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4Umw-00068T-BD; Tue, 17 Oct 2017 12:32:18 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63836356FC; Tue, 17 Oct 2017 16:32:17 +0000 (UTC) Received: from localhost (ovpn-117-62.phx2.redhat.com [10.3.117.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A5B761780; Tue, 17 Oct 2017 16:32:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 63836356FC Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jcody@redhat.com From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 12:31:48 -0400 Message-Id: <503559b438cd67b865d32d7d0577afc7ee15f32c.1508257445.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 17 Oct 2017 16:32:17 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 03/10] qemu-iotests: automatically clean up bash protocol servers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For bash tests, this allows 'check' to reap all launch protocol servers / processes, after a test has finished running. Signed-off-by: Jeff Cody Reviewed-by: Eric Blake --- tests/qemu-iotests/check | 13 +++++++ tests/qemu-iotests/common.rc | 93 +++++++++++++++++++++++++++++-----------= ---- 2 files changed, 75 insertions(+), 31 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 5ae34bf..b4ab646 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -757,6 +757,8 @@ do fi export OUTPUT_DIR=3D$PWD if $debug; then + # Do this in a sub-shell, so we are operating on the right + # TEST_DIR / QEMU_TEST_DIR ( export TEST_DIR=3D$TEST_DIR_SEQ cd "$source_iotests"; @@ -766,6 +768,8 @@ do $run_command -d 2>&1 | tee $tmp.out ) else + # Do this in a sub-shell, so we are operating on the right + # TEST_DIR / QEMU_TEST_DIR ( export TEST_DIR=3D$TEST_DIR_SEQ cd "$source_iotests"; @@ -837,6 +841,15 @@ do fi fi =20 + # Do this in a sub-shell, so we are operating on the right + # TEST_DIR / QEMU_TEST_DIR + ( + export TEST_DIR=3D$TEST_DIR_SEQ + . "$source_iotests/common.config" + . "$source_iotests/common.rc" + + _cleanup_protocols + ) rm -rf "$TEST_DIR_SEQ" =20 fi diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 0e8a33c..a345ffd 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -101,7 +101,7 @@ _qemu_nbd_wrapper() _qemu_vxhs_wrapper() { ( - echo $BASHPID > "${TEST_DIR}/qemu-vxhs.pid" + echo $BASHPID > "${QEMU_TEST_DIR}/qemu-vxhs.pid" exec "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@" ) } @@ -248,7 +248,7 @@ _make_test_img() =20 # Start QNIO server on image directory for vxhs protocol if [ $IMGPROTO =3D "vxhs" ]; then - eval "$QEMU_VXHS -d $TEST_DIR > /dev/null &" + eval "$QEMU_VXHS -d $QEMU_TEST_DIR > /dev/null &" sleep 1 # Wait for server to come up. fi } @@ -264,29 +264,64 @@ _rm_test_img() rm -f "$img" } =20 +_cleanup_nbd() +{ + if [ -f "${QEMU_TEST_DIR}/qemu-nbd.pid" ]; then + local QEMU_NBD_PID + read QEMU_NBD_PID < "${QEMU_TEST_DIR}/qemu-nbd.pid" + rm -f "${QEMU_TEST_DIR}/qemu-nbd.pid" + kill ${QEMU_NBD_PID} >/dev/null 2>&1 + fi +} + +_cleanup_vxhs() +{ + if [ -f "${QEMU_TEST_DIR}/qemu-vxhs.pid" ]; then + local QEMU_VXHS_PID + read QEMU_VXHS_PID < "${QEMU_TEST_DIR}/qemu-vxhs.pid" + rm -f "${QEMU_TEST_DIR}/qemu-vxhs.pid" + kill ${QEMU_VXHS_PID} >/dev/null 2>&1 + fi +} + +_cleanup_rbd() +{ + rbd --no-progress rm "$QEMU_TEST_DIR/t.$IMGFMT" > /dev/null +} + +_cleanup_sheepdog() +{ + collie vdi delete "$QEMU_TEST_DIR/t.$IMGFMT" +} + + +_cleanup_protocols() +{ + # Some tests (e.g. 058) start some protocols + # even though the protocol was not specified when running + # check. If the wrappers create pidfiles, go ahead and clean + # up without checking $IMGPROTO. + _cleanup_nbd + _cleanup_vxhs + + case "$IMGPROTO" in + + rbd) + _cleanup_rbd + ;; + + sheepdog) + _cleanup_sheepdog + ;; + + esac +} + _cleanup_test_img() { + _cleanup_protocols + case "$IMGPROTO" in - - nbd) - if [ -f "${QEMU_TEST_DIR}/qemu-nbd.pid" ]; then - local QEMU_NBD_PID - read QEMU_NBD_PID < "${QEMU_TEST_DIR}/qemu-nbd.pid" - kill ${QEMU_NBD_PID} - rm -f "${QEMU_TEST_DIR}/qemu-nbd.pid" - fi - rm -f "$TEST_IMG_FILE" - ;; - vxhs) - if [ -f "${TEST_DIR}/qemu-vxhs.pid" ]; then - local QEMU_VXHS_PID - read QEMU_VXHS_PID < "${TEST_DIR}/qemu-vxhs.pid" - kill ${QEMU_VXHS_PID} >/dev/null 2>&1 - rm -f "${TEST_DIR}/qemu-vxhs.pid" - fi - rm -f "$TEST_IMG_FILE" - ;; - file) _rm_test_img "$TEST_DIR/t.$IMGFMT" _rm_test_img "$TEST_DIR/t.$IMGFMT.orig" @@ -298,16 +333,12 @@ _cleanup_test_img() TEST_IMG=3D"$ORIG_TEST_IMG" fi ;; - - rbd) - rbd --no-progress rm "$TEST_DIR/t.$IMGFMT" > /dev/null - ;; - - sheepdog) - collie vdi delete "$TEST_DIR/t.$IMGFMT" - ;; - esac + + if [ -n "$TEST_IMG_FILE" ] + then + rm -f "$TEST_IMG_FILE" + fi } =20 _check_test_img() --=20 2.9.5 From nobody Thu May 2 20:15:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508258268005660.6850687352514; Tue, 17 Oct 2017 09:37:48 -0700 (PDT) Received: from localhost ([::1]:40478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4UsC-0002HR-Tv for importer@patchew.org; Tue, 17 Oct 2017 12:37:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4UnM-00074P-Dx for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4UnE-0006Z5-Ld for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38730) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4Umy-0006Aj-04; Tue, 17 Oct 2017 12:32:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BEBC333A179; Tue, 17 Oct 2017 16:32:18 +0000 (UTC) Received: from localhost (ovpn-117-62.phx2.redhat.com [10.3.117.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3125F77FFE; Tue, 17 Oct 2017 16:32:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BEBC333A179 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jcody@redhat.com From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 12:31:49 -0400 Message-Id: <4b9a7c197c0ed492d1efa4950c8221a1ca7652c9.1508257445.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 17 Oct 2017 16:32:18 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 04/10] qemu-iotests: remove file cleanup from bash tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" All files for a given test are now self-contained in a subdirectory, and therefore the "./check" script can do all file-related cleanup without any help. This removes file cleanups from the bash tests. The only cleanup left is whatever is needed to kill any spawned processes; e.g. _cleanup_qemu. Signed-off-by: Jeff Cody Reviewed-by: Eric Blake --- tests/qemu-iotests/001 | 6 ------ tests/qemu-iotests/002 | 6 ------ tests/qemu-iotests/003 | 6 ------ tests/qemu-iotests/004 | 6 ------ tests/qemu-iotests/005 | 6 ------ tests/qemu-iotests/007 | 7 ------- tests/qemu-iotests/008 | 6 ------ tests/qemu-iotests/009 | 6 ------ tests/qemu-iotests/010 | 6 ------ tests/qemu-iotests/011 | 6 ------ tests/qemu-iotests/012 | 6 ------ tests/qemu-iotests/013 | 6 ------ tests/qemu-iotests/014 | 6 ------ tests/qemu-iotests/015 | 7 ------- tests/qemu-iotests/017 | 6 ------ tests/qemu-iotests/018 | 6 ------ tests/qemu-iotests/019 | 8 -------- tests/qemu-iotests/020 | 8 -------- tests/qemu-iotests/021 | 6 ------ tests/qemu-iotests/022 | 6 ------ tests/qemu-iotests/023 | 6 ------ tests/qemu-iotests/024 | 8 -------- tests/qemu-iotests/025 | 6 ------ tests/qemu-iotests/026 | 7 ------- tests/qemu-iotests/027 | 6 ------ tests/qemu-iotests/028 | 8 -------- tests/qemu-iotests/029 | 7 ------- tests/qemu-iotests/031 | 6 ------ tests/qemu-iotests/032 | 6 ------ tests/qemu-iotests/033 | 6 ------ tests/qemu-iotests/034 | 6 ------ tests/qemu-iotests/035 | 6 ------ tests/qemu-iotests/036 | 6 ------ tests/qemu-iotests/037 | 6 ------ tests/qemu-iotests/038 | 6 ------ tests/qemu-iotests/039 | 6 ------ tests/qemu-iotests/042 | 6 ------ tests/qemu-iotests/043 | 7 ------- tests/qemu-iotests/046 | 6 ------ tests/qemu-iotests/047 | 6 ------ tests/qemu-iotests/048 | 8 -------- tests/qemu-iotests/048.out | 1 - tests/qemu-iotests/049 | 6 ------ tests/qemu-iotests/050 | 8 -------- tests/qemu-iotests/051 | 6 ------ tests/qemu-iotests/052 | 6 ------ tests/qemu-iotests/053 | 7 ------- tests/qemu-iotests/054 | 6 ------ tests/qemu-iotests/058 | 47 ++++++++++++++----------------------------= ---- tests/qemu-iotests/059 | 7 ------- tests/qemu-iotests/060 | 6 ------ tests/qemu-iotests/061 | 6 ------ tests/qemu-iotests/062 | 6 ------ tests/qemu-iotests/063 | 7 ------- tests/qemu-iotests/064 | 6 ------ tests/qemu-iotests/066 | 6 ------ tests/qemu-iotests/068 | 6 ------ tests/qemu-iotests/069 | 6 ------ tests/qemu-iotests/070 | 6 ------ tests/qemu-iotests/071 | 6 ------ tests/qemu-iotests/072 | 6 ------ tests/qemu-iotests/073 | 6 ------ tests/qemu-iotests/074 | 9 --------- tests/qemu-iotests/074.out | 1 - tests/qemu-iotests/075 | 6 ------ tests/qemu-iotests/076 | 6 ------ tests/qemu-iotests/077 | 6 ------ tests/qemu-iotests/078 | 6 ------ tests/qemu-iotests/079 | 6 ------ tests/qemu-iotests/080 | 7 ------- tests/qemu-iotests/081 | 8 -------- tests/qemu-iotests/082 | 6 ------ tests/qemu-iotests/083 | 8 -------- tests/qemu-iotests/084 | 6 ------ tests/qemu-iotests/085 | 13 +------------ tests/qemu-iotests/086 | 6 ------ tests/qemu-iotests/088 | 7 ------- tests/qemu-iotests/089 | 6 ------ tests/qemu-iotests/090 | 6 ------ tests/qemu-iotests/091 | 8 +------- tests/qemu-iotests/092 | 7 ------- tests/qemu-iotests/094 | 9 +-------- tests/qemu-iotests/095 | 8 +------- tests/qemu-iotests/097 | 7 ------- tests/qemu-iotests/098 | 7 ------- tests/qemu-iotests/099 | 6 ------ tests/qemu-iotests/101 | 6 ------ tests/qemu-iotests/102 | 7 +------ tests/qemu-iotests/103 | 6 ------ tests/qemu-iotests/104 | 2 -- tests/qemu-iotests/105 | 6 ------ tests/qemu-iotests/106 | 6 ------ tests/qemu-iotests/107 | 6 ------ tests/qemu-iotests/108 | 6 ------ tests/qemu-iotests/109 | 8 +------- tests/qemu-iotests/110 | 6 ------ tests/qemu-iotests/111 | 6 ------ tests/qemu-iotests/112 | 6 ------ tests/qemu-iotests/113 | 6 ------ tests/qemu-iotests/114 | 6 ------ tests/qemu-iotests/115 | 6 ------ tests/qemu-iotests/116 | 6 ------ tests/qemu-iotests/117 | 7 +------ tests/qemu-iotests/119 | 6 ------ tests/qemu-iotests/120 | 6 ------ tests/qemu-iotests/121 | 6 ------ tests/qemu-iotests/122 | 7 ------- tests/qemu-iotests/123 | 7 ------- tests/qemu-iotests/125 | 6 ------ tests/qemu-iotests/130 | 7 +------ tests/qemu-iotests/131 | 6 ------ tests/qemu-iotests/133 | 6 ------ tests/qemu-iotests/134 | 6 ------ tests/qemu-iotests/135 | 6 ------ tests/qemu-iotests/137 | 6 ------ tests/qemu-iotests/138 | 6 ------ tests/qemu-iotests/140 | 8 +------- tests/qemu-iotests/141 | 8 +------- tests/qemu-iotests/142 | 7 ------- tests/qemu-iotests/143 | 7 +------ tests/qemu-iotests/144 | 8 +------- tests/qemu-iotests/145 | 7 ------- tests/qemu-iotests/146 | 7 +------ tests/qemu-iotests/150 | 6 ------ tests/qemu-iotests/153 | 12 ------------ tests/qemu-iotests/154 | 6 ------ tests/qemu-iotests/156 | 7 +------ tests/qemu-iotests/157 | 6 ------ tests/qemu-iotests/158 | 6 ------ tests/qemu-iotests/159 | 7 ------- tests/qemu-iotests/160 | 7 ------- tests/qemu-iotests/162 | 7 ------- tests/qemu-iotests/170 | 7 ------- tests/qemu-iotests/171 | 6 ------ tests/qemu-iotests/172 | 8 -------- tests/qemu-iotests/173 | 8 +------- tests/qemu-iotests/174 | 6 ------ tests/qemu-iotests/175 | 6 ------ tests/qemu-iotests/176 | 7 ------- tests/qemu-iotests/177 | 6 ------ tests/qemu-iotests/178 | 7 ------- tests/qemu-iotests/179 | 7 ------- tests/qemu-iotests/181 | 8 +------- tests/qemu-iotests/182 | 6 ------ tests/qemu-iotests/183 | 9 +-------- tests/qemu-iotests/184 | 6 ------ tests/qemu-iotests/185 | 9 +-------- tests/qemu-iotests/186 | 6 ------ tests/qemu-iotests/187 | 8 -------- tests/qemu-iotests/188 | 6 ------ tests/qemu-iotests/189 | 6 ------ tests/qemu-iotests/190 | 7 ------- tests/qemu-iotests/191 | 4 ---- tests/qemu-iotests/192 | 6 ------ tests/qemu-iotests/195 | 7 ------- tests/qemu-iotests/197 | 7 ------- 156 files changed, 32 insertions(+), 1023 deletions(-) diff --git a/tests/qemu-iotests/001 b/tests/qemu-iotests/001 index ffd14e2..6f71879 100755 --- a/tests/qemu-iotests/001 +++ b/tests/qemu-iotests/001 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/002 b/tests/qemu-iotests/002 index d4f8e91..4c9ff23 100755 --- a/tests/qemu-iotests/002 +++ b/tests/qemu-iotests/002 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/003 b/tests/qemu-iotests/003 index 19889b9..2648d03 100755 --- a/tests/qemu-iotests/003 +++ b/tests/qemu-iotests/003 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/004 b/tests/qemu-iotests/004 index 6f2aa3d..99743b4 100755 --- a/tests/qemu-iotests/004 +++ b/tests/qemu-iotests/004 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005 index 4447377..23a77e0 100755 --- a/tests/qemu-iotests/005 +++ b/tests/qemu-iotests/005 @@ -30,12 +30,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/007 b/tests/qemu-iotests/007 index fa543ee..c8068e5 100755 --- a/tests/qemu-iotests/007 +++ b/tests/qemu-iotests/007 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - true -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/008 b/tests/qemu-iotests/008 index 8e89d74..7f7f8ae 100755 --- a/tests/qemu-iotests/008 +++ b/tests/qemu-iotests/008 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/009 b/tests/qemu-iotests/009 index 16e4475..e03412a 100755 --- a/tests/qemu-iotests/009 +++ b/tests/qemu-iotests/009 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/010 b/tests/qemu-iotests/010 index 151dac2..8608848 100755 --- a/tests/qemu-iotests/010 +++ b/tests/qemu-iotests/010 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/011 b/tests/qemu-iotests/011 index f8d044e..0c0d15f 100755 --- a/tests/qemu-iotests/011 +++ b/tests/qemu-iotests/011 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/012 b/tests/qemu-iotests/012 index 01a770d..aa9cfb4 100755 --- a/tests/qemu-iotests/012 +++ b/tests/qemu-iotests/012 @@ -29,12 +29,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/013 b/tests/qemu-iotests/013 index d013f87..0ff9c4d 100755 --- a/tests/qemu-iotests/013 +++ b/tests/qemu-iotests/013 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/014 b/tests/qemu-iotests/014 index 2ea79e8..3dee9f7 100755 --- a/tests/qemu-iotests/014 +++ b/tests/qemu-iotests/014 @@ -29,12 +29,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/015 b/tests/qemu-iotests/015 index aaf9c3f..d29a778 100755 --- a/tests/qemu-iotests/015 +++ b/tests/qemu-iotests/015 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - true -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/017 b/tests/qemu-iotests/017 index 4f9302d..994ea0e 100755 --- a/tests/qemu-iotests/017 +++ b/tests/qemu-iotests/017 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/018 b/tests/qemu-iotests/018 index 1d39d35..11ad2b1 100755 --- a/tests/qemu-iotests/018 +++ b/tests/qemu-iotests/018 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019 index 24a789a..3728193 100755 --- a/tests/qemu-iotests/019 +++ b/tests/qemu-iotests/019 @@ -29,14 +29,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.base" - rm -f "$TEST_IMG.orig" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020 index 7a11110..37cd5d1 100755 --- a/tests/qemu-iotests/020 +++ b/tests/qemu-iotests/020 @@ -27,14 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.base" - rm -f "$TEST_IMG.orig" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/021 b/tests/qemu-iotests/021 index 11e8ed7..5ab2acb 100755 --- a/tests/qemu-iotests/021 +++ b/tests/qemu-iotests/021 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/022 b/tests/qemu-iotests/022 index 2452a9f..4870b17 100755 --- a/tests/qemu-iotests/022 +++ b/tests/qemu-iotests/022 @@ -29,12 +29,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/023 b/tests/qemu-iotests/023 index 497ae1e..5a2bf4e 100755 --- a/tests/qemu-iotests/023 +++ b/tests/qemu-iotests/023 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024 index e0d77ce..3e638d9 100755 --- a/tests/qemu-iotests/024 +++ b/tests/qemu-iotests/024 @@ -27,14 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_DIR/t.$IMGFMT.base_old" - rm -f "$TEST_DIR/t.$IMGFMT.base_new" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025 index f5e672e..93634c1 100755 --- a/tests/qemu-iotests/025 +++ b/tests/qemu-iotests/025 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026 index 7fadfba..dc4ff9f 100755 --- a/tests/qemu-iotests/026 +++ b/tests/qemu-iotests/026 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm "$TEST_DIR/blkdebug.conf" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/027 b/tests/qemu-iotests/027 index 08593da..c3f9146 100755 --- a/tests/qemu-iotests/027 +++ b/tests/qemu-iotests/027 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028 index 97a8869..3176789 100755 --- a/tests/qemu-iotests/028 +++ b/tests/qemu-iotests/028 @@ -30,14 +30,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - rm -f "${TEST_IMG}.copy" - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029 index 30bab24..981a864 100755 --- a/tests/qemu-iotests/029 +++ b/tests/qemu-iotests/029 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - rm -f $TEST_IMG.snap - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031 index 1e08abc..6805c2c 100755 --- a/tests/qemu-iotests/031 +++ b/tests/qemu-iotests/031 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/032 b/tests/qemu-iotests/032 index 24bcb52..dafcfb8 100755 --- a/tests/qemu-iotests/032 +++ b/tests/qemu-iotests/032 @@ -29,12 +29,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033 index 2cdfd13..bf3c59c 100755 --- a/tests/qemu-iotests/033 +++ b/tests/qemu-iotests/033 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/034 b/tests/qemu-iotests/034 index 1b28bda..830b0db 100755 --- a/tests/qemu-iotests/034 +++ b/tests/qemu-iotests/034 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/035 b/tests/qemu-iotests/035 index efc38e4..a79a4fd 100755 --- a/tests/qemu-iotests/035 +++ b/tests/qemu-iotests/035 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036 index ce638d6..841f347 100755 --- a/tests/qemu-iotests/036 +++ b/tests/qemu-iotests/036 @@ -30,12 +30,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/037 b/tests/qemu-iotests/037 index c476b82..756fc2c 100755 --- a/tests/qemu-iotests/037 +++ b/tests/qemu-iotests/037 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/038 b/tests/qemu-iotests/038 index d99a150..cf730ae 100755 --- a/tests/qemu-iotests/038 +++ b/tests/qemu-iotests/038 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039 index 1f48339..dd483c4 100755 --- a/tests/qemu-iotests/039 +++ b/tests/qemu-iotests/039 @@ -30,12 +30,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/042 b/tests/qemu-iotests/042 index a53e7cb..0efeec6 100755 --- a/tests/qemu-iotests/042 +++ b/tests/qemu-iotests/042 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/043 b/tests/qemu-iotests/043 index 1c6c22d..48b71fe 100755 --- a/tests/qemu-iotests/043 +++ b/tests/qemu-iotests/043 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG".[123].base -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046 index f2ebecf..362ed94 100755 --- a/tests/qemu-iotests/046 +++ b/tests/qemu-iotests/046 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/047 b/tests/qemu-iotests/047 index 1b8f3d4..1850035 100755 --- a/tests/qemu-iotests/047 +++ b/tests/qemu-iotests/047 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048 index 9ed04a0..c95bd2f 100755 --- a/tests/qemu-iotests/048 +++ b/tests/qemu-iotests/048 @@ -27,14 +27,6 @@ echo "QA output created by $seq" =20 status=3D1 # failure is the default! =20 -_cleanup() -{ - echo "Cleanup" - _cleanup_test_img - rm "${TEST_IMG_FILE2}" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - _compare() { $QEMU_IMG compare $QEMU_IMG_EXTRA_ARGS "$@" "$TEST_IMG" "${TEST_IMG2}" diff --git a/tests/qemu-iotests/048.out b/tests/qemu-iotests/048.out index 0bcf663..3318eed 100644 --- a/tests/qemu-iotests/048.out +++ b/tests/qemu-iotests/048.out @@ -39,4 +39,3 @@ wrote 512/512 bytes at offset 512 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) Content mismatch at offset 512! 1 -Cleanup diff --git a/tests/qemu-iotests/049 b/tests/qemu-iotests/049 index df35b6d..00733a6 100755 --- a/tests/qemu-iotests/049 +++ b/tests/qemu-iotests/049 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/050 b/tests/qemu-iotests/050 index 03b4a5d..e3b6d8c 100755 --- a/tests/qemu-iotests/050 +++ b/tests/qemu-iotests/050 @@ -27,14 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.old" - rm -f "$TEST_IMG.new" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051 index dba8816..24da3c5 100755 --- a/tests/qemu-iotests/051 +++ b/tests/qemu-iotests/051 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/052 b/tests/qemu-iotests/052 index 842eace..fc23fad 100755 --- a/tests/qemu-iotests/052 +++ b/tests/qemu-iotests/052 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/053 b/tests/qemu-iotests/053 index 2a04f5f..e8b9037 100755 --- a/tests/qemu-iotests/053 +++ b/tests/qemu-iotests/053 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - rm -f "$TEST_IMG.orig" - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/054 b/tests/qemu-iotests/054 index bf47ef9..e2de997 100755 --- a/tests/qemu-iotests/054 +++ b/tests/qemu-iotests/054 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/058 b/tests/qemu-iotests/058 index 2253c6a..9ff07aa 100755 --- a/tests/qemu-iotests/058 +++ b/tests/qemu-iotests/058 @@ -29,23 +29,22 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.pattern + +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux +_require_command QEMU_NBD +# Internal snapshots are (currently) impossible with refcount_bits=3D1 +_unsupported_imgopts 'refcount_bits=3D1[^0-9]' + nbd_unix_socket=3D$TEST_DIR/test_qemu_nbd_socket nbd_snapshot_img=3D"nbd:unix:$nbd_unix_socket" rm -f "${TEST_DIR}/qemu-nbd.pid" =20 -_cleanup_nbd() -{ - local NBD_SNAPSHOT_PID - if [ -f "${TEST_DIR}/qemu-nbd.pid" ]; then - read NBD_SNAPSHOT_PID < "${TEST_DIR}/qemu-nbd.pid" - rm -f "${TEST_DIR}/qemu-nbd.pid" - if [ -n "$NBD_SNAPSHOT_PID" ]; then - kill "$NBD_SNAPSHOT_PID" - fi - fi - rm -f "$nbd_unix_socket" -} - _wait_for_nbd() { for ((i =3D 0; i < 300; i++)) @@ -64,6 +63,7 @@ converted_image=3D$TEST_IMG.converted _export_nbd_snapshot() { _cleanup_nbd + rm -f "$nbd_unix_socket" $QEMU_NBD -v -t -k "$nbd_unix_socket" "$TEST_IMG" -l $1 & _wait_for_nbd } @@ -71,30 +71,11 @@ _export_nbd_snapshot() _export_nbd_snapshot1() { _cleanup_nbd + rm -f "$nbd_unix_socket" $QEMU_NBD -v -t -k "$nbd_unix_socket" "$TEST_IMG" -l snapshot.name=3D$= 1 & _wait_for_nbd } =20 -_cleanup() -{ - _cleanup_nbd - _cleanup_test_img - rm -f "$converted_image" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common.rc -. ./common.filter -. ./common.pattern - -_supported_fmt qcow2 -_supported_proto file -_supported_os Linux -_require_command QEMU_NBD -# Internal snapshots are (currently) impossible with refcount_bits=3D1 -_unsupported_imgopts 'refcount_bits=3D1[^0-9]' - # Use -f raw instead of -f $IMGFMT for the NBD connection QEMU_IO_NBD=3D"$QEMU_IO -f raw --cache=3D$CACHEMODE" =20 diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 index a1c34ee..6ccd250 100755 --- a/tests/qemu-iotests/059 +++ b/tests/qemu-iotests/059 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.qcow2" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 index 8e95c45..6532837 100755 --- a/tests/qemu-iotests/060 +++ b/tests/qemu-iotests/060 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061 index f5678b1..1346dd9 100755 --- a/tests/qemu-iotests/061 +++ b/tests/qemu-iotests/061 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/062 b/tests/qemu-iotests/062 index 051fb9f..3a1df0d 100755 --- a/tests/qemu-iotests/062 +++ b/tests/qemu-iotests/062 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/063 b/tests/qemu-iotests/063 index e4f6ea9..4a9fc44 100755 --- a/tests/qemu-iotests/063 +++ b/tests/qemu-iotests/063 @@ -28,13 +28,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.orig" "$TEST_IMG.raw1" "$TEST_IMG.raw2" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/064 b/tests/qemu-iotests/064 index 5792fbb..211c541 100755 --- a/tests/qemu-iotests/064 +++ b/tests/qemu-iotests/064 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066 index 8638217..e811f48 100755 --- a/tests/qemu-iotests/066 +++ b/tests/qemu-iotests/066 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068 index e7fca6a..d117ff3 100755 --- a/tests/qemu-iotests/068 +++ b/tests/qemu-iotests/068 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/069 b/tests/qemu-iotests/069 index 96e55ef..03d5a3c 100755 --- a/tests/qemu-iotests/069 +++ b/tests/qemu-iotests/069 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/070 b/tests/qemu-iotests/070 index 8d08d74..1220cc1 100755 --- a/tests/qemu-iotests/070 +++ b/tests/qemu-iotests/070 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071 index 48b4955..1a8d6e7 100755 --- a/tests/qemu-iotests/071 +++ b/tests/qemu-iotests/071 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/072 b/tests/qemu-iotests/072 index aa027c7..8aaf3fd 100755 --- a/tests/qemu-iotests/072 +++ b/tests/qemu-iotests/072 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/073 b/tests/qemu-iotests/073 index 40f85b1..c19ad0d 100755 --- a/tests/qemu-iotests/073 +++ b/tests/qemu-iotests/073 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/074 b/tests/qemu-iotests/074 index b17866b..d7888ab 100755 --- a/tests/qemu-iotests/074 +++ b/tests/qemu-iotests/074 @@ -27,15 +27,6 @@ echo "QA output created by $seq" =20 status=3D1 # failure is the default! =20 -_cleanup() -{ - echo "Cleanup" - _cleanup_test_img - rm "${TEST_IMG2}" - rm -f "$TEST_DIR/blkdebug.conf" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - _compare() { $QEMU_IMG compare "$@" "$TEST_IMG" "${TEST_IMG2}" diff --git a/tests/qemu-iotests/074.out b/tests/qemu-iotests/074.out index 8fba5ae..fb93965 100644 --- a/tests/qemu-iotests/074.out +++ b/tests/qemu-iotests/074.out @@ -15,4 +15,3 @@ qemu-img: Error while reading offset 0 of blkdebug:TEST_D= IR/blkdebug.conf:TEST_D qemu-img: Error while reading offset 0 of blkdebug:TEST_DIR/blkdebug.conf:= TEST_DIR/t.IMGFMT: Input/output error Warning: Image size mismatch! 4 -Cleanup diff --git a/tests/qemu-iotests/075 b/tests/qemu-iotests/075 index 770d51c..c2509d1 100755 --- a/tests/qemu-iotests/075 +++ b/tests/qemu-iotests/075 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/076 b/tests/qemu-iotests/076 index ef9e6a4..69bccad 100755 --- a/tests/qemu-iotests/076 +++ b/tests/qemu-iotests/076 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/077 b/tests/qemu-iotests/077 index d2d2a2d..4a458e1 100755 --- a/tests/qemu-iotests/077 +++ b/tests/qemu-iotests/077 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/078 b/tests/qemu-iotests/078 index f333e9a..22d078e 100755 --- a/tests/qemu-iotests/078 +++ b/tests/qemu-iotests/078 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/079 b/tests/qemu-iotests/079 index b2e3f74..fba6ec6 100755 --- a/tests/qemu-iotests/079 +++ b/tests/qemu-iotests/079 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080 index 55044c7..be548a9 100755 --- a/tests/qemu-iotests/080 +++ b/tests/qemu-iotests/080 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - rm -f $TEST_IMG.snap - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081 index da3fb09..2dadc16 100755 --- a/tests/qemu-iotests/081 +++ b/tests/qemu-iotests/081 @@ -27,14 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - rm -rf $TEST_DIR/1.raw - rm -rf $TEST_DIR/2.raw - rm -rf $TEST_DIR/3.raw -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/082 b/tests/qemu-iotests/082 index d5c83d4..aa585db 100755 --- a/tests/qemu-iotests/082 +++ b/tests/qemu-iotests/082 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/083 b/tests/qemu-iotests/083 index 0306f11..b2d0ce1 100755 --- a/tests/qemu-iotests/083 +++ b/tests/qemu-iotests/083 @@ -27,14 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - rm -f nbd.sock - rm -f nbd-fault-injector.out - rm -f nbd-fault-injector.conf -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/084 b/tests/qemu-iotests/084 index 04f2aa9..b0d42a0 100755 --- a/tests/qemu-iotests/084 +++ b/tests/qemu-iotests/084 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085 index 5c7668c..7b69f86 100755 --- a/tests/qemu-iotests/085 +++ b/tests/qemu-iotests/085 @@ -37,18 +37,7 @@ snapshot_virt1=3D"snapshot-v1.qcow2" =20 SNAPSHOTS=3D10 =20 -_cleanup() -{ - _cleanup_qemu - for i in $(seq 1 ${SNAPSHOTS}) - do - rm -f "${TEST_DIR}/${i}-${snapshot_virt0}" - rm -f "${TEST_DIR}/${i}-${snapshot_virt1}" - done - rm -f "${TEST_IMG}" "${TEST_IMG}.1" "${TEST_IMG}.2" "${TEST_IMG}.base" - -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/086 b/tests/qemu-iotests/086 index cd4494a..4d5f7db 100755 --- a/tests/qemu-iotests/086 +++ b/tests/qemu-iotests/086 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/088 b/tests/qemu-iotests/088 index b8076f2..72e7c68 100755 --- a/tests/qemu-iotests/088 +++ b/tests/qemu-iotests/088 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - rm -f $TEST_IMG.snap - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/089 b/tests/qemu-iotests/089 index 9bfe230..75151f1 100755 --- a/tests/qemu-iotests/089 +++ b/tests/qemu-iotests/089 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/090 b/tests/qemu-iotests/090 index 7380503..c3be13c 100755 --- a/tests/qemu-iotests/090 +++ b/tests/qemu-iotests/090 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 index 10ac4a8..c4df2fb 100755 --- a/tests/qemu-iotests/091 +++ b/tests/qemu-iotests/091 @@ -31,13 +31,7 @@ status=3D1 # failure is the default! =20 MIG_FIFO=3D"${TEST_DIR}/migrate" =20 -_cleanup() -{ - rm -f "${MIG_FIFO}" - _cleanup_qemu - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/092 b/tests/qemu-iotests/092 index 5bbdd07..3b8cf8f 100755 --- a/tests/qemu-iotests/092 +++ b/tests/qemu-iotests/092 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - rm -f $TEST_IMG.snap - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094 index 9aa01e3..35e882c 100755 --- a/tests/qemu-iotests/094 +++ b/tests/qemu-iotests/094 @@ -27,14 +27,7 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - _cleanup_test_img - rm -f "$TEST_DIR/source.$IMGFMT" -} - -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/095 b/tests/qemu-iotests/095 index 030adb2..75d60c4 100755 --- a/tests/qemu-iotests/095 +++ b/tests/qemu-iotests/095 @@ -30,13 +30,7 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - rm -f "${TEST_IMG}.base" "${TEST_IMG}.snp1" - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/097 b/tests/qemu-iotests/097 index e22670c..81e6729 100755 --- a/tests/qemu-iotests/097 +++ b/tests/qemu-iotests/097 @@ -28,13 +28,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - _rm_test_img "$TEST_IMG.itmd" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098 index b002e96..24d8510 100755 --- a/tests/qemu-iotests/098 +++ b/tests/qemu-iotests/098 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_DIR/blkdebug.conf" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099 index caaf58e..d811b34 100755 --- a/tests/qemu-iotests/099 +++ b/tests/qemu-iotests/099 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/101 b/tests/qemu-iotests/101 index ea53f8b..62faf99 100755 --- a/tests/qemu-iotests/101 +++ b/tests/qemu-iotests/101 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102 index d7ad8d9..201c520 100755 --- a/tests/qemu-iotests/102 +++ b/tests/qemu-iotests/102 @@ -27,12 +27,7 @@ echo "QA output created by $seq" here=3D$PWD status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and qemu instance handling . ./common.rc diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103 index ecbd8eb..df86d4f 100755 --- a/tests/qemu-iotests/103 +++ b/tests/qemu-iotests/103 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D$PWD status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/104 b/tests/qemu-iotests/104 index 726d467..f10d311 100755 --- a/tests/qemu-iotests/104 +++ b/tests/qemu-iotests/104 @@ -27,8 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -trap "exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/105 b/tests/qemu-iotests/105 index 3db4ce3..b469b1b 100755 --- a/tests/qemu-iotests/105 +++ b/tests/qemu-iotests/105 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/106 b/tests/qemu-iotests/106 index bfe71f4..e4db5a1 100755 --- a/tests/qemu-iotests/106 +++ b/tests/qemu-iotests/106 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D$PWD status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment and filters . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/107 b/tests/qemu-iotests/107 index d7222dc..d513120 100755 --- a/tests/qemu-iotests/107 +++ b/tests/qemu-iotests/107 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/108 b/tests/qemu-iotests/108 index 2355d98..8371db4 100755 --- a/tests/qemu-iotests/108 +++ b/tests/qemu-iotests/108 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109 index d70b574..d4fca99 100755 --- a/tests/qemu-iotests/109 +++ b/tests/qemu-iotests/109 @@ -27,13 +27,7 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - rm -f $TEST_IMG.src - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/110 b/tests/qemu-iotests/110 index 9de7369..93dd09f 100755 --- a/tests/qemu-iotests/110 +++ b/tests/qemu-iotests/110 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/111 b/tests/qemu-iotests/111 index a1c152d..f590d82 100755 --- a/tests/qemu-iotests/111 +++ b/tests/qemu-iotests/111 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/112 b/tests/qemu-iotests/112 index 28eb9aa..ee3679e 100755 --- a/tests/qemu-iotests/112 +++ b/tests/qemu-iotests/112 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/113 b/tests/qemu-iotests/113 index 19b68b2..07437ea 100755 --- a/tests/qemu-iotests/113 +++ b/tests/qemu-iotests/113 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/114 b/tests/qemu-iotests/114 index 5b7dc54..5bfd473 100755 --- a/tests/qemu-iotests/114 +++ b/tests/qemu-iotests/114 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/115 b/tests/qemu-iotests/115 index 665c2ea..0c9aaad 100755 --- a/tests/qemu-iotests/115 +++ b/tests/qemu-iotests/115 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/116 b/tests/qemu-iotests/116 index df0172f..e687601 100755 --- a/tests/qemu-iotests/116 +++ b/tests/qemu-iotests/116 @@ -30,12 +30,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/117 b/tests/qemu-iotests/117 index 6c83461..579cecb 100755 --- a/tests/qemu-iotests/117 +++ b/tests/qemu-iotests/117 @@ -27,12 +27,7 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/119 b/tests/qemu-iotests/119 index 4f34fb4..8cdb404 100755 --- a/tests/qemu-iotests/119 +++ b/tests/qemu-iotests/119 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/120 b/tests/qemu-iotests/120 index f40b97d..bb0e2dd 100755 --- a/tests/qemu-iotests/120 +++ b/tests/qemu-iotests/120 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/121 b/tests/qemu-iotests/121 index 1307b4e..d75fce1 100755 --- a/tests/qemu-iotests/121 +++ b/tests/qemu-iotests/121 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/122 b/tests/qemu-iotests/122 index 45b359c..3942604 100755 --- a/tests/qemu-iotests/122 +++ b/tests/qemu-iotests/122 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - rm -f "$TEST_IMG".[123] - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/123 b/tests/qemu-iotests/123 index b18e3fc..98fd3ce 100755 --- a/tests/qemu-iotests/123 +++ b/tests/qemu-iotests/123 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$SRC_IMG" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/125 b/tests/qemu-iotests/125 index 9424313..bca5fb5 100755 --- a/tests/qemu-iotests/125 +++ b/tests/qemu-iotests/125 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D$PWD status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - get_image_size_on_host() { $QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" | grep "disk size" \ diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130 index e7e43de..4aad4ea 100755 --- a/tests/qemu-iotests/130 +++ b/tests/qemu-iotests/130 @@ -29,12 +29,7 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/131 b/tests/qemu-iotests/131 index 94a9ae7..52588ef 100755 --- a/tests/qemu-iotests/131 +++ b/tests/qemu-iotests/131 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/133 b/tests/qemu-iotests/133 index 9d35a6a..2d0aae9 100755 --- a/tests/qemu-iotests/133 +++ b/tests/qemu-iotests/133 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/134 b/tests/qemu-iotests/134 index 9914415..147ea2c 100755 --- a/tests/qemu-iotests/134 +++ b/tests/qemu-iotests/134 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/135 b/tests/qemu-iotests/135 index ce60831..75c160d 100755 --- a/tests/qemu-iotests/135 +++ b/tests/qemu-iotests/135 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137 index eb91e51..6068a13 100755 --- a/tests/qemu-iotests/137 +++ b/tests/qemu-iotests/137 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/138 b/tests/qemu-iotests/138 index 21650d8..9682560 100755 --- a/tests/qemu-iotests/138 +++ b/tests/qemu-iotests/138 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/140 b/tests/qemu-iotests/140 index f89d0d6..c5e1a5b 100755 --- a/tests/qemu-iotests/140 +++ b/tests/qemu-iotests/140 @@ -31,13 +31,7 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - _cleanup_test_img - rm -f "$TEST_DIR/nbd" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/141 b/tests/qemu-iotests/141 index 2f9d7b9..cff2319 100755 --- a/tests/qemu-iotests/141 +++ b/tests/qemu-iotests/141 @@ -27,13 +27,7 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - _cleanup_test_img - rm -f "$TEST_DIR"/{b,m,o}.$IMGFMT -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/142 b/tests/qemu-iotests/142 index 1639c83..65775be 100755 --- a/tests/qemu-iotests/142 +++ b/tests/qemu-iotests/142 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f $TEST_IMG.snap -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/143 b/tests/qemu-iotests/143 index 5ff1944..b4736aa 100755 --- a/tests/qemu-iotests/143 +++ b/tests/qemu-iotests/143 @@ -27,12 +27,7 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - rm -f "$TEST_DIR/nbd" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/144 b/tests/qemu-iotests/144 index 00de3c3..b47c561 100755 --- a/tests/qemu-iotests/144 +++ b/tests/qemu-iotests/144 @@ -32,13 +32,7 @@ status=3D1 # failure is the default! TMP_SNAP1=3D${TEST_DIR}/tmp.qcow2 TMP_SNAP2=3D${TEST_DIR}/tmp2.qcow2 =20 -_cleanup() -{ - _cleanup_qemu - rm -f "${TEST_IMG}" "${TMP_SNAP1}" "${TMP_SNAP2}" -} - -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/145 b/tests/qemu-iotests/145 index c371b3c..930628e 100755 --- a/tests/qemu-iotests/145 +++ b/tests/qemu-iotests/145 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - true -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/146 b/tests/qemu-iotests/146 index 043711b..99b1e81 100755 --- a/tests/qemu-iotests/146 +++ b/tests/qemu-iotests/146 @@ -27,12 +27,7 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/150 b/tests/qemu-iotests/150 index ee8f637..120920e 100755 --- a/tests/qemu-iotests/150 +++ b/tests/qemu-iotests/150 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153 index fa25eb2..42882eb 100755 --- a/tests/qemu-iotests/153 +++ b/tests/qemu-iotests/153 @@ -28,18 +28,6 @@ here=3D"$PWD" tmp=3D/tmp/$$ status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "${TEST_IMG}.base" - rm -f "${TEST_IMG}.convert" - rm -f "${TEST_IMG}.a" - rm -f "${TEST_IMG}.b" - rm -f "${TEST_IMG}.c" - rm -f "${TEST_IMG}.lnk" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/154 b/tests/qemu-iotests/154 index fde03b0..90e7e65 100755 --- a/tests/qemu-iotests/154 +++ b/tests/qemu-iotests/154 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156 index e75dc4d..9dbc6d7 100755 --- a/tests/qemu-iotests/156 +++ b/tests/qemu-iotests/156 @@ -35,12 +35,7 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - rm -f "$TEST_IMG"{,.target}{,.backing,.overlay} -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/157 b/tests/qemu-iotests/157 index 2bf02be..bda53c8 100755 --- a/tests/qemu-iotests/157 +++ b/tests/qemu-iotests/157 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/158 b/tests/qemu-iotests/158 index 24ac600..a07708e 100755 --- a/tests/qemu-iotests/158 +++ b/tests/qemu-iotests/158 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/159 b/tests/qemu-iotests/159 index 9b0e1ec..7fcccde 100755 --- a/tests/qemu-iotests/159 +++ b/tests/qemu-iotests/159 @@ -26,13 +26,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.out" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - . ./common.rc . ./common.filter . ./common.pattern diff --git a/tests/qemu-iotests/160 b/tests/qemu-iotests/160 index 5c910e5..48dd25d 100755 --- a/tests/qemu-iotests/160 +++ b/tests/qemu-iotests/160 @@ -26,13 +26,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.out" "$TEST_IMG.out.dd" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - . ./common.rc . ./common.filter . ./common.pattern diff --git a/tests/qemu-iotests/162 b/tests/qemu-iotests/162 index 477a806..cad2bd7 100755 --- a/tests/qemu-iotests/162 +++ b/tests/qemu-iotests/162 @@ -28,13 +28,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - rm -f "${TEST_DIR}/qemu-nbd.pid" - rm -f 42 -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/170 b/tests/qemu-iotests/170 index b79359f..5288a2d 100755 --- a/tests/qemu-iotests/170 +++ b/tests/qemu-iotests/170 @@ -26,13 +26,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.out" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - . ./common.rc . ./common.filter . ./common.pattern diff --git a/tests/qemu-iotests/171 b/tests/qemu-iotests/171 index bcfaaf1..2798d2f 100755 --- a/tests/qemu-iotests/171 +++ b/tests/qemu-iotests/171 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172 index 02c5f79..d9efd4b 100755 --- a/tests/qemu-iotests/172 +++ b/tests/qemu-iotests/172 @@ -27,14 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.2" - rm -f "$TEST_IMG.3" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/173 b/tests/qemu-iotests/173 index bdaa092..0c2fde4 100755 --- a/tests/qemu-iotests/173 +++ b/tests/qemu-iotests/173 @@ -27,13 +27,7 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_qemu - rm -f "${QEMU_TEST_DIR}/image.base" "${QEMU_TEST_DIR}/image.snp1" - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/174 b/tests/qemu-iotests/174 index 552879d..67cd785 100755 --- a/tests/qemu-iotests/174 +++ b/tests/qemu-iotests/174 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175 index ca56e82..1407597 100755 --- a/tests/qemu-iotests/175 +++ b/tests/qemu-iotests/175 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/176 b/tests/qemu-iotests/176 index 950b287..56cd490 100755 --- a/tests/qemu-iotests/176 +++ b/tests/qemu-iotests/176 @@ -31,13 +31,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - _rm_test_img "$TEST_IMG.itmd" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/177 b/tests/qemu-iotests/177 index f8ed8fb..ed2e8b2 100755 --- a/tests/qemu-iotests/177 +++ b/tests/qemu-iotests/177 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/178 b/tests/qemu-iotests/178 index 6af52c6..fd583d1 100755 --- a/tests/qemu-iotests/178 +++ b/tests/qemu-iotests/178 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.converted" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/179 b/tests/qemu-iotests/179 index 115944a..f7cf129 100755 --- a/tests/qemu-iotests/179 +++ b/tests/qemu-iotests/179 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_DIR/blkdebug.conf" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181 index 0c91e8f..18fb133 100755 --- a/tests/qemu-iotests/181 +++ b/tests/qemu-iotests/181 @@ -29,13 +29,7 @@ status=3D1 # failure is the default! =20 MIG_SOCKET=3D"${TEST_DIR}/migrate" =20 -_cleanup() -{ - rm -f "${MIG_SOCKET}" - _cleanup_test_img - _cleanup_qemu -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/182 b/tests/qemu-iotests/182 index 2e078ce..a842f9f 100755 --- a/tests/qemu-iotests/182 +++ b/tests/qemu-iotests/182 @@ -28,12 +28,6 @@ here=3D"$PWD" tmp=3D/tmp/$$ status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/183 b/tests/qemu-iotests/183 index 20268ff..2e09679 100755 --- a/tests/qemu-iotests/183 +++ b/tests/qemu-iotests/183 @@ -29,14 +29,7 @@ status=3D1 # failure is the default! =20 MIG_SOCKET=3D"${TEST_DIR}/migrate" =20 -_cleanup() -{ - rm -f "${MIG_SOCKET}" - rm -f "${TEST_IMG}.dest" - _cleanup_test_img - _cleanup_qemu -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/184 b/tests/qemu-iotests/184 index 704f38f..2130e64 100755 --- a/tests/qemu-iotests/184 +++ b/tests/qemu-iotests/184 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185 index f5b47e4..7269d5e 100755 --- a/tests/qemu-iotests/185 +++ b/tests/qemu-iotests/185 @@ -29,14 +29,7 @@ status=3D1 # failure is the default! =20 MIG_SOCKET=3D"${TEST_DIR}/migrate" =20 -_cleanup() -{ - rm -f "${TEST_IMG}.mid" - rm -f "${TEST_IMG}.copy" - _cleanup_test_img - _cleanup_qemu -} -trap "_cleanup; exit \$status" 0 1 2 3 15 +trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 =20 # get standard environment, filters and checks . ./common.rc diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186 index 44cc01e..27d6530 100755 --- a/tests/qemu-iotests/186 +++ b/tests/qemu-iotests/186 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/187 b/tests/qemu-iotests/187 index 7bb7833..8b29df3 100755 --- a/tests/qemu-iotests/187 +++ b/tests/qemu-iotests/187 @@ -27,14 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.2" - rm -f "$TEST_IMG.3" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/188 b/tests/qemu-iotests/188 index 83ed03e..48f855d 100755 --- a/tests/qemu-iotests/188 +++ b/tests/qemu-iotests/188 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/189 b/tests/qemu-iotests/189 index e695475..c5d516d 100755 --- a/tests/qemu-iotests/189 +++ b/tests/qemu-iotests/189 @@ -27,12 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/190 b/tests/qemu-iotests/190 index 8f808fe..84d20c6 100755 --- a/tests/qemu-iotests/190 +++ b/tests/qemu-iotests/190 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.converted" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191 index ac2b88f..f97e580 100755 --- a/tests/qemu-iotests/191 +++ b/tests/qemu-iotests/191 @@ -31,10 +31,6 @@ MIG_SOCKET=3D"${TEST_DIR}/migrate" =20 _cleanup() { - rm -f "${TEST_IMG}.mid" - rm -f "${TEST_IMG}.ovl2" - rm -f "${TEST_IMG}.ovl3" - _cleanup_test_img _cleanup_qemu } trap "_cleanup; exit \$status" 0 1 2 3 15 diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192 index 595f0d7..be24bfb 100755 --- a/tests/qemu-iotests/192 +++ b/tests/qemu-iotests/192 @@ -28,12 +28,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/195 b/tests/qemu-iotests/195 index e7a403d..b826152 100755 --- a/tests/qemu-iotests/195 +++ b/tests/qemu-iotests/195 @@ -27,13 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$TEST_IMG.mid" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197 index 887eb4f..df09870 100755 --- a/tests/qemu-iotests/197 +++ b/tests/qemu-iotests/197 @@ -41,13 +41,6 @@ case "$TEST_DIR" in _notrun "Suspicious TEST_DIR=3D'$TEST_DIR', cowardly refusing to r= un" ;; esac =20 -_cleanup() -{ - _cleanup_test_img - rm -f "$BLKDBG_CONF" -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # Test is supported for any backing file; but we force qcow2 for our wrapp= er. _supported_fmt generic _supported_proto generic --=20 2.9.5 From nobody Thu May 2 20:15:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 150825823755567.6040678886809; Tue, 17 Oct 2017 09:37:17 -0700 (PDT) Received: from localhost ([::1]:40476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Urb-0001nY-MZ for importer@patchew.org; Tue, 17 Oct 2017 12:37:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Un3-0006mf-8T for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4Un1-0006I9-Ss for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20881) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4Umy-0006CJ-VL; Tue, 17 Oct 2017 12:32:21 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CC350C04AC5A; Tue, 17 Oct 2017 16:32:19 +0000 (UTC) Received: from localhost (ovpn-117-62.phx2.redhat.com [10.3.117.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C15061783; Tue, 17 Oct 2017 16:32:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CC350C04AC5A Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jcody@redhat.com From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 12:31:50 -0400 Message-Id: <85b170e6abd3f92bee7449d0970f6ba24e589c72.1508257445.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 17 Oct 2017 16:32:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 05/10] qemu-iotests: change qemu pid and fd tracking / cleanup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" So that later patches can cleanup running qemu processes called from different subshells, track resources to cleanup in pid and fd list files. In subsquent patches, ./check will kill all QEMU processes launched with the common.qemu framework, and the tests will not need to cleanup manually (unless they want to do so as part of the test, e.g. wait for a process to end such as migration). Signed-off-by: Jeff Cody --- tests/qemu-iotests/common.qemu | 82 ++++++++++++++++++++++++++++++++------= ---- tests/qemu-iotests/common.rc | 3 +- 2 files changed, 64 insertions(+), 21 deletions(-) diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu index 7b3052d..35a08a6 100644 --- a/tests/qemu-iotests/common.qemu +++ b/tests/qemu-iotests/common.qemu @@ -33,6 +33,10 @@ QEMU_FIFO_OUT=3D"${QEMU_TEST_DIR}/qmp-out-$$" QEMU_HANDLE=3D0 export _QEMU_HANDLE=3D0 =20 +QEMU_PID_LIST=3D"${QEMU_TEST_DIR}"/qemu-pid.lst +QEMU_OUT_FD_LIST=3D"${QEMU_TEST_DIR}"/qemu-out-fd.lst +QEMU_IN_FD_LIST=3D"${QEMU_TEST_DIR}"/qemu-in-fd.lst +QEMU_FIFO_LIST=3D"${QEMU_TEST_DIR}"/qemu-fifo.lst # If bash version is >=3D 4.1, these will be overwritten and dynamic # file descriptor values assigned. _out_fd=3D3 @@ -193,6 +197,10 @@ function _launch_qemu() QEMU_OUT[${_QEMU_HANDLE}]=3D${_out_fd} QEMU_IN[${_QEMU_HANDLE}]=3D${_in_fd} QEMU_STATUS[${_QEMU_HANDLE}]=3D0 + echo ${_out_fd} >> "$QEMU_OUT_FD_LIST" + echo ${_in_fd} >> "$QEMU_IN_FD_LIST" + echo ${fifo_in} >> "$QEMU_FIFO_LIST" + echo ${fifo_out} >> "$QEMU_FIFO_LIST" =20 if [ "${qemu_comm_method}" =3D=3D "qmp" ] then @@ -209,35 +217,71 @@ function _launch_qemu() =20 # Silenty kills the QEMU process # +# This is able to kill and clean up after QEMU processes without the +# need for any subshell-specific variables, so long as the qemu-pidlist +# and qemu-out-fd.list and qemu-in-fd.list files are properly maintained. +# # If $wait is set to anything other than the empty string, the process wil= l not # be killed but only waited for, and any output will be forwarded to stdou= t. If # $wait is empty, the process will be killed and all output will be suppre= ssed. function _cleanup_qemu() { - # QEMU_PID[], QEMU_IN[], QEMU_OUT[] all use same indices - for i in "${!QEMU_OUT[@]}" + local fifo_path=3D + local testdir_path=3D + + if [ ! -e "${QEMU_PID_LIST}" ]; then + return + fi + + # get line count, and therefore number of processes to kill + numproc=3D$(wc -l "${QEMU_PID_LIST}" | sed 's/\s.*//') + + for i in $(seq 1 $numproc) do local QEMU_PID - if [ -f "${QEMU_TEST_DIR}/qemu-${i}.pid" ]; then - read QEMU_PID < "${QEMU_TEST_DIR}/qemu-${i}.pid" - rm -f "${QEMU_TEST_DIR}/qemu-${i}.pid" - if [ -z "${wait}" ] && [ -n "${QEMU_PID}" ]; then - kill -KILL ${QEMU_PID} 2>/dev/null - fi - if [ -n "${QEMU_PID}" ]; then - wait ${QEMU_PID} 2>/dev/null # silent kill - fi + local OUT_FD + local IN_FD + j=3D$(expr $i - 1) + + QEMU_PID=3D$(tail -n+${i} "${QEMU_PID_LIST}" | head -n1) + OUT_FD=3D$(tail -n+${i} "${QEMU_OUT_FD_LIST}" | head -n1) + IN_FD=3D$(tail -n+${i} "${QEMU_IN_FD_LIST}" | head -n1) + + if [ -z "${wait}" ] && [ -n "${QEMU_PID}" ]; then + kill -KILL ${QEMU_PID} 2>/dev/null + fi + if [ -n "${QEMU_PID}" ]; then + wait ${QEMU_PID} 2>/dev/null # silent kill fi =20 - if [ -n "${wait}" ]; then - cat <&${QEMU_OUT[$i]} | _filter_testdir | _filter_qemu \ - | _filter_qemu_io | _filter_qmp | _filte= r_hmp + if [ -n "${wait}" ] && [ -n "${OUT_FD}" ]; then + cat <&${OUT_FD} | _filter_testdir | _filter_qemu \ + | _filter_qemu_io | _filter_qmp | _filter_hmp + fi + + if [ -n "${IN_FD}" ]; then + eval "exec ${IN_FD}<&-" # close file descriptors + fi + if [ -n "${OUT_FD}" ]; then + eval "exec ${OUT_FD}<&-" fi - rm -f "${QEMU_FIFO_IN}_${i}" "${QEMU_FIFO_OUT}_${i}" - eval "exec ${QEMU_IN[$i]}<&-" # close file descriptors - eval "exec ${QEMU_OUT[$i]}<&-" =20 - unset QEMU_IN[$i] - unset QEMU_OUT[$i] + unset QEMU_IN[$j] + unset QEMU_OUT[$j] done + + # The FIFOs do not correspond to process entry in the pidlist, so + # just clean them up afterwards + while read fifo_name + do + # make sure entries are inside the $TEST_DIR + fifo_path=3D$(dirname -z $(realpath "$fifo_name")) + testdir_path=3D$(realpath "$QEMU_TEST_DIR") + if [ "$fifo_path" =3D=3D "$testdir_path" ] + then + rm -f "$fifo_name" + fi + done < "${QEMU_FIFO_LIST}" + + rm -f "${QEMU_PID_LIST}" "${QEMU_OUT_FD_LIST}" "${QEMU_IN_FD_LIST}" "$= QEMU_FIFO_LIST}" } diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index a345ffd..b26b02f 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -40,7 +40,6 @@ poke_file() printf "$3" | dd "of=3D$1" bs=3D1 "seek=3D$2" conv=3Dnotrunc &>/dev/nu= ll } =20 - if ! . ./common.config then echo "$0: failed to source common.config" @@ -51,7 +50,7 @@ _qemu_wrapper() { ( if [ -n "${QEMU_NEED_PID}" ]; then - echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid" + echo $BASHPID >> "${QEMU_TEST_DIR}/qemu-pid.lst" fi exec "$QEMU_PROG" $QEMU_OPTIONS "$@" ) --=20 2.9.5 From nobody Thu May 2 20:15:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508258098230843.8026281652777; Tue, 17 Oct 2017 09:34:58 -0700 (PDT) Received: from localhost ([::1]:40456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4UpB-00088E-Az for importer@patchew.org; Tue, 17 Oct 2017 12:34:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4UnB-0006ui-BC for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4Un9-0006SR-N4 for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52350) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4Un4-0006LO-So; Tue, 17 Oct 2017 12:32:27 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B9E07EAA1; Tue, 17 Oct 2017 16:32:25 +0000 (UTC) Received: from localhost (ovpn-117-62.phx2.redhat.com [10.3.117.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A885649A8; Tue, 17 Oct 2017 16:32:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6B9E07EAA1 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jcody@redhat.com From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 12:31:51 -0400 Message-Id: <24c7d85bd96b8cbf02bf60dabc0787724c19b18b.1508257445.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 17 Oct 2017 16:32:25 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 06/10] qemu-iotests: make ./check automatically reap QEMU processes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Check will now take care of cleaning up all QEMU processes started from bash tests using the common.qemu framework. This also paves the way to added another check option to keep QEMU processes around, in the case of a failed test. Signed-off-by: Jeff Cody Reviewed-by: Eric Blake --- tests/qemu-iotests/085 | 2 -- tests/qemu-iotests/091 | 2 -- tests/qemu-iotests/094 | 2 -- tests/qemu-iotests/095 | 2 -- tests/qemu-iotests/102 | 2 -- tests/qemu-iotests/109 | 2 -- tests/qemu-iotests/117 | 2 -- tests/qemu-iotests/130 | 2 -- tests/qemu-iotests/140 | 2 -- tests/qemu-iotests/141 | 2 -- tests/qemu-iotests/143 | 2 -- tests/qemu-iotests/144 | 2 -- tests/qemu-iotests/146 | 2 -- tests/qemu-iotests/156 | 2 -- tests/qemu-iotests/173 | 2 -- tests/qemu-iotests/181 | 2 -- tests/qemu-iotests/183 | 2 -- tests/qemu-iotests/185 | 2 -- tests/qemu-iotests/191 | 6 ------ tests/qemu-iotests/check | 7 +++++-- 20 files changed, 5 insertions(+), 44 deletions(-) diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085 index 7b69f86..283f9a9 100755 --- a/tests/qemu-iotests/085 +++ b/tests/qemu-iotests/085 @@ -37,8 +37,6 @@ snapshot_virt1=3D"snapshot-v1.qcow2" =20 SNAPSHOTS=3D10 =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 index c4df2fb..cc4c50c 100755 --- a/tests/qemu-iotests/091 +++ b/tests/qemu-iotests/091 @@ -31,8 +31,6 @@ status=3D1 # failure is the default! =20 MIG_FIFO=3D"${TEST_DIR}/migrate" =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094 index 35e882c..1587550 100755 --- a/tests/qemu-iotests/094 +++ b/tests/qemu-iotests/094 @@ -27,8 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/095 b/tests/qemu-iotests/095 index 75d60c4..2891014 100755 --- a/tests/qemu-iotests/095 +++ b/tests/qemu-iotests/095 @@ -30,8 +30,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102 index 201c520..2980638 100755 --- a/tests/qemu-iotests/102 +++ b/tests/qemu-iotests/102 @@ -27,8 +27,6 @@ echo "QA output created by $seq" here=3D$PWD status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and qemu instance handling . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109 index d4fca99..2f6e456 100755 --- a/tests/qemu-iotests/109 +++ b/tests/qemu-iotests/109 @@ -27,8 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/117 b/tests/qemu-iotests/117 index 579cecb..a427ee7 100755 --- a/tests/qemu-iotests/117 +++ b/tests/qemu-iotests/117 @@ -27,8 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130 index 4aad4ea..3610738 100755 --- a/tests/qemu-iotests/130 +++ b/tests/qemu-iotests/130 @@ -29,8 +29,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/140 b/tests/qemu-iotests/140 index c5e1a5b..ec79402 100755 --- a/tests/qemu-iotests/140 +++ b/tests/qemu-iotests/140 @@ -31,8 +31,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/141 b/tests/qemu-iotests/141 index cff2319..39b75a4 100755 --- a/tests/qemu-iotests/141 +++ b/tests/qemu-iotests/141 @@ -27,8 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/143 b/tests/qemu-iotests/143 index b4736aa..e107ae3 100755 --- a/tests/qemu-iotests/143 +++ b/tests/qemu-iotests/143 @@ -27,8 +27,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/144 b/tests/qemu-iotests/144 index b47c561..8b55d33 100755 --- a/tests/qemu-iotests/144 +++ b/tests/qemu-iotests/144 @@ -32,8 +32,6 @@ status=3D1 # failure is the default! TMP_SNAP1=3D${TEST_DIR}/tmp.qcow2 TMP_SNAP2=3D${TEST_DIR}/tmp2.qcow2 =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/146 b/tests/qemu-iotests/146 index 99b1e81..7dffe22 100755 --- a/tests/qemu-iotests/146 +++ b/tests/qemu-iotests/146 @@ -27,8 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156 index 9dbc6d7..26ebd73 100755 --- a/tests/qemu-iotests/156 +++ b/tests/qemu-iotests/156 @@ -35,8 +35,6 @@ echo "QA output created by $seq" here=3D"$PWD" status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/173 b/tests/qemu-iotests/173 index 0c2fde4..933cd96 100755 --- a/tests/qemu-iotests/173 +++ b/tests/qemu-iotests/173 @@ -27,8 +27,6 @@ echo "QA output created by $seq" here=3D`pwd` status=3D1 # failure is the default! =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181 index 18fb133..e6f7908 100755 --- a/tests/qemu-iotests/181 +++ b/tests/qemu-iotests/181 @@ -29,8 +29,6 @@ status=3D1 # failure is the default! =20 MIG_SOCKET=3D"${TEST_DIR}/migrate" =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/183 b/tests/qemu-iotests/183 index 2e09679..cb82d3c 100755 --- a/tests/qemu-iotests/183 +++ b/tests/qemu-iotests/183 @@ -29,8 +29,6 @@ status=3D1 # failure is the default! =20 MIG_SOCKET=3D"${TEST_DIR}/migrate" =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185 index 7269d5e..ef4b1cd 100755 --- a/tests/qemu-iotests/185 +++ b/tests/qemu-iotests/185 @@ -29,8 +29,6 @@ status=3D1 # failure is the default! =20 MIG_SOCKET=3D"${TEST_DIR}/migrate" =20 -trap "_cleanup_qemu; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191 index f97e580..7fc1365 100755 --- a/tests/qemu-iotests/191 +++ b/tests/qemu-iotests/191 @@ -29,12 +29,6 @@ status=3D1 # failure is the default! =20 MIG_SOCKET=3D"${TEST_DIR}/migrate" =20 -_cleanup() -{ - _cleanup_qemu -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - # get standard environment, filters and checks . ./common.rc . ./common.filter diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index b4ab646..057ea39 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -845,10 +845,13 @@ do # TEST_DIR / QEMU_TEST_DIR ( export TEST_DIR=3D$TEST_DIR_SEQ - . "$source_iotests/common.config" - . "$source_iotests/common.rc" + cd "$source_iotests"; + . ./common.config + . ./common.rc + . ./common.qemu =20 _cleanup_protocols + _cleanup_qemu ) rm -rf "$TEST_DIR_SEQ" =20 --=20 2.9.5 From nobody Thu May 2 20:15:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 150825838938196.37641934216663; Tue, 17 Oct 2017 09:39:49 -0700 (PDT) Received: from localhost ([::1]:40486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Uu7-0003x5-9u for importer@patchew.org; Tue, 17 Oct 2017 12:39:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4UnE-0006xI-8E for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4UnC-0006VM-1V for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34790) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4Un9-0006Rr-Qx; Tue, 17 Oct 2017 12:32:31 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F181B7E45F; Tue, 17 Oct 2017 16:32:30 +0000 (UTC) Received: from localhost (ovpn-117-62.phx2.redhat.com [10.3.117.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 362E26178E; Tue, 17 Oct 2017 16:32:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F181B7E45F Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jcody@redhat.com From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 12:31:52 -0400 Message-Id: <98b1ebe5189953527f93fa06bbdfa1bc1aaa0dff.1508257445.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 17 Oct 2017 16:32:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 07/10] qemu-iotests: run python tests in own subdirectories X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This adds the framework to iotests.py to run python iotests in a subdirectory structure, structured like so: scratch/ =E2=94=9C=E2=94=80=E2=94=80 TestNumber =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 TestClassName =E2=94=82=C2=A0=C2=A0 =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 tes= t_method_name Prior to this patch, tests were run in a test subdirectory from previous patches in the series, like this: scratch/ =E2=94=9C=E2=94=80=E2=94=80 TestNumber However, given the nature of python's unittest framework, additional subdirectories are needed, if we want to insure that we can save intermediate files in case of test failures (as we will do in a subsequent patch) without running the risk of tainting other test methods from the test file. In python tests using iiotests.QMPTestCase, any reference to 'iotests.test_dir' should be replaced by 'self.workdir'. This may also require changing the scope of path name variables. Suggested-by: Stefan Hajnoczi Signed-off-by: Jeff Cody --- tests/qemu-iotests/iotests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 6f05790..7ff400a 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -262,6 +262,17 @@ index_re =3D re.compile(r'([^\[]+)\[([^\]]+)\]') class QMPTestCase(unittest.TestCase): '''Abstract base class for QMP test cases''' =20 + def __init__(self, *args): + super(QMPTestCase, self).__init__(*args) + self.workdir =3D os.path.join(test_dir, self.__class__.__name__, + self._testMethodName) + try: + os.makedirs(self.workdir) + except OSError, error: + if error.errno !=3D errno.EEXIST: + raise + os.chdir(self.workdir) + def dictpath(self, d, path): '''Traverse a path in a nested dict''' for component in path.split('/'): --=20 2.9.5 From nobody Thu May 2 20:15:54 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508258461889124.63581255219503; Tue, 17 Oct 2017 09:41:01 -0700 (PDT) Received: from localhost ([::1]:40492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Uv7-0004lM-Kq for importer@patchew.org; Tue, 17 Oct 2017 12:40:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Unx-0007Z0-BA for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:33:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4Unl-0007Em-7O for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:33:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4UnG-0006aa-63; Tue, 17 Oct 2017 12:32:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A60E33A188; Tue, 17 Oct 2017 16:32:37 +0000 (UTC) Received: from localhost (ovpn-117-62.phx2.redhat.com [10.3.117.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF1E05D9C8; Tue, 17 Oct 2017 16:32:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3A60E33A188 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jcody@redhat.com From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 12:31:53 -0400 Message-Id: <4a332a99c2dd670f119bd1f0b8e6ff98f4ff9193.1508257445.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 17 Oct 2017 16:32:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 08/10] qemu-iotests: modify python tests to run from subdir X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Also removes any intermediate file deletion; this is no longer needed, as 'check' will take care of that once the test is completed (unless the user requests to save files on failure, and the test fails) Signed-off-by: Jeff Cody --- tests/qemu-iotests/030 | 82 ++++++------ tests/qemu-iotests/040 | 128 +++++++++---------- tests/qemu-iotests/041 | 333 +++++++++++++++++++++++++--------------------= ---- tests/qemu-iotests/044 | 11 +- tests/qemu-iotests/045 | 42 +++---- tests/qemu-iotests/055 | 97 +++++++------- tests/qemu-iotests/056 | 39 +++--- tests/qemu-iotests/057 | 4 +- tests/qemu-iotests/065 | 13 +- tests/qemu-iotests/096 | 8 +- tests/qemu-iotests/118 | 200 ++++++++++++++--------------- tests/qemu-iotests/124 | 24 ++-- tests/qemu-iotests/129 | 6 +- tests/qemu-iotests/132 | 19 ++- tests/qemu-iotests/136 | 7 +- tests/qemu-iotests/139 | 33 +++-- tests/qemu-iotests/147 | 41 +++--- tests/qemu-iotests/148 | 33 +++-- tests/qemu-iotests/152 | 21 ++-- tests/qemu-iotests/155 | 54 ++++---- tests/qemu-iotests/163 | 42 +++---- tests/qemu-iotests/165 | 11 +- 22 files changed, 581 insertions(+), 667 deletions(-) diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030 index 1883894..6e52509 100755 --- a/tests/qemu-iotests/030 +++ b/tests/qemu-iotests/030 @@ -23,27 +23,24 @@ import os import iotests from iotests import qemu_img, qemu_io =20 -backing_img =3D os.path.join(iotests.test_dir, 'backing.img') -mid_img =3D os.path.join(iotests.test_dir, 'mid.img') -test_img =3D os.path.join(iotests.test_dir, 'test.img') =20 class TestSingleDrive(iotests.QMPTestCase): image_len =3D 1 * 1024 * 1024 # MB =20 def setUp(self): - iotests.create_image(backing_img, TestSingleDrive.image_len) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, mid_img) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % mid_img, test_img) - qemu_io('-f', 'raw', '-c', 'write -P 0x1 0 512', backing_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0x1 524288 512', mid= _img) - self.vm =3D iotests.VM().add_drive("blkdebug::" + test_img, "backi= ng.node-name=3Dmid") + self.backing_img =3D os.path.join(self.workdir, 'backing.img') + self.mid_img =3D os.path.join(self.workdir, 'mid.img') + self.test_img =3D os.path.join(self.workdir, 'test.img') + iotests.create_image(self.backing_img, TestSingleDrive.image_len) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.backing_img, self.mid_img) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.mid_img, self.test_img) + qemu_io('-f', 'raw', '-c', 'write -P 0x1 0 512', self.backing_img) + qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0x1 524288 512', sel= f.mid_img) + self.vm =3D iotests.VM().add_drive("blkdebug::" + self.test_img, "= backing.node-name=3Dmid") self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(mid_img) - os.remove(backing_img) =20 def test_stream(self): self.assert_no_active_block_jobs() @@ -56,15 +53,15 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_no_active_block_jobs() self.vm.shutdown() =20 - self.assertEqual(qemu_io('-f', 'raw', '-c', 'map', backing_img), - qemu_io('-f', iotests.imgfmt, '-c', 'map', test_i= mg), + self.assertEqual(qemu_io('-f', 'raw', '-c', 'map', self.backing_im= g), + qemu_io('-f', iotests.imgfmt, '-c', 'map', self.t= est_img), 'image file map does not match backing file after= streaming') =20 def test_stream_intermediate(self): self.assert_no_active_block_jobs() =20 - self.assertNotEqual(qemu_io('-f', 'raw', '-rU', '-c', 'map', backi= ng_img), - qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'ma= p', mid_img), + self.assertNotEqual(qemu_io('-f', 'raw', '-rU', '-c', 'map', self.= backing_img), + qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'ma= p', self.mid_img), 'image file map matches backing file before st= reaming') =20 result =3D self.vm.qmp('block-stream', device=3D'mid', job_id=3D's= tream-mid') @@ -75,8 +72,8 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_no_active_block_jobs() self.vm.shutdown() =20 - self.assertEqual(qemu_io('-f', 'raw', '-c', 'map', backing_img), - qemu_io('-f', iotests.imgfmt, '-c', 'map', mid_im= g), + self.assertEqual(qemu_io('-f', 'raw', '-c', 'map', self.backing_im= g), + qemu_io('-f', iotests.imgfmt, '-c', 'map', self.m= id_img), 'image file map does not match backing file after= streaming') =20 def test_stream_pause(self): @@ -107,18 +104,18 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_no_active_block_jobs() self.vm.shutdown() =20 - self.assertEqual(qemu_io('-f', 'raw', '-c', 'map', backing_img), - qemu_io('-f', iotests.imgfmt, '-c', 'map', test_i= mg), + self.assertEqual(qemu_io('-f', 'raw', '-c', 'map', self.backing_im= g), + qemu_io('-f', iotests.imgfmt, '-c', 'map', self.t= est_img), 'image file map does not match backing file after= streaming') =20 def test_stream_no_op(self): self.assert_no_active_block_jobs() =20 # The image map is empty before the operation - empty_map =3D qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', te= st_img) + empty_map =3D qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', se= lf.test_img) =20 # This is a no-op: no data should ever be copied from the base ima= ge - result =3D self.vm.qmp('block-stream', device=3D'drive0', base=3Dm= id_img) + result =3D self.vm.qmp('block-stream', device=3D'drive0', base=3Ds= elf.mid_img) self.assert_qmp(result, 'return', {}) =20 self.wait_until_completed() @@ -126,13 +123,13 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_no_active_block_jobs() self.vm.shutdown() =20 - self.assertEqual(qemu_io('-f', iotests.imgfmt, '-c', 'map', test_i= mg), + self.assertEqual(qemu_io('-f', iotests.imgfmt, '-c', 'map', self.t= est_img), empty_map, 'image file map changed after a no-op') =20 def test_stream_partial(self): self.assert_no_active_block_jobs() =20 - result =3D self.vm.qmp('block-stream', device=3D'drive0', base=3Db= acking_img) + result =3D self.vm.qmp('block-stream', device=3D'drive0', base=3Ds= elf.backing_img) self.assert_qmp(result, 'return', {}) =20 self.wait_until_completed() @@ -140,8 +137,8 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_no_active_block_jobs() self.vm.shutdown() =20 - self.assertEqual(qemu_io('-f', iotests.imgfmt, '-c', 'map', mid_im= g), - qemu_io('-f', iotests.imgfmt, '-c', 'map', test_i= mg), + self.assertEqual(qemu_io('-f', iotests.imgfmt, '-c', 'map', self.m= id_img), + qemu_io('-f', iotests.imgfmt, '-c', 'map', self.t= est_img), 'image file map does not match backing file after= streaming') =20 def test_device_not_found(self): @@ -157,7 +154,6 @@ class TestParallelOps(iotests.QMPTestCase): num_ops =3D 4 # Number of parallel block-stream operations num_imgs =3D num_ops * 2 + 1 image_len =3D num_ops * 1024 * 1024 - imgs =3D [] =20 def setUp(self): opts =3D [] @@ -167,7 +163,7 @@ class TestParallelOps(iotests.QMPTestCase): for i in range(self.num_imgs): img_depth =3D self.num_imgs - i - 1 opts.append("backing." * img_depth + "node-name=3Dnode%d" % i) - self.imgs.append(os.path.join(iotests.test_dir, 'img-%d.img' %= i)) + self.imgs.append(os.path.join(self.workdir, 'img-%d.img' % i)) =20 # Create all images iotests.create_image(self.imgs[0], self.image_len) @@ -192,8 +188,6 @@ class TestParallelOps(iotests.QMPTestCase): =20 def tearDown(self): self.vm.shutdown() - for img in self.imgs: - os.remove(img) =20 # Test that it's possible to run several block-stream operations # in parallel in the same snapshot chain @@ -395,8 +389,8 @@ class TestQuorum(iotests.QMPTestCase): =20 # Initialize file names and command-line options for i in range(self.num_children): - child_img =3D os.path.join(iotests.test_dir, 'img-%d.img' % i) - backing_img =3D os.path.join(iotests.test_dir, 'backing-%d.img= ' % i) + child_img =3D os.path.join(self.workdir, 'img-%d.img' % i) + backing_img =3D os.path.join(self.workdir, 'backing-%d.img' % = i) self.children.append(child_img) self.backing.append(backing_img) qemu_img('create', '-f', iotests.imgfmt, backing_img, '1M') @@ -414,10 +408,6 @@ class TestQuorum(iotests.QMPTestCase): =20 def tearDown(self): self.vm.shutdown() - for img in self.children: - os.remove(img) - for img in self.backing: - os.remove(img) =20 def test_stream_quorum(self): if not iotests.supports_quorum(): @@ -446,6 +436,8 @@ class TestSmallerBackingFile(iotests.QMPTestCase): image_len =3D 2 * backing_len =20 def setUp(self): + backing_img =3D os.path.join(self.workdir, 'backing.img') + test_img =3D os.path.join(self.workdir, 'test.img') iotests.create_image(backing_img, self.backing_len) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, test_img, str(self.image_len)) self.vm =3D iotests.VM().add_drive(test_img) @@ -495,6 +487,8 @@ new_state =3D "1" =20 class TestEIO(TestErrors): def setUp(self): + backing_img =3D os.path.join(self.workdir, 'backing.img') + test_img =3D os.path.join(self.workdir, 'test.img') self.blkdebug_file =3D backing_img + ".blkdebug" iotests.create_image(backing_img, TestErrors.image_len) self.create_blkdebug_file(self.blkdebug_file, "read_aio", 5) @@ -507,9 +501,6 @@ class TestEIO(TestErrors): =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(backing_img) - os.remove(self.blkdebug_file) =20 def test_report(self): self.assert_no_active_block_jobs() @@ -637,6 +628,8 @@ class TestEIO(TestErrors): =20 class TestENOSPC(TestErrors): def setUp(self): + backing_img =3D os.path.join(self.workdir, 'backing.img') + test_img =3D os.path.join(self.workdir, 'test.img') self.blkdebug_file =3D backing_img + ".blkdebug" iotests.create_image(backing_img, TestErrors.image_len) self.create_blkdebug_file(self.blkdebug_file, "read_aio", 28) @@ -649,9 +642,6 @@ class TestENOSPC(TestErrors): =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(backing_img) - os.remove(self.blkdebug_file) =20 def test_enospc(self): self.assert_no_active_block_jobs() @@ -695,6 +685,8 @@ class TestStreamStop(iotests.QMPTestCase): image_len =3D 8 * 1024 * 1024 * 1024 # GB =20 def setUp(self): + backing_img =3D os.path.join(self.workdir, 'backing.img') + test_img =3D os.path.join(self.workdir, 'test.img') qemu_img('create', backing_img, str(TestStreamStop.image_len)) qemu_io('-f', 'raw', '-c', 'write -P 0x1 0 32M', backing_img) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, test_img) @@ -704,8 +696,6 @@ class TestStreamStop(iotests.QMPTestCase): =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(backing_img) =20 def test_stream_stop(self): self.assert_no_active_block_jobs() @@ -724,6 +714,8 @@ class TestSetSpeed(iotests.QMPTestCase): image_len =3D 80 * 1024 * 1024 # MB =20 def setUp(self): + backing_img =3D os.path.join(self.workdir, 'backing.img') + test_img =3D os.path.join(self.workdir, 'test.img') qemu_img('create', backing_img, str(TestSetSpeed.image_len)) qemu_io('-f', 'raw', '-c', 'write -P 0x1 0 32M', backing_img) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, test_img) @@ -733,8 +725,6 @@ class TestSetSpeed(iotests.QMPTestCase): =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(backing_img) =20 # This is a short performance test which is not run by default. # Invoke "IMGFMT=3Dqed ./030 TestSetSpeed.perf_test_throughput" diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index c284d08..c4ba9bb 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -28,9 +28,6 @@ from iotests import qemu_img, qemu_io import struct import errno =20 -backing_img =3D os.path.join(iotests.test_dir, 'backing.img') -mid_img =3D os.path.join(iotests.test_dir, 'mid.img') -test_img =3D os.path.join(iotests.test_dir, 'test.img') =20 class ImageCommitTestCase(iotests.QMPTestCase): '''Abstract base class for image commit test cases''' @@ -76,12 +73,15 @@ class TestSingleDrive(ImageCommitTestCase): test_len =3D 1 * 1024 * 256 =20 def setUp(self): - iotests.create_image(backing_img, self.image_len) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, mid_img) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % mid_img, test_img) - qemu_io('-f', 'raw', '-c', 'write -P 0xab 0 524288', backing_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288',= mid_img) - self.vm =3D iotests.VM().add_drive(test_img, "node-name=3Dtop,back= ing.node-name=3Dmid,backing.backing.node-name=3Dbase", interface=3D"none") + self.backing_img =3D os.path.join(self.workdir, 'backing.img') + self.mid_img =3D os.path.join(self.workdir, 'mid.img') + self.test_img =3D os.path.join(self.workdir, 'test.img') + iotests.create_image(self.backing_img, self.image_len) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.backing_img, self.mid_img) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.mid_img, self.test_img) + qemu_io('-f', 'raw', '-c', 'write -P 0xab 0 524288', self.backing_= img) + qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288',= self.mid_img) + self.vm =3D iotests.VM().add_drive(self.test_img, "node-name=3Dtop= ,backing.node-name=3Dmid,backing.backing.node-name=3Dbase", interface=3D"no= ne") if iotests.qemu_default_machine =3D=3D 's390-ccw-virtio': self.vm.add_device("virtio-scsi-ccw") else: @@ -92,52 +92,49 @@ class TestSingleDrive(ImageCommitTestCase): =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(mid_img) - os.remove(backing_img) =20 def test_commit(self): - self.run_commit_test(mid_img, backing_img) - self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xab 0 52= 4288', backing_img).find("verification failed")) - self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xef 5242= 88 524288', backing_img).find("verification failed")) + self.run_commit_test(self.mid_img, self.backing_img) + self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xab 0 52= 4288', self.backing_img).find("verification failed")) + self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xef 5242= 88 524288', self.backing_img).find("verification failed")) =20 def test_device_not_found(self): - result =3D self.vm.qmp('block-commit', device=3D'nonexistent', top= =3D'%s' % mid_img) + result =3D self.vm.qmp('block-commit', device=3D'nonexistent', top= =3D'%s' % self.mid_img) self.assert_qmp(result, 'error/class', 'DeviceNotFound') =20 def test_top_same_base(self): self.assert_no_active_block_jobs() - result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3D'%= s' % backing_img, base=3D'%s' % backing_img) + result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3D'%= s' % self.backing_img, base=3D'%s' % self.backing_img) self.assert_qmp(result, 'error/class', 'GenericError') - self.assert_qmp(result, 'error/desc', 'Base \'%s\' not found' % ba= cking_img) + self.assert_qmp(result, 'error/desc', 'Base \'%s\' not found' % se= lf.backing_img) =20 def test_top_invalid(self): self.assert_no_active_block_jobs() - result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3D'b= adfile', base=3D'%s' % backing_img) + result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3D'b= adfile', base=3D'%s' % self.backing_img) self.assert_qmp(result, 'error/class', 'GenericError') self.assert_qmp(result, 'error/desc', 'Top image file badfile not = found') =20 def test_base_invalid(self): self.assert_no_active_block_jobs() - result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3D'%= s' % mid_img, base=3D'badfile') + result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3D'%= s' % self.mid_img, base=3D'badfile') self.assert_qmp(result, 'error/class', 'GenericError') self.assert_qmp(result, 'error/desc', 'Base \'badfile\' not found') =20 def test_top_is_active(self): - self.run_commit_test(test_img, backing_img, need_ready=3DTrue) - self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xab 0 52= 4288', backing_img).find("verification failed")) - self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xef 5242= 88 524288', backing_img).find("verification failed")) + self.run_commit_test(self.test_img, self.backing_img, need_ready= =3DTrue) + self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xab 0 52= 4288', self.backing_img).find("verification failed")) + self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xef 5242= 88 524288', self.backing_img).find("verification failed")) =20 def test_top_is_default_active(self): self.run_default_commit_test() - self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xab 0 52= 4288', backing_img).find("verification failed")) - self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xef 5242= 88 524288', backing_img).find("verification failed")) + self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xab 0 52= 4288', self.backing_img).find("verification failed")) + self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xef 5242= 88 524288', self.backing_img).find("verification failed")) =20 def test_top_and_base_reversed(self): self.assert_no_active_block_jobs() - result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3D'%= s' % backing_img, base=3D'%s' % mid_img) + result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3D'%= s' % self.backing_img, base=3D'%s' % self.mid_img) self.assert_qmp(result, 'error/class', 'GenericError') - self.assert_qmp(result, 'error/desc', 'Base \'%s\' not found' % mi= d_img) + self.assert_qmp(result, 'error/desc', 'Base \'%s\' not found' % se= lf.mid_img) =20 # When the job is running on a BB that is automatically deleted on hot # unplug, the job is cancelled when the device disappears @@ -146,8 +143,8 @@ class TestSingleDrive(ImageCommitTestCase): return =20 self.assert_no_active_block_jobs() - result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3Dmi= d_img, - base=3Dbacking_img, speed=3D(self.image_len /= 4)) + result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3Dse= lf.mid_img, + base=3Dself.backing_img, speed=3D(self.image_= len / 4)) self.assert_qmp(result, 'return', {}) result =3D self.vm.qmp('device_del', id=3D'scsi0') self.assert_qmp(result, 'return', {}) @@ -174,18 +171,18 @@ class TestSingleDrive(ImageCommitTestCase): return =20 self.assert_no_active_block_jobs() - result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3Dmi= d_img, - base=3Dbacking_img, speed=3D(self.image_len /= 4)) + result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3Dse= lf.mid_img, + base=3Dself.backing_img, speed=3D(self.image_= len / 4)) self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', test_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.test_img) self.assert_qmp(result, 'return[0]/inserted/drv', iotests.imgfmt) - self.assert_qmp(result, 'return[0]/inserted/backing_file', mid_img) + self.assert_qmp(result, 'return[0]/inserted/backing_file', self.mi= d_img) self.assert_qmp(result, 'return[0]/inserted/backing_file_depth', 2) - self.assert_qmp(result, 'return[0]/inserted/image/filename', test_= img) - self.assert_qmp(result, 'return[0]/inserted/image/backing-image/fi= lename', mid_img) - self.assert_qmp(result, 'return[0]/inserted/image/backing-image/ba= cking-image/filename', backing_img) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= test_img) + self.assert_qmp(result, 'return[0]/inserted/image/backing-image/fi= lename', self.mid_img) + self.assert_qmp(result, 'return[0]/inserted/image/backing-image/ba= cking-image/filename', self.backing_img) =20 result =3D self.vm.qmp('query-blockstats') self.assert_qmp(result, 'return[0]/node-name', 'top') @@ -202,19 +199,24 @@ class TestRelativePaths(ImageCommitTestCase): dir1 =3D "dir1" dir2 =3D "dir2/" dir3 =3D "dir2/dir3/" + backing_img =3D "" + mid_img =3D "" + test_img =3D "" + backing_img_abs =3D "" + mid_img_abs =3D "" =20 - test_img =3D os.path.join(iotests.test_dir, dir3, 'test.img') mid_img =3D "../mid.img" backing_img =3D "../dir1/backing.img" =20 - backing_img_abs =3D os.path.join(iotests.test_dir, dir1, 'backing.img') - mid_img_abs =3D os.path.join(iotests.test_dir, dir2, 'mid.img') =20 def setUp(self): + self.test_img =3D os.path.join(self.workdir, self.dir3, 'test.img') + self.backing_img_abs =3D os.path.join(self.workdir, self.dir1, 'ba= cking.img') + self.mid_img_abs =3D os.path.join(self.workdir, self.dir2, 'mid.im= g') try: - os.mkdir(os.path.join(iotests.test_dir, self.dir1)) - os.mkdir(os.path.join(iotests.test_dir, self.dir2)) - os.mkdir(os.path.join(iotests.test_dir, self.dir3)) + os.mkdir(os.path.join(self.workdir, self.dir1)) + os.mkdir(os.path.join(self.workdir, self.dir2)) + os.mkdir(os.path.join(self.workdir, self.dir3)) except OSError as exception: if exception.errno !=3D errno.EEXIST: raise @@ -230,16 +232,6 @@ class TestRelativePaths(ImageCommitTestCase): =20 def tearDown(self): self.vm.shutdown() - os.remove(self.test_img) - os.remove(self.mid_img_abs) - os.remove(self.backing_img_abs) - try: - os.rmdir(os.path.join(iotests.test_dir, self.dir1)) - os.rmdir(os.path.join(iotests.test_dir, self.dir3)) - os.rmdir(os.path.join(iotests.test_dir, self.dir2)) - except OSError as exception: - if exception.errno !=3D errno.EEXIST and exception.errno !=3D = errno.ENOTEMPTY: - raise =20 def test_commit(self): self.run_commit_test(self.mid_img, self.backing_img) @@ -284,25 +276,25 @@ class TestSetSpeed(ImageCommitTestCase): image_len =3D 80 * 1024 * 1024 # MB =20 def setUp(self): - qemu_img('create', backing_img, str(TestSetSpeed.image_len)) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, mid_img) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % mid_img, test_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0x1 0 512', test_img) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288',= mid_img) - self.vm =3D iotests.VM().add_drive(test_img) + self.backing_img =3D os.path.join(self.workdir, 'backing.img') + self.mid_img =3D os.path.join(self.workdir, 'mid.img') + self.test_img =3D os.path.join(self.workdir, 'test.img') + qemu_img('create', self.backing_img, str(TestSetSpeed.image_len)) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.backing_img, self.mid_img) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.mid_img, self.test_img) + qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0x1 0 512', self.tes= t_img) + qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288',= self.mid_img) + self.vm =3D iotests.VM().add_drive(self.test_img) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(mid_img) - os.remove(backing_img) =20 def test_set_speed(self): self.assert_no_active_block_jobs() =20 self.vm.pause_drive('drive0') - result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3Dmi= d_img, speed=3D1024 * 1024) + result =3D self.vm.qmp('block-commit', device=3D'drive0', top=3Dse= lf.mid_img, speed=3D1024 * 1024) self.assert_qmp(result, 'return', {}) =20 # Ensure the speed we set was accepted @@ -317,12 +309,12 @@ class TestActiveZeroLengthImage(TestSingleDrive): =20 class TestReopenOverlay(ImageCommitTestCase): image_len =3D 1024 * 1024 - img0 =3D os.path.join(iotests.test_dir, '0.img') - img1 =3D os.path.join(iotests.test_dir, '1.img') - img2 =3D os.path.join(iotests.test_dir, '2.img') - img3 =3D os.path.join(iotests.test_dir, '3.img') =20 def setUp(self): + self.img0 =3D os.path.join(self.workdir, '0.img') + self.img1 =3D os.path.join(self.workdir, '1.img') + self.img2 =3D os.path.join(self.workdir, '2.img') + self.img3 =3D os.path.join(self.workdir, '3.img') iotests.create_image(self.img0, self.image_len) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.img0, self.img1) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.img1, self.img2) @@ -333,10 +325,6 @@ class TestReopenOverlay(ImageCommitTestCase): =20 def tearDown(self): self.vm.shutdown() - os.remove(self.img0) - os.remove(self.img1) - os.remove(self.img2) - os.remove(self.img3) =20 # This tests what happens when the overlay image of the 'top' node # needs to be reopened in read-write mode in order to update the diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index a860a31..3b73f11 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -23,38 +23,26 @@ import os import iotests from iotests import qemu_img, qemu_io =20 -backing_img =3D os.path.join(iotests.test_dir, 'backing.img') -target_backing_img =3D os.path.join(iotests.test_dir, 'target-backing.img') -test_img =3D os.path.join(iotests.test_dir, 'test.img') -target_img =3D os.path.join(iotests.test_dir, 'target.img') - -quorum_img1 =3D os.path.join(iotests.test_dir, 'quorum1.img') -quorum_img2 =3D os.path.join(iotests.test_dir, 'quorum2.img') -quorum_img3 =3D os.path.join(iotests.test_dir, 'quorum3.img') -quorum_repair_img =3D os.path.join(iotests.test_dir, 'quorum_repair.img') -quorum_snapshot_file =3D os.path.join(iotests.test_dir, 'quorum_snapshot.i= mg') =20 class TestSingleDrive(iotests.QMPTestCase): image_len =3D 1 * 1024 * 1024 # MB qmp_cmd =3D 'drive-mirror' - qmp_target =3D target_img =20 def setUp(self): - iotests.create_image(backing_img, self.image_len) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, test_img) - self.vm =3D iotests.VM().add_drive(test_img, "node-name=3Dtop,back= ing.node-name=3Dbase") + self.backing_img =3D os.path.join(self.workdir, 'backing.img') + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') + self.qmp_target =3D self.target_img + iotests.create_image(self.backing_img, self.image_len) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.backing_img, self.test_img) + self.vm =3D iotests.VM().add_drive(self.test_img, "node-name=3Dtop= ,backing.node-name=3Dbase") if iotests.qemu_default_machine =3D=3D 'pc': self.vm.add_drive(None, 'media=3Dcdrom', 'ide') self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(backing_img) - try: - os.remove(target_img) - except OSError: - pass + pass =20 def test_complete(self): self.assert_no_active_block_jobs() @@ -65,9 +53,9 @@ class TestSingleDrive(iotests.QMPTestCase): =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', target_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.target_img) self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 def test_cancel(self): @@ -79,7 +67,7 @@ class TestSingleDrive(iotests.QMPTestCase): =20 self.cancel_and_wait(force=3DTrue) result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', test_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.test_img) self.vm.shutdown() =20 def test_cancel_after_ready(self): @@ -91,9 +79,9 @@ class TestSingleDrive(iotests.QMPTestCase): =20 self.wait_ready_and_cancel() result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', test_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.test_img) self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 def test_pause(self): @@ -117,7 +105,7 @@ class TestSingleDrive(iotests.QMPTestCase): =20 self.complete_and_wait() self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 def test_small_buffer(self): @@ -130,41 +118,41 @@ class TestSingleDrive(iotests.QMPTestCase): =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', target_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.target_img) self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 def test_small_buffer2(self): self.assert_no_active_block_jobs() =20 qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=3D%d,= size=3D%d' - % (self.image_len, self.image_len), target_img) + % (self.image_len, self.image_len), self.target_im= g) result =3D self.vm.qmp(self.qmp_cmd, device=3D'drive0', sync=3D'fu= ll', buf_size=3D65536, mode=3D'existing', target= =3Dself.qmp_target) self.assert_qmp(result, 'return', {}) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', target_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.target_img) self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 def test_large_cluster(self): self.assert_no_active_block_jobs() =20 qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=3D%d,= backing_file=3D%s' - % (self.image_len, backing_img), target_img) + % (self.image_len, self.backing_img), self.target_= img) result =3D self.vm.qmp(self.qmp_cmd, device=3D'drive0', sync=3D'fu= ll', mode=3D'existing', target=3Dself.qmp_target) self.assert_qmp(result, 'return', {}) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', target_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.target_img) self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 # Tests that the insertion of the mirror_top filter node doesn't make a @@ -177,12 +165,12 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', test_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.test_img) self.assert_qmp(result, 'return[0]/inserted/drv', iotests.imgfmt) - self.assert_qmp(result, 'return[0]/inserted/backing_file', backing= _img) + self.assert_qmp(result, 'return[0]/inserted/backing_file', self.ba= cking_img) self.assert_qmp(result, 'return[0]/inserted/backing_file_depth', 1) - self.assert_qmp(result, 'return[0]/inserted/image/filename', test_= img) - self.assert_qmp(result, 'return[0]/inserted/image/backing-image/fi= lename', backing_img) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= test_img) + self.assert_qmp(result, 'return[0]/inserted/image/backing-image/fi= lename', self.backing_img) =20 result =3D self.vm.qmp('query-blockstats') self.assert_qmp(result, 'return[0]/node-name', 'top') @@ -190,12 +178,12 @@ class TestSingleDrive(iotests.QMPTestCase): =20 self.cancel_and_wait(force=3DTrue) result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', test_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.test_img) self.assert_qmp(result, 'return[0]/inserted/drv', iotests.imgfmt) - self.assert_qmp(result, 'return[0]/inserted/backing_file', backing= _img) + self.assert_qmp(result, 'return[0]/inserted/backing_file', self.ba= cking_img) self.assert_qmp(result, 'return[0]/inserted/backing_file_depth', 1) - self.assert_qmp(result, 'return[0]/inserted/image/filename', test_= img) - self.assert_qmp(result, 'return[0]/inserted/image/backing-image/fi= lename', backing_img) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= test_img) + self.assert_qmp(result, 'return[0]/inserted/image/backing-image/fi= lename', self.backing_img) =20 result =3D self.vm.qmp('query-blockstats') self.assert_qmp(result, 'return[0]/node-name', 'top') @@ -223,14 +211,14 @@ class TestSingleDrive(iotests.QMPTestCase): =20 class TestSingleBlockdev(TestSingleDrive): qmp_cmd =3D 'blockdev-mirror' - qmp_target =3D 'node1' =20 def setUp(self): TestSingleDrive.setUp(self) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, target_img) + self.qmp_target =3D 'node1' + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.backing_img, self.target_img) args =3D {'driver': iotests.imgfmt, 'node-name': self.qmp_target, - 'file': { 'filename': target_img, 'driver': 'file' } } + 'file': { 'filename': self.target_img, 'driver': 'file' } } result =3D self.vm.qmp("blockdev-add", **args) self.assert_qmp(result, 'return', {}) =20 @@ -256,51 +244,52 @@ class TestSingleBlockdevUnalignedLength(TestSingleBlo= ckdev): =20 class TestMirrorNoBacking(iotests.QMPTestCase): image_len =3D 2 * 1024 * 1024 # MB + target_backing_img =3D "" + backing_img =3D "" + test_img =3D "" + target_img =3D "" =20 def setUp(self): - iotests.create_image(backing_img, TestMirrorNoBacking.image_len) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, test_img) - self.vm =3D iotests.VM().add_drive(test_img) + self.target_backing_img =3D os.path.join(self.workdir, 'target-bac= king.img') + self.backing_img =3D os.path.join(self.workdir, 'backing.img') + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') + iotests.create_image(self.backing_img, TestMirrorNoBacking.image_l= en) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.backing_img, self.test_img) + self.vm =3D iotests.VM().add_drive(self.test_img) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(backing_img) - try: - os.remove(target_backing_img) - except: - pass - os.remove(target_img) =20 def test_complete(self): self.assert_no_active_block_jobs() =20 - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, target_img) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.backing_img, self.target_img) result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dtarget_img) + mode=3D'existing', target=3Dself.target_img) self.assert_qmp(result, 'return', {}) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', target_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.target_img) self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 def test_cancel(self): self.assert_no_active_block_jobs() =20 - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, target_img) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.backing_img, self.target_img) result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dtarget_img) + mode=3D'existing', target=3Dself.target_img) self.assert_qmp(result, 'return', {}) =20 self.wait_ready_and_cancel() result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', test_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.test_img) self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 def test_large_cluster(self): @@ -308,67 +297,67 @@ class TestMirrorNoBacking(iotests.QMPTestCase): =20 # qemu-img create fails if the image is not there qemu_img('create', '-f', iotests.imgfmt, '-o', 'size=3D%d' - %(TestMirrorNoBacking.image_len), target_backing_i= mg) + %(TestMirrorNoBacking.image_len), self.target_back= ing_img) qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=3D%d,= backing_file=3D%s' - % (TestMirrorNoBacking.image_len, target_backing_i= mg), target_img) + % (TestMirrorNoBacking.image_len, self.target_back= ing_img), self.target_img) =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dtarget_img) + mode=3D'existing', target=3Dself.target_img) self.assert_qmp(result, 'return', {}) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', target_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.target_img) self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 class TestMirrorResized(iotests.QMPTestCase): backing_len =3D 1 * 1024 * 1024 # MB image_len =3D 2 * 1024 * 1024 # MB + backing_img =3D '' + test_img =3D '' + target_img =3D '' =20 def setUp(self): - iotests.create_image(backing_img, TestMirrorResized.backing_len) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, test_img) - qemu_img('resize', test_img, '2M') - self.vm =3D iotests.VM().add_drive(test_img) + self.backing_img =3D os.path.join(self.workdir, 'backing.img') + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') + iotests.create_image(self.backing_img, TestMirrorResized.backing_l= en) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.backing_img, self.test_img) + qemu_img('resize', self.test_img, '2M') + self.vm =3D iotests.VM().add_drive(self.test_img) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(backing_img) - try: - os.remove(target_img) - except OSError: - pass =20 def test_complete_top(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= top', - target=3Dtarget_img) + target=3Dself.target_img) self.assert_qmp(result, 'return', {}) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', target_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.target_img) self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 def test_complete_full(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img) + target=3Dself.target_img) self.assert_qmp(result, 'return', {}) =20 self.complete_and_wait() result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/file', target_img) + self.assert_qmp(result, 'return[0]/inserted/file', self.target_img) self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 class TestReadErrors(iotests.QMPTestCase): @@ -377,6 +366,9 @@ class TestReadErrors(iotests.QMPTestCase): # this should be a multiple of twice the default granularity # so that we hit this offset first in state 1 MIRROR_GRANULARITY =3D 1024 * 1024 + backing_img =3D '' + test_img =3D '' + target_img =3D '' =20 def create_blkdebug_file(self, name, event, errno): file =3D open(name, 'w') @@ -402,31 +394,30 @@ new_state =3D "1" file.close() =20 def setUp(self): - self.blkdebug_file =3D backing_img + ".blkdebug" - iotests.create_image(backing_img, TestReadErrors.image_len) + self.backing_img =3D os.path.join(self.workdir, 'backing.img') + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') + self.blkdebug_file =3D self.backing_img + ".blkdebug" + iotests.create_image(self.backing_img, TestReadErrors.image_len) self.create_blkdebug_file(self.blkdebug_file, "read_aio", 5) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3Dblkdebug:%s:%s,backing_fmt=3Draw' - % (self.blkdebug_file, backing_img), - test_img) + % (self.blkdebug_file, self.backing_img), + self.test_img) # Write something for tests that use sync=3D'top' qemu_io('-c', 'write %d 512' % (self.MIRROR_GRANULARITY + 65536), - test_img) - self.vm =3D iotests.VM().add_drive(test_img) + self.test_img) + self.vm =3D iotests.VM().add_drive(self.test_img) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(target_img) - os.remove(backing_img) - os.remove(self.blkdebug_file) =20 def test_report_read(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img) + target=3Dself.target_img) self.assert_qmp(result, 'return', {}) =20 completed =3D False @@ -453,7 +444,7 @@ new_state =3D "1" self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img, on_source_error=3D'ignor= e') + target=3Dself.target_img, on_source_error=3D'= ignore') self.assert_qmp(result, 'return', {}) =20 event =3D self.vm.get_qmp_event(wait=3DTrue) @@ -471,10 +462,10 @@ new_state =3D "1" # Test COW into the target image. The first half of the # cluster at MIRROR_GRANULARITY has to be copied from # backing_img, even though sync=3D'top'. - qemu_img('create', '-f', iotests.imgfmt, '-ocluster_size=3D131072,= backing_file=3D%s' %(backing_img), target_img) + qemu_img('create', '-f', iotests.imgfmt, '-ocluster_size=3D131072,= backing_file=3D%s' %(self.backing_img), self.target_img) result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= top', on_source_error=3D'ignore', - mode=3D'existing', target=3Dtarget_img) + mode=3D'existing', target=3Dself.target_img) self.assert_qmp(result, 'return', {}) =20 event =3D self.vm.get_qmp_event(wait=3DTrue) @@ -487,15 +478,15 @@ new_state =3D "1" self.vm.shutdown() =20 # Detach blkdebug to compare images successfully - qemu_img('rebase', '-f', iotests.imgfmt, '-u', '-b', backing_img, = test_img) - self.assertTrue(iotests.compare_images(test_img, target_img), + qemu_img('rebase', '-f', iotests.imgfmt, '-u', '-b', self.backing_= img, self.test_img) + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 def test_stop_read(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img, on_source_error=3D'stop') + target=3Dself.target_img, on_source_error=3D'= stop') self.assert_qmp(result, 'return', {}) =20 error =3D False @@ -557,27 +548,26 @@ new_state =3D "1" file.close() =20 def setUp(self): - self.blkdebug_file =3D target_img + ".blkdebug" - iotests.create_image(backing_img, TestWriteErrors.image_len) + self.backing_img =3D os.path.join(self.workdir, 'backing.img') + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') + self.blkdebug_file =3D self.target_img + ".blkdebug" + iotests.create_image(self.backing_img, TestWriteErrors.image_len) self.create_blkdebug_file(self.blkdebug_file, "write_aio", 5) - qemu_img('create', '-f', iotests.imgfmt, '-obacking_file=3D%s' %(b= acking_img), test_img) - self.vm =3D iotests.VM().add_drive(test_img) - self.target_img =3D 'blkdebug:%s:%s' % (self.blkdebug_file, target= _img) - qemu_img('create', '-f', iotests.imgfmt, '-osize=3D%d' %(TestWrite= Errors.image_len), target_img) + qemu_img('create', '-f', iotests.imgfmt, '-obacking_file=3D%s' %(s= elf.backing_img), self.test_img) + self.vm =3D iotests.VM().add_drive(self.test_img) + self.blkdebug_target_img =3D 'blkdebug:%s:%s' % (self.blkdebug_fil= e, self.target_img) + qemu_img('create', '-f', iotests.imgfmt, '-osize=3D%d' %(TestWrite= Errors.image_len), self.target_img) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(target_img) - os.remove(backing_img) - os.remove(self.blkdebug_file) =20 def test_report_write(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dself.target_img) + mode=3D'existing', target=3Dself.blkdebug_tar= get_img) self.assert_qmp(result, 'return', {}) =20 completed =3D False @@ -604,7 +594,7 @@ new_state =3D "1" self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dself.target_img, + mode=3D'existing', target=3Dself.blkdebug_tar= get_img, on_target_error=3D'ignore') self.assert_qmp(result, 'return', {}) =20 @@ -621,7 +611,7 @@ new_state =3D "1" self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - mode=3D'existing', target=3Dself.target_img, + mode=3D'existing', target=3Dself.blkdebug_tar= get_img, on_target_error=3D'stop') self.assert_qmp(result, 'return', {}) =20 @@ -655,24 +645,27 @@ new_state =3D "1" =20 class TestSetSpeed(iotests.QMPTestCase): image_len =3D 80 * 1024 * 1024 # MB + backing_img =3D '' + test_img =3D '' + target_img =3D '' =20 def setUp(self): - qemu_img('create', backing_img, str(TestSetSpeed.image_len)) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, test_img) - self.vm =3D iotests.VM().add_drive(test_img) + self.backing_img =3D os.path.join(self.workdir, 'backing.img') + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') + qemu_img('create', self.backing_img, str(TestSetSpeed.image_len)) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.backing_img, self.test_img) + self.vm =3D iotests.VM().add_drive(self.test_img) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(backing_img) - os.remove(target_img) =20 def test_set_speed(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img) + target=3Dself.target_img) self.assert_qmp(result, 'return', {}) =20 # Default speed is 0 @@ -692,7 +685,7 @@ class TestSetSpeed(iotests.QMPTestCase): =20 # Check setting speed in drive-mirror works result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img, speed=3D4*1024*1024) + target=3Dself.target_img, speed=3D4*1024*1024) self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block-jobs') @@ -705,13 +698,13 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img, speed=3D-1) + target=3Dself.target_img, speed=3D-1) self.assert_qmp(result, 'error/class', 'GenericError') =20 self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img) + target=3Dself.target_img) self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('block-job-set-speed', device=3D'drive0', s= peed=3D-1) @@ -721,22 +714,24 @@ class TestSetSpeed(iotests.QMPTestCase): =20 class TestUnbackedSource(iotests.QMPTestCase): image_len =3D 2 * 1024 * 1024 # MB + test_img =3D '' + target_img =3D '' =20 def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, test_img, + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') + qemu_img('create', '-f', iotests.imgfmt, self.test_img, str(TestUnbackedSource.image_len)) - self.vm =3D iotests.VM().add_drive(test_img) + self.vm =3D iotests.VM().add_drive(self.test_img) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(target_img) =20 def test_absolute_paths_full(self): self.assert_no_active_block_jobs() result =3D self.vm.qmp('drive-mirror', device=3D'drive0', - sync=3D'full', target=3Dtarget_img, + sync=3D'full', target=3Dself.target_img, mode=3D'absolute-paths') self.assert_qmp(result, 'return', {}) self.complete_and_wait() @@ -745,7 +740,7 @@ class TestUnbackedSource(iotests.QMPTestCase): def test_absolute_paths_top(self): self.assert_no_active_block_jobs() result =3D self.vm.qmp('drive-mirror', device=3D'drive0', - sync=3D'top', target=3Dtarget_img, + sync=3D'top', target=3Dself.target_img, mode=3D'absolute-paths') self.assert_qmp(result, 'return', {}) self.complete_and_wait() @@ -754,7 +749,7 @@ class TestUnbackedSource(iotests.QMPTestCase): def test_absolute_paths_none(self): self.assert_no_active_block_jobs() result =3D self.vm.qmp('drive-mirror', device=3D'drive0', - sync=3D'none', target=3Dtarget_img, + sync=3D'none', target=3Dself.target_img, mode=3D'absolute-paths') self.assert_qmp(result, 'return', {}) self.complete_and_wait() @@ -762,26 +757,28 @@ class TestUnbackedSource(iotests.QMPTestCase): =20 class TestGranularity(iotests.QMPTestCase): image_len =3D 10 * 1024 * 1024 # MB + test_img =3D '' + target_img =3D '' =20 def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, test_img, + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') + qemu_img('create', '-f', iotests.imgfmt, self.test_img, str(TestGranularity.image_len)) qemu_io('-c', 'write 0 %d' % (self.image_len), - test_img) - self.vm =3D iotests.VM().add_drive(test_img) + self.test_img) + self.vm =3D iotests.VM().add_drive(self.test_img) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') - os.remove(test_img) - os.remove(target_img) =20 def test_granularity(self): self.assert_no_active_block_jobs() result =3D self.vm.qmp('drive-mirror', device=3D'drive0', - sync=3D'full', target=3Dtarget_img, + sync=3D'full', target=3Dself.target_img, mode=3D'absolute-paths', granularity=3D8192) self.assert_qmp(result, 'return', {}) event =3D self.vm.get_qmp_event(wait=3D60.0) @@ -794,9 +791,21 @@ class TestRepairQuorum(iotests.QMPTestCase): """ This class test quorum file repair using drive-mirror. It's mostly a fork of TestSingleDrive """ image_len =3D 1 * 1024 * 1024 # MB - IMAGES =3D [ quorum_img1, quorum_img2, quorum_img3 ] + quorum_img1 =3D '' + quorum_img2 =3D '' + quorum_img3 =3D '' + quroum_repair_img =3D '' + quorum_snapshot_file =3D '' + + IMAGES =3D [ ] =20 def setUp(self): + self.quorum_img1 =3D os.path.join(self.workdir, 'quorum1.img') + self.quorum_img2 =3D os.path.join(self.workdir, 'quorum2.img') + self.quorum_img3 =3D os.path.join(self.workdir, 'quorum3.img') + self.quorum_repair_img =3D os.path.join(self.workdir, 'quorum_repa= ir.img') + self.quorum_snapshot_file =3D os.path.join(self.workdir, 'quorum_s= napshot.img') + self.IMAGES =3D [ self.quorum_img1, self.quorum_img2, self.quorum_= img3 ] self.vm =3D iotests.VM() =20 if iotests.qemu_default_machine =3D=3D 'pc': @@ -823,12 +832,6 @@ class TestRepairQuorum(iotests.QMPTestCase): =20 def tearDown(self): self.vm.shutdown() - for i in self.IMAGES + [ quorum_repair_img, quorum_snapshot_file ]: - # Do a try/except because the test may have deleted some images - try: - os.remove(i) - except OSError: - pass =20 def test_complete(self): if not iotests.supports_quorum(): @@ -838,15 +841,15 @@ class TestRepairQuorum(iotests.QMPTestCase): =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', sync=3D'full', node_name=3D"repair0", replace= s=3D"img1", - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) + target=3Dself.quorum_repair_img, format=3Diot= ests.imgfmt) self.assert_qmp(result, 'return', {}) =20 self.complete_and_wait(drive=3D"job0") - self.assert_has_block_node("repair0", quorum_repair_img) + self.assert_has_block_node("repair0", self.quorum_repair_img) # TODO: a better test requiring some QEMU infrastructure will be a= dded # to check that this file is really driven by quorum self.vm.shutdown() - self.assertTrue(iotests.compare_images(quorum_img2, quorum_repair_= img), + self.assertTrue(iotests.compare_images(self.quorum_img2, self.quor= um_repair_img), 'target image does not match source after mirrorin= g') =20 def test_cancel(self): @@ -857,13 +860,13 @@ class TestRepairQuorum(iotests.QMPTestCase): =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', sync=3D'full', node_name=3D"repair0", replace= s=3D"img1", - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) + target=3Dself.quorum_repair_img, format=3Diot= ests.imgfmt) self.assert_qmp(result, 'return', {}) =20 self.cancel_and_wait(drive=3D"job0", force=3DTrue) # here we check that the last registered quorum file has not been # swapped out and unref - self.assert_has_block_node(None, quorum_img3) + self.assert_has_block_node(None, self.quorum_img3) self.vm.shutdown() =20 def test_cancel_after_ready(self): @@ -874,15 +877,15 @@ class TestRepairQuorum(iotests.QMPTestCase): =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', sync=3D'full', node_name=3D"repair0", replace= s=3D"img1", - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) + target=3Dself.quorum_repair_img, format=3Diot= ests.imgfmt) self.assert_qmp(result, 'return', {}) =20 self.wait_ready_and_cancel(drive=3D"job0") # here we check that the last registered quorum file has not been # swapped out and unref - self.assert_has_block_node(None, quorum_img3) + self.assert_has_block_node(None, self.quorum_img3) self.vm.shutdown() - self.assertTrue(iotests.compare_images(quorum_img2, quorum_repair_= img), + self.assertTrue(iotests.compare_images(self.quorum_img2, self.quor= um_repair_img), 'target image does not match source after mirrorin= g') =20 def test_pause(self): @@ -893,7 +896,7 @@ class TestRepairQuorum(iotests.QMPTestCase): =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', sync=3D'full', node_name=3D"repair0", replace= s=3D"img1", - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) + target=3Dself.quorum_repair_img, format=3Diot= ests.imgfmt) self.assert_qmp(result, 'return', {}) =20 self.pause_job('job0') @@ -910,7 +913,7 @@ class TestRepairQuorum(iotests.QMPTestCase): =20 self.complete_and_wait(drive=3D"job0") self.vm.shutdown() - self.assertTrue(iotests.compare_images(quorum_img2, quorum_repair_= img), + self.assertTrue(iotests.compare_images(self.quorum_img2, self.quor= um_repair_img), 'target image does not match source after mirrorin= g') =20 def test_medium_not_found(self): @@ -924,7 +927,7 @@ class TestRepairQuorum(iotests.QMPTestCase): sync=3D'full', node_name=3D'repair0', replaces=3D'img1', - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) + target=3Dself.quorum_repair_img, format=3Diot= ests.imgfmt) self.assert_qmp(result, 'error/class', 'GenericError') =20 def test_image_not_found(self): @@ -933,7 +936,7 @@ class TestRepairQuorum(iotests.QMPTestCase): =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', sync=3D'full', node_name=3D'repair0', replace= s=3D'img1', - mode=3D'existing', target=3Dquorum_repair_img, + mode=3D'existing', target=3Dself.quorum_repai= r_img, format=3Diotests.imgfmt) self.assert_qmp(result, 'error/class', 'GenericError') =20 @@ -945,7 +948,7 @@ class TestRepairQuorum(iotests.QMPTestCase): device=3D'nonexistent', sync=3D'full', node_name=3D'repair0', replaces=3D'img1', - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) + target=3Dself.quorum_repair_img, format=3Diot= ests.imgfmt) self.assert_qmp(result, 'error/class', 'GenericError') =20 def test_wrong_sync_mode(self): @@ -955,7 +958,7 @@ class TestRepairQuorum(iotests.QMPTestCase): result =3D self.vm.qmp('drive-mirror', device=3D'quorum0', job_id= =3D'job0', node_name=3D'repair0', replaces=3D'img1', - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) + target=3Dself.quorum_repair_img, format=3Diot= ests.imgfmt) self.assert_qmp(result, 'error/class', 'GenericError') =20 def test_no_node_name(self): @@ -964,7 +967,7 @@ class TestRepairQuorum(iotests.QMPTestCase): =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', sync=3D'full', replaces=3D'img1', - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) + target=3Dself.quorum_repair_img, format=3Diot= ests.imgfmt) self.assert_qmp(result, 'error/class', 'GenericError') =20 def test_nonexistent_replaces(self): @@ -973,7 +976,7 @@ class TestRepairQuorum(iotests.QMPTestCase): =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', sync=3D'full', node_name=3D'repair0', replace= s=3D'img77', - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) + target=3Dself.quorum_repair_img, format=3Diot= ests.imgfmt) self.assert_qmp(result, 'error/class', 'GenericError') =20 def test_after_a_quorum_snapshot(self): @@ -981,21 +984,21 @@ class TestRepairQuorum(iotests.QMPTestCase): return =20 result =3D self.vm.qmp('blockdev-snapshot-sync', node_name=3D'img1= ', - snapshot_file=3Dquorum_snapshot_file, + snapshot_file=3Dself.quorum_snapshot_file, snapshot_node_name=3D"snap1"); =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', sync=3D'full', node_name=3D'repair0', replace= s=3D"img1", - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) + target=3Dself.quorum_repair_img, format=3Diot= ests.imgfmt) self.assert_qmp(result, 'error/class', 'GenericError') =20 result =3D self.vm.qmp('drive-mirror', job_id=3D'job0', device=3D'= quorum0', sync=3D'full', node_name=3D'repair0', replace= s=3D"snap1", - target=3Dquorum_repair_img, format=3Diotests.= imgfmt) + target=3Dself.quorum_repair_img, format=3Diot= ests.imgfmt) self.assert_qmp(result, 'return', {}) =20 self.complete_and_wait('job0') - self.assert_has_block_node("repair0", quorum_repair_img) + self.assert_has_block_node("repair0", self.quorum_repair_img) # TODO: a better test requiring some QEMU infrastructure will be a= dded # to check that this file is really driven by quorum self.vm.shutdown() diff --git a/tests/qemu-iotests/044 b/tests/qemu-iotests/044 index 11ea0f4..c051250 100755 --- a/tests/qemu-iotests/044 +++ b/tests/qemu-iotests/044 @@ -27,7 +27,6 @@ from iotests import qemu_img, qemu_img_verbose, qemu_io import struct import subprocess =20 -test_img =3D os.path.join(iotests.test_dir, 'test.img') =20 class TestRefcountTableGrowth(iotests.QMPTestCase): '''Abstract base class for image mirroring test cases''' @@ -99,18 +98,18 @@ class TestRefcountTableGrowth(iotests.QMPTestCase): =20 =20 def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=3D512= ', test_img, '16G') - self.preallocate(test_img) + self.test_img =3D os.path.join(self.workdir, 'test.img') + qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=3D512= ', self.test_img, '16G') + self.preallocate(self.test_img) pass =20 =20 def tearDown(self): - os.remove(test_img) pass =20 def test_grow_refcount_table(self): - qemu_io('-c', 'write 3800M 1M', test_img) - qemu_img_verbose('check' , test_img) + qemu_io('-c', 'write 3800M 1M', self.test_img) + qemu_img_verbose('check' , self.test_img) pass =20 if __name__ =3D=3D '__main__': diff --git a/tests/qemu-iotests/045 b/tests/qemu-iotests/045 index 6be8fc4..3f025b9 100755 --- a/tests/qemu-iotests/045 +++ b/tests/qemu-iotests/045 @@ -22,26 +22,25 @@ import os import iotests from iotests import qemu_img =20 -image0 =3D os.path.join(iotests.test_dir, 'image0') -image1 =3D os.path.join(iotests.test_dir, 'image1') -image2 =3D os.path.join(iotests.test_dir, 'image2') -image3 =3D os.path.join(iotests.test_dir, 'image3') -image4 =3D os.path.join(iotests.test_dir, 'image4') - class TestFdSets(iotests.QMPTestCase): =20 def setUp(self): + self.image0 =3D os.path.join(self.workdir, 'image0') + self.image1 =3D os.path.join(self.workdir, 'image1') + self.image2 =3D os.path.join(self.workdir, 'image2') + self.image3 =3D os.path.join(self.workdir, 'image3') + self.image4 =3D os.path.join(self.workdir, 'image4') self.vm =3D iotests.VM() - qemu_img('create', '-f', iotests.imgfmt, image0, '128K') - qemu_img('create', '-f', iotests.imgfmt, image1, '128K') - qemu_img('create', '-f', iotests.imgfmt, image2, '128K') - qemu_img('create', '-f', iotests.imgfmt, image3, '128K') - qemu_img('create', '-f', iotests.imgfmt, image4, '128K') - self.file0 =3D open(image0, 'r') - self.file1 =3D open(image1, 'w+') - self.file2 =3D open(image2, 'r') - self.file3 =3D open(image3, 'r') - self.file4 =3D open(image4, 'r') + qemu_img('create', '-f', iotests.imgfmt, self.image0, '128K') + qemu_img('create', '-f', iotests.imgfmt, self.image1, '128K') + qemu_img('create', '-f', iotests.imgfmt, self.image2, '128K') + qemu_img('create', '-f', iotests.imgfmt, self.image3, '128K') + qemu_img('create', '-f', iotests.imgfmt, self.image4, '128K') + self.file0 =3D open(self.image0, 'r') + self.file1 =3D open(self.image1, 'w+') + self.file2 =3D open(self.image2, 'r') + self.file3 =3D open(self.image3, 'r') + self.file4 =3D open(self.image4, 'r') self.vm.add_fd(self.file0.fileno(), 1, 'image0:r') self.vm.add_fd(self.file1.fileno(), 1, 'image1:w+') self.vm.add_fd(self.file2.fileno(), 0, 'image2:r') @@ -57,11 +56,6 @@ class TestFdSets(iotests.QMPTestCase): self.file2.close() self.file3.close() self.file4.close() - os.remove(image0) - os.remove(image1) - os.remove(image2) - os.remove(image3) - os.remove(image4) =20 def test_query_fdset(self): result =3D self.vm.qmp('query-fdsets') @@ -128,8 +122,9 @@ class TestFdSets(iotests.QMPTestCase): # Add fd at runtime, there are two ways: monitor related or fdset related class TestSCMFd(iotests.QMPTestCase): def setUp(self): + self.image0 =3D os.path.join(self.workdir, 'image0') self.vm =3D iotests.VM() - qemu_img('create', '-f', iotests.imgfmt, image0, '128K') + qemu_img('create', '-f', iotests.imgfmt, self.image0, '128K') # Add an unused monitor, to verify it works fine when two monitor # instances present self.vm.add_monitor_telnet("0",4445) @@ -137,10 +132,9 @@ class TestSCMFd(iotests.QMPTestCase): =20 def tearDown(self): self.vm.shutdown() - os.remove(image0) =20 def _send_fd_by_SCM(self): - ret =3D self.vm.send_fd_scm(image0) + ret =3D self.vm.send_fd_scm(self.image0) self.assertEqual(ret, 0, 'Failed to send fd with UNIX SCM') =20 def test_add_fd(self): diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055 index e1206ca..4527ecf 100755 --- a/tests/qemu-iotests/055 +++ b/tests/qemu-iotests/055 @@ -26,8 +26,6 @@ import iotests from iotests import qemu_img, qemu_io =20 test_img =3D os.path.join(iotests.test_dir, 'test.img') -target_img =3D os.path.join(iotests.test_dir, 'target.img') -blockdev_target_img =3D os.path.join(iotests.test_dir, 'blockdev-target.im= g') =20 image_len =3D 64 * 1024 * 1024 # MB =20 @@ -40,27 +38,23 @@ def setUpModule(): qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xdc 32M 124k', test_img) qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x33 67043328 64k', test_= img) =20 -def tearDownModule(): - os.remove(test_img) =20 =20 class TestSingleDrive(iotests.QMPTestCase): def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(= image_len)) + self.target_img =3D os.path.join(self.workdir, 'target.img') + self.blockdev_target_img =3D os.path.join(self.workdir, 'blockdev-= target.img') + qemu_img('create', '-f', iotests.imgfmt, self.blockdev_target_img,= str(image_len)) =20 self.vm =3D iotests.VM().add_drive(test_img) - self.vm.add_drive(blockdev_target_img, interface=3D"none") + self.vm.add_drive(self.blockdev_target_img, interface=3D"none") if iotests.qemu_default_machine =3D=3D 'pc': self.vm.add_drive(None, 'media=3Dcdrom', 'ide') self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(blockdev_target_img) - try: - os.remove(target_img) - except OSError: - pass + pass =20 def do_test_cancel(self, cmd, target): self.assert_no_active_block_jobs() @@ -72,7 +66,7 @@ class TestSingleDrive(iotests.QMPTestCase): self.assert_qmp(event, 'data/type', 'backup') =20 def test_cancel_drive_backup(self): - self.do_test_cancel('drive-backup', target_img) + self.do_test_cancel('drive-backup', self.target_img) =20 def test_cancel_blockdev_backup(self): self.do_test_cancel('blockdev-backup', 'drive1') @@ -108,17 +102,17 @@ class TestSingleDrive(iotests.QMPTestCase): 'target image does not match source after backup') =20 def test_pause_drive_backup(self): - self.do_test_pause('drive-backup', target_img, target_img) + self.do_test_pause('drive-backup', self.target_img, self.target_im= g) =20 def test_pause_blockdev_backup(self): - self.do_test_pause('blockdev-backup', 'drive1', blockdev_target_im= g) + self.do_test_pause('blockdev-backup', 'drive1', self.blockdev_targ= et_img) =20 def test_medium_not_found(self): if iotests.qemu_default_machine !=3D 'pc': return =20 result =3D self.vm.qmp('drive-backup', device=3D'drive2', # CD-ROM - target=3Dtarget_img, sync=3D'full') + target=3Dself.target_img, sync=3D'full') self.assert_qmp(result, 'error/class', 'GenericError') =20 def test_medium_not_found_blockdev_backup(self): @@ -131,12 +125,12 @@ class TestSingleDrive(iotests.QMPTestCase): =20 def test_image_not_found(self): result =3D self.vm.qmp('drive-backup', device=3D'drive0', - target=3Dtarget_img, sync=3D'full', mode=3D'e= xisting') + target=3Dself.target_img, sync=3D'full', mode= =3D'existing') self.assert_qmp(result, 'error/class', 'GenericError') =20 def test_invalid_format(self): result =3D self.vm.qmp('drive-backup', device=3D'drive0', - target=3Dtarget_img, sync=3D'full', + target=3Dself.target_img, sync=3D'full', format=3D'spaghetti-noodles') self.assert_qmp(result, 'error/class', 'GenericError') =20 @@ -146,7 +140,7 @@ class TestSingleDrive(iotests.QMPTestCase): =20 def test_device_not_found(self): self.do_test_device_not_found('drive-backup', device=3D'nonexisten= t', - target=3Dtarget_img, sync=3D'full') + target=3Dself.target_img, sync=3D'fu= ll') =20 self.do_test_device_not_found('blockdev-backup', device=3D'nonexis= tent', target=3D'drive0', sync=3D'full') @@ -164,19 +158,17 @@ class TestSingleDrive(iotests.QMPTestCase): =20 class TestSetSpeed(iotests.QMPTestCase): def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(= image_len)) + self.target_img =3D os.path.join(self.workdir, 'target.img') + self.blockdev_target_img =3D os.path.join(self.workdir, 'blockdev-= target.img') + qemu_img('create', '-f', iotests.imgfmt, self.blockdev_target_img,= str(image_len)) =20 self.vm =3D iotests.VM().add_drive(test_img) - self.vm.add_drive(blockdev_target_img, interface=3D"none") + self.vm.add_drive(self.blockdev_target_img, interface=3D"none") self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(blockdev_target_img) - try: - os.remove(target_img) - except OSError: - pass + pass =20 def do_test_set_speed(self, cmd, target): self.assert_no_active_block_jobs() @@ -215,7 +207,7 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_qmp(event, 'data/type', 'backup') =20 def test_set_speed_drive_backup(self): - self.do_test_set_speed('drive-backup', target_img) + self.do_test_set_speed('drive-backup', self.target_img) =20 def test_set_speed_blockdev_backup(self): self.do_test_set_speed('blockdev-backup', 'drive1') @@ -241,28 +233,27 @@ class TestSetSpeed(iotests.QMPTestCase): self.assert_qmp(event, 'data/type', 'backup') =20 def test_set_speed_invalid_drive_backup(self): - self.do_test_set_speed_invalid('drive-backup', target_img) + self.do_test_set_speed_invalid('drive-backup', self.target_img) =20 def test_set_speed_invalid_blockdev_backup(self): self.do_test_set_speed_invalid('blockdev-backup', 'drive1') =20 class TestSingleTransaction(iotests.QMPTestCase): + def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img, str(= image_len)) + self.target_img =3D os.path.join(self.workdir, 'target.img') + self.blockdev_target_img =3D os.path.join(self.workdir, 'blockdev-= target.img') + qemu_img('create', '-f', iotests.imgfmt, self.blockdev_target_img,= str(image_len)) =20 self.vm =3D iotests.VM().add_drive(test_img) - self.vm.add_drive(blockdev_target_img, interface=3D"none") + self.vm.add_drive(self.blockdev_target_img, interface=3D"none") if iotests.qemu_default_machine =3D=3D 'pc': self.vm.add_drive(None, 'media=3Dcdrom', 'ide') self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(blockdev_target_img) - try: - os.remove(target_img) - except OSError: - pass + pass =20 def do_test_cancel(self, cmd, target): self.assert_no_active_block_jobs() @@ -281,7 +272,7 @@ class TestSingleTransaction(iotests.QMPTestCase): self.assert_qmp(event, 'data/type', 'backup') =20 def test_cancel_drive_backup(self): - self.do_test_cancel('drive-backup', target_img) + self.do_test_cancel('drive-backup', self.target_img) =20 def test_cancel_blockdev_backup(self): self.do_test_cancel('blockdev-backup', 'drive1') @@ -322,10 +313,10 @@ class TestSingleTransaction(iotests.QMPTestCase): 'target image does not match source after backup') =20 def test_pause_drive_backup(self): - self.do_test_pause('drive-backup', target_img, target_img) + self.do_test_pause('drive-backup', self.target_img, self.target_im= g) =20 def test_pause_blockdev_backup(self): - self.do_test_pause('blockdev-backup', 'drive1', blockdev_target_im= g) + self.do_test_pause('blockdev-backup', 'drive1', self.blockdev_targ= et_img) =20 def do_test_medium_not_found(self, cmd, target): if iotests.qemu_default_machine !=3D 'pc': @@ -341,7 +332,7 @@ class TestSingleTransaction(iotests.QMPTestCase): self.assert_qmp(result, 'error/class', 'GenericError') =20 def test_medium_not_found_drive_backup(self): - self.do_test_medium_not_found('drive-backup', target_img) + self.do_test_medium_not_found('drive-backup', self.target_img) =20 def test_medium_not_found_blockdev_backup(self): self.do_test_medium_not_found('blockdev-backup', 'drive1') @@ -351,7 +342,7 @@ class TestSingleTransaction(iotests.QMPTestCase): 'type': 'drive-backup', 'data': { 'device': 'drive0', 'mode': 'existing', - 'target': target_img, + 'target': self.target_img, 'sync': 'full' }, } ]) @@ -362,7 +353,7 @@ class TestSingleTransaction(iotests.QMPTestCase): 'type': 'drive-backup', 'data': { 'device': 'nonexistent', 'mode': 'existing', - 'target': target_img, + 'target': self.target_img, 'sync': 'full' }, } ]) @@ -410,7 +401,7 @@ class TestSingleTransaction(iotests.QMPTestCase): 'type': 'drive-backup', 'data': { 'device': 'nonexistent', 'mode': 'existing', - 'target': target_img, + 'target': self.target_img, 'sync': 'full' }, }, { 'type': 'Abort', @@ -452,21 +443,21 @@ class TestDriveCompression(iotests.QMPTestCase): fmt_supports_compression =3D [{'type': 'qcow2', 'args': ()}, {'type': 'vmdk', 'args': ('-o', 'subformat= =3DstreamOptimized')}] =20 + def setUp(self): + self.target_img =3D os.path.join(self.workdir, 'target.img') + self.blockdev_target_img =3D os.path.join(self.workdir, 'blockdev-= target.img') + def tearDown(self): self.vm.shutdown() - os.remove(blockdev_target_img) - try: - os.remove(target_img) - except OSError: - pass + pass =20 def do_prepare_drives(self, fmt, args, attach_target): self.vm =3D iotests.VM().add_drive(test_img) =20 - qemu_img('create', '-f', fmt, blockdev_target_img, + qemu_img('create', '-f', fmt, self.blockdev_target_img, str(TestDriveCompression.image_len), *args) if attach_target: - self.vm.add_drive(blockdev_target_img, format=3Dfmt, interface= =3D"none") + self.vm.add_drive(self.blockdev_target_img, format=3Dfmt, inte= rface=3D"none") =20 self.vm.launch() =20 @@ -481,14 +472,14 @@ class TestDriveCompression(iotests.QMPTestCase): self.wait_until_completed() =20 self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, blockdev_target_i= mg, + self.assertTrue(iotests.compare_images(test_img, self.blockdev_tar= get_img, iotests.imgfmt, format['typ= e']), 'target image does not match source after backup') =20 def test_complete_compress_drive_backup(self): for format in TestDriveCompression.fmt_supports_compression: self.do_test_compress_complete('drive-backup', format, False, - target=3Dblockdev_target_img, m= ode=3D'existing') + target=3Dself.blockdev_target_i= mg, mode=3D'existing') =20 def test_complete_compress_blockdev_backup(self): for format in TestDriveCompression.fmt_supports_compression: @@ -511,7 +502,7 @@ class TestDriveCompression(iotests.QMPTestCase): def test_compress_cancel_drive_backup(self): for format in TestDriveCompression.fmt_supports_compression: self.do_test_compress_cancel('drive-backup', format, False, - target=3Dblockdev_target_img, mod= e=3D'existing') + target=3Dself.blockdev_target_img= , mode=3D'existing') =20 def test_compress_cancel_blockdev_backup(self): for format in TestDriveCompression.fmt_supports_compression: @@ -546,14 +537,14 @@ class TestDriveCompression(iotests.QMPTestCase): self.wait_until_completed() =20 self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, blockdev_target_i= mg, + self.assertTrue(iotests.compare_images(test_img, self.blockdev_tar= get_img, iotests.imgfmt, format['typ= e']), 'target image does not match source after backup') =20 def test_compress_pause_drive_backup(self): for format in TestDriveCompression.fmt_supports_compression: self.do_test_compress_pause('drive-backup', format, False, - target=3Dblockdev_target_img, mode= =3D'existing') + target=3Dself.blockdev_target_img,= mode=3D'existing') =20 def test_compress_pause_blockdev_backup(self): for format in TestDriveCompression.fmt_supports_compression: diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056 index 04f2c3c..47da53f 100755 --- a/tests/qemu-iotests/056 +++ b/tests/qemu-iotests/056 @@ -25,50 +25,45 @@ import os import iotests from iotests import qemu_img, qemu_io, create_image =20 -backing_img =3D os.path.join(iotests.test_dir, 'backing.img') -test_img =3D os.path.join(iotests.test_dir, 'test.img') -target_img =3D os.path.join(iotests.test_dir, 'target.img') =20 class TestSyncModesNoneAndTop(iotests.QMPTestCase): image_len =3D 64 * 1024 * 1024 # MB =20 def setUp(self): - create_image(backing_img, TestSyncModesNoneAndTop.image_len) - qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % backing_img, test_img) - qemu_io('-c', 'write -P0x41 0 512', test_img) - qemu_io('-c', 'write -P0xd5 1M 32k', test_img) - qemu_io('-c', 'write -P0xdc 32M 124k', test_img) - qemu_io('-c', 'write -P0xdc 67043328 64k', test_img) - self.vm =3D iotests.VM().add_drive(test_img) + self.backing_img =3D os.path.join(self.workdir, 'backing.img') + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') + create_image(self.backing_img, TestSyncModesNoneAndTop.image_len) + qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=3D%s'= % self.backing_img, self.test_img) + qemu_io('-c', 'write -P0x41 0 512', self.test_img) + qemu_io('-c', 'write -P0xd5 1M 32k', self.test_img) + qemu_io('-c', 'write -P0xdc 32M 124k', self.test_img) + qemu_io('-c', 'write -P0xdc 67043328 64k', self.test_img) + self.vm =3D iotests.VM().add_drive(self.test_img) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - os.remove(backing_img) - try: - os.remove(target_img) - except OSError: - pass + pass =20 def test_complete_top(self): self.assert_no_active_block_jobs() result =3D self.vm.qmp('drive-backup', device=3D'drive0', sync=3D'= top', - format=3Diotests.imgfmt, target=3Dtarget_img) + format=3Diotests.imgfmt, target=3Dself.target= _img) self.assert_qmp(result, 'return', {}) =20 self.wait_until_completed(check_offset=3DFalse) =20 self.assert_no_active_block_jobs() self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after backup') =20 def test_cancel_sync_none(self): self.assert_no_active_block_jobs() =20 result =3D self.vm.qmp('drive-backup', device=3D'drive0', - sync=3D'none', target=3Dtarget_img) + sync=3D'none', target=3Dself.target_img) self.assert_qmp(result, 'return', {}) time.sleep(1) self.vm.hmp_qemu_io('drive0', 'write -P0x5e 0 512') @@ -80,21 +75,21 @@ class TestSyncModesNoneAndTop(iotests.QMPTestCase): =20 self.vm.shutdown() time.sleep(1) - self.assertEqual(-1, qemu_io('-c', 'read -P0x41 0 512', target_img= ).find("verification failed")) + self.assertEqual(-1, qemu_io('-c', 'read -P0x41 0 512', self.targe= t_img).find("verification failed")) =20 class TestBeforeWriteNotifier(iotests.QMPTestCase): def setUp(self): + self.target_img =3D os.path.join(self.workdir, 'target.img') self.vm =3D iotests.VM().add_drive_raw("file=3Dblkdebug::null-co:/= /,id=3Ddrive0,align=3D65536,driver=3Dblkdebug") self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(target_img) =20 def test_before_write_notifier(self): self.vm.pause_drive("drive0") result =3D self.vm.qmp('drive-backup', device=3D'drive0', - sync=3D'full', target=3Dtarget_img, + sync=3D'full', target=3Dself.target_img, format=3D"file", speed=3D1) self.assert_qmp(result, 'return', {}) result =3D self.vm.qmp('block-job-pause', device=3D"drive0") diff --git a/tests/qemu-iotests/057 b/tests/qemu-iotests/057 index 9f0a5a3..00b07d3 100755 --- a/tests/qemu-iotests/057 +++ b/tests/qemu-iotests/057 @@ -38,7 +38,7 @@ class ImageSnapshotTestCase(iotests.QMPTestCase): self.vm =3D iotests.VM() for i in range(0, image_num): filename =3D '%s%d' % (test_img_base_name, i) - img =3D os.path.join(iotests.test_dir, filename) + img =3D os.path.join(self.workdir, filename) device =3D '%s%d' % (test_drv_base_name, i) qemu_img('create', '-f', iotests.imgfmt, img, str(self.image_l= en)) self.vm.add_drive(img) @@ -49,8 +49,6 @@ class ImageSnapshotTestCase(iotests.QMPTestCase): =20 def tearDown(self): self.vm.shutdown() - for dev_expect in self.expect: - os.remove(dev_expect['image']) =20 def createSnapshotInTransaction(self, snapshot_num, abort =3D False): actions =3D [] diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065 index 72aa970..6c67f7d 100755 --- a/tests/qemu-iotests/065 +++ b/tests/qemu-iotests/065 @@ -26,19 +26,18 @@ import iotests from iotests import qemu_img, qemu_img_pipe import unittest =20 -test_img =3D os.path.join(iotests.test_dir, 'test.img') =20 class TestImageInfoSpecific(iotests.QMPTestCase): '''Abstract base class for ImageInfoSpecific tests''' + test_img =3D '' =20 def setUp(self): + self.test_img =3D os.path.join(self.workdir, 'test.img') if self.img_options is None: self.skipTest('Skipping abstract test class') qemu_img('create', '-f', iotests.imgfmt, '-o', self.img_options, - test_img, '128K') + self.test_img, '128K') =20 - def tearDown(self): - os.remove(test_img) =20 class TestQemuImgInfo(TestImageInfoSpecific): '''Abstract base class for qemu-img info tests''' @@ -48,13 +47,13 @@ class TestQemuImgInfo(TestImageInfoSpecific): human_compare =3D None =20 def test_json(self): - data =3D json.loads(qemu_img_pipe('info', '--output=3Djson', test_= img)) + data =3D json.loads(qemu_img_pipe('info', '--output=3Djson', self.= test_img)) data =3D data['format-specific'] self.assertEqual(data['type'], iotests.imgfmt) self.assertEqual(data['data'], self.json_compare) =20 def test_human(self): - data =3D qemu_img_pipe('info', '--output=3Dhuman', test_img).split= ('\n') + data =3D qemu_img_pipe('info', '--output=3Dhuman', self.test_img).= split('\n') data =3D data[(data.index('Format specific information:') + 1) :data.index('')] for field in data: @@ -71,7 +70,7 @@ class TestQMP(TestImageInfoSpecific): =20 def setUp(self): self.TestImageInfoSpecific.setUp(self) - self.vm =3D iotests.VM().add_drive(test_img, self.qemu_options) + self.vm =3D iotests.VM().add_drive(self.test_img, self.qemu_option= s) self.vm.launch() =20 def tearDown(self): diff --git a/tests/qemu-iotests/096 b/tests/qemu-iotests/096 index aeeb375..b9388ec 100644 --- a/tests/qemu-iotests/096 +++ b/tests/qemu-iotests/096 @@ -23,13 +23,15 @@ import iotests import os =20 class TestLiveSnapshot(iotests.QMPTestCase): - base_img =3D os.path.join(iotests.test_dir, 'base.img') - target_img =3D os.path.join(iotests.test_dir, 'target.img') + base_img =3D '' + target_img =3D '' group =3D 'mygroup' iops =3D 6000 iops_size =3D 1024 =20 def setUp(self): + self.base_img =3D os.path.join(self.workdir, 'base.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') opts =3D [] opts.append('node-name=3Dbase') opts.append('throttling.group=3D%s' % self.group) @@ -41,8 +43,6 @@ class TestLiveSnapshot(iotests.QMPTestCase): =20 def tearDown(self): self.vm.shutdown() - os.remove(self.base_img) - os.remove(self.target_img) =20 def checkConfig(self, active_layer): result =3D self.vm.qmp('query-block') diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118 index 8a9e838..b011780 100755 --- a/tests/qemu-iotests/118 +++ b/tests/qemu-iotests/118 @@ -25,12 +25,17 @@ import time import iotests from iotests import qemu_img =20 -old_img =3D os.path.join(iotests.test_dir, 'test0.img') -new_img =3D os.path.join(iotests.test_dir, 'test1.img') =20 class ChangeBaseClass(iotests.QMPTestCase): has_opened =3D False has_closed =3D False + old_img =3D '' + new_img =3D '' + + def setUp(self): + self.old_img =3D os.path.join(self.workdir, 'test0.img') + self.new_img =3D os.path.join(self.workdir, 'test1.img') + =20 def process_events(self): for event in self.vm.get_qmp_events(wait=3DFalse): @@ -62,11 +67,15 @@ class ChangeBaseClass(iotests.QMPTestCase): self.fail('Timeout while waiting for the tray to close') =20 class GeneralChangeTestsBaseClass(ChangeBaseClass): + ChangeBaseClass =3D ChangeBaseClass =20 device_name =3D None =20 + def setUp(self): + self.ChangeBaseClass.setUp(self); + def test_change(self): - result =3D self.vm.qmp('change', device=3D'drive0', target=3Dnew_i= mg, + result =3D self.vm.qmp('change', device=3D'drive0', target=3Dself.= new_img, arg=3Diotests.imgfmt) self.assert_qmp(result, 'return', {}) =20 @@ -76,16 +85,16 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): result =3D self.vm.qmp('query-block') if self.has_real_tray: self.assert_qmp(result, 'return[0]/tray_open', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 def test_blockdev_change_medium(self): if self.device_name is not None: result =3D self.vm.qmp('blockdev-change-medium', - id=3Dself.device_name, filename=3Dnew_img, + id=3Dself.device_name, filename=3Dself.ne= w_img, format=3Diotests.imgfmt) else: result =3D self.vm.qmp('blockdev-change-medium', - device=3D'drive0', filename=3Dnew_img, + device=3D'drive0', filename=3Dself.new_im= g, format=3Diotests.imgfmt) =20 self.assert_qmp(result, 'return', {}) @@ -96,7 +105,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): result =3D self.vm.qmp('query-block') if self.has_real_tray: self.assert_qmp(result, 'return[0]/tray_open', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 def test_eject(self): if self.device_name is not None: @@ -128,10 +137,10 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): =20 if self.device_name is not None: result =3D self.vm.qmp('blockdev-change-medium', id=3Dself.dev= ice_name, - filename=3Dnew_img, format=3Diotests.imgf= mt) + filename=3Dself.new_img, format=3Diotests= .imgfmt) else: result =3D self.vm.qmp('blockdev-change-medium', device=3D'dri= ve0', - filename=3Dnew_img, format=3Diotests.imgf= mt) + filename=3Dself.new_img, format=3Diotests= .imgfmt) self.assert_qmp(result, 'return', {}) =20 self.wait_for_close() @@ -139,7 +148,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): result =3D self.vm.qmp('query-block') if self.has_real_tray: self.assert_qmp(result, 'return[0]/tray_open', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 def test_tray_open_close(self): if self.device_name is not None: @@ -158,7 +167,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): if self.was_empty =3D=3D True: self.assert_qmp_absent(result, 'return[0]/inserted') else: - self.assert_qmp(result, 'return[0]/inserted/image/filename', o= ld_img) + self.assert_qmp(result, 'return[0]/inserted/image/filename', s= elf.old_img) =20 if self.device_name is not None: result =3D self.vm.qmp('blockdev-close-tray', id=3Dself.device= _name) @@ -175,7 +184,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): if self.was_empty =3D=3D True: self.assert_qmp_absent(result, 'return[0]/inserted') else: - self.assert_qmp(result, 'return[0]/inserted/image/filename', o= ld_img) + self.assert_qmp(result, 'return[0]/inserted/image/filename', s= elf.old_img) =20 def test_tray_eject_close(self): result =3D self.vm.qmp('eject', device=3D'drive0', force=3DTrue) @@ -213,10 +222,10 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): if self.was_empty =3D=3D True: self.assert_qmp_absent(result, 'return[0]/inserted') else: - self.assert_qmp(result, 'return[0]/inserted/image/filename', o= ld_img) + self.assert_qmp(result, 'return[0]/inserted/image/filename', s= elf.old_img) =20 result =3D self.vm.qmp('blockdev-change-medium', device=3D'drive0', - filename=3Dnew_img, + filename=3Dself.new= _img, format=3Diotests.im= gfmt) self.assert_qmp(result, 'return', {}) =20 @@ -225,13 +234,13 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): result =3D self.vm.qmp('query-block') if self.has_real_tray: self.assert_qmp(result, 'return[0]/tray_open', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 def test_cycle(self): result =3D self.vm.qmp('blockdev-add', node_name=3D'new', driver=3Diotests.imgfmt, - file=3D{'filename': new_img, + file=3D{'filename': self.new_img, 'driver': 'file'}) self.assert_qmp(result, 'return', {}) =20 @@ -251,7 +260,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): if self.was_empty =3D=3D True: self.assert_qmp_absent(result, 'return[0]/inserted') else: - self.assert_qmp(result, 'return[0]/inserted/image/filename', o= ld_img) + self.assert_qmp(result, 'return[0]/inserted/image/filename', s= elf.old_img) =20 if self.device_name is not None: result =3D self.vm.qmp('x-blockdev-remove-medium', @@ -276,7 +285,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): result =3D self.vm.qmp('query-block') if self.has_real_tray: self.assert_qmp(result, 'return[0]/tray_open', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 if self.device_name is not None: result =3D self.vm.qmp('blockdev-close-tray', id=3Dself.device= _name) @@ -289,7 +298,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): result =3D self.vm.qmp('query-block') if self.has_real_tray: self.assert_qmp(result, 'return[0]/tray_open', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 def test_close_on_closed(self): result =3D self.vm.qmp('blockdev-close-tray', device=3D'drive0') @@ -311,7 +320,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): result =3D self.vm.qmp('blockdev-add', node_name=3D'new', driver=3Diotests.imgfmt, - file=3D{'filename': new_img, + file=3D{'filename': self.new_img, 'driver': 'file'}) self.assert_qmp(result, 'return', {}) =20 @@ -321,29 +330,29 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass): =20 class TestInitiallyFilled(GeneralChangeTestsBaseClass): was_empty =3D False + GeneralChangeTestsBaseClass =3D GeneralChangeTestsBaseClass =20 def setUp(self, media, interface): - qemu_img('create', '-f', iotests.imgfmt, old_img, '1440k') - qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k') + self.GeneralChangeTestsBaseClass.setUp(self) + qemu_img('create', '-f', iotests.imgfmt, self.old_img, '1440k') + qemu_img('create', '-f', iotests.imgfmt, self.new_img, '1440k') self.vm =3D iotests.VM() if interface =3D=3D 'ide': self.device_name =3D 'qdev0' - self.vm.add_drive(old_img, 'media=3D%s' % media, 'none') + self.vm.add_drive(self.old_img, 'media=3D%s' % media, 'none') self.vm.add_device('ide-cd,drive=3Ddrive0,id=3D%s' % self.devi= ce_name) else: - self.vm.add_drive(old_img, 'media=3D%s' % media, interface) + self.vm.add_drive(self.old_img, 'media=3D%s' % media, interfac= e) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(old_img) - os.remove(new_img) =20 def test_insert_on_filled(self): result =3D self.vm.qmp('blockdev-add', node_name=3D'new', driver=3Diotests.imgfmt, - file=3D{'filename': new_img, + file=3D{'filename': self.new_img, 'driver': 'file'}) self.assert_qmp(result, 'return', {}) =20 @@ -358,15 +367,16 @@ class TestInitiallyFilled(GeneralChangeTestsBaseClass= ): =20 class TestInitiallyEmpty(GeneralChangeTestsBaseClass): was_empty =3D True + GeneralChangeTestsBaseClass =3D GeneralChangeTestsBaseClass =20 def setUp(self, media, interface): - qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k') + self.GeneralChangeTestsBaseClass.setUp(self) + qemu_img('create', '-f', iotests.imgfmt, self.new_img, '1440k') self.vm =3D iotests.VM().add_drive(None, 'media=3D%s' % media, int= erface) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(new_img) =20 def test_remove_on_empty(self): result =3D self.vm.qmp('blockdev-open-tray', device=3D'drive0') @@ -411,67 +421,64 @@ class TestFloppyInitiallyEmpty(TestInitiallyEmpty): =20 class TestChangeReadOnly(ChangeBaseClass): def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, old_img, '1440k') - qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k') + ChangeBaseClass.setUp(self) + qemu_img('create', '-f', iotests.imgfmt, self.old_img, '1440k') + qemu_img('create', '-f', iotests.imgfmt, self.new_img, '1440k') self.vm =3D iotests.VM() =20 def tearDown(self): self.vm.shutdown() - os.chmod(old_img, 0666) - os.chmod(new_img, 0666) - os.remove(old_img) - os.remove(new_img) =20 def test_ro_ro_retain(self): - os.chmod(old_img, 0444) - os.chmod(new_img, 0444) - self.vm.add_drive(old_img, 'media=3Ddisk,read-only=3Don', 'floppy') + os.chmod(self.old_img, 0444) + os.chmod(self.new_img, 0444) + self.vm.add_drive(self.old_img, 'media=3Ddisk,read-only=3Don', 'fl= oppy') self.vm.launch() =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 result =3D self.vm.qmp('blockdev-change-medium', device=3D'drive0', - filename=3Dnew_img, + filename=3Dself.new= _img, format=3Diotests.im= gfmt, read_only_mode=3D'r= etain') self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 def test_ro_rw_retain(self): - os.chmod(old_img, 0444) - self.vm.add_drive(old_img, 'media=3Ddisk,read-only=3Don', 'floppy') + os.chmod(self.old_img, 0444) + self.vm.add_drive(self.old_img, 'media=3Ddisk,read-only=3Don', 'fl= oppy') self.vm.launch() =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 result =3D self.vm.qmp('blockdev-change-medium', device=3D'drive0', - filename=3Dnew_img, + filename=3Dself.new= _img, format=3Diotests.im= gfmt, read_only_mode=3D'r= etain') self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 def test_rw_ro_retain(self): - os.chmod(new_img, 0444) - self.vm.add_drive(old_img, 'media=3Ddisk', 'floppy') + os.chmod(self.new_img, 0444) + self.vm.add_drive(self.old_img, 'media=3Ddisk', 'floppy') self.vm.launch() =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 result =3D self.vm.qmp('blockdev-change-medium', device=3D'drive0', - filename=3Dnew_img, + filename=3Dself.new= _img, format=3Diotests.im= gfmt, read_only_mode=3D'r= etain') self.assert_qmp(result, 'error/class', 'GenericError') @@ -480,145 +487,145 @@ class TestChangeReadOnly(ChangeBaseClass): =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 def test_ro_rw(self): - os.chmod(old_img, 0444) - self.vm.add_drive(old_img, 'media=3Ddisk,read-only=3Don', 'floppy') + os.chmod(self.old_img, 0444) + self.vm.add_drive(self.old_img, 'media=3Ddisk,read-only=3Don', 'fl= oppy') self.vm.launch() =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 result =3D self.vm.qmp('blockdev-change-medium', device=3D'drive0', - filename=3Dnew_img, + filename=3Dself.new_img, format=3Diotests.imgfmt, read_only_mode=3D'read-write') self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 def test_rw_ro(self): - os.chmod(new_img, 0444) - self.vm.add_drive(old_img, 'media=3Ddisk', 'floppy') + os.chmod(self.new_img, 0444) + self.vm.add_drive(self.old_img, 'media=3Ddisk', 'floppy') self.vm.launch() =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 result =3D self.vm.qmp('blockdev-change-medium', device=3D'drive0', - filename=3Dnew_img, + filename=3Dself.new_img, format=3Diotests.imgfmt, read_only_mode=3D'read-only') self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 def test_make_rw_ro(self): - self.vm.add_drive(old_img, 'media=3Ddisk', 'floppy') + self.vm.add_drive(self.old_img, 'media=3Ddisk', 'floppy') self.vm.launch() =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 result =3D self.vm.qmp('blockdev-change-medium', device=3D'drive0', - filename=3Dnew_img, + filename=3Dself.new_img, format=3Diotests.imgfmt, read_only_mode=3D'read-only') self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 def test_make_ro_rw(self): - os.chmod(new_img, 0444) - self.vm.add_drive(old_img, 'media=3Ddisk', 'floppy') + os.chmod(self.new_img, 0444) + self.vm.add_drive(self.old_img, 'media=3Ddisk', 'floppy') self.vm.launch() =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 result =3D self.vm.qmp('blockdev-change-medium', device=3D'drive0', - filename=3Dnew_img, + filename=3Dself.new_img, format=3Diotests.imgfmt, read_only_mode=3D'read-write') self.assert_qmp(result, 'error/class', 'GenericError') =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 def test_make_rw_ro_by_retain(self): - os.chmod(old_img, 0444) - self.vm.add_drive(old_img, 'media=3Ddisk,read-only=3Don', 'floppy') + os.chmod(self.old_img, 0444) + self.vm.add_drive(self.old_img, 'media=3Ddisk,read-only=3Don', 'fl= oppy') self.vm.launch() =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 result =3D self.vm.qmp('blockdev-change-medium', device=3D'drive0', - filename=3Dnew_img, + filename=3Dself.new= _img, format=3Diotests.im= gfmt, read_only_mode=3D'r= etain') self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 def test_make_ro_rw_by_retain(self): - os.chmod(new_img, 0444) - self.vm.add_drive(old_img, 'media=3Ddisk', 'floppy') + os.chmod(self.new_img, 0444) + self.vm.add_drive(self.old_img, 'media=3Ddisk', 'floppy') self.vm.launch() =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 result =3D self.vm.qmp('blockdev-change-medium', device=3D'drive0', - filename=3Dnew_img, + filename=3Dself.new= _img, format=3Diotests.im= gfmt, read_only_mode=3D'r= etain') self.assert_qmp(result, 'error/class', 'GenericError') =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 def test_rw_ro_cycle(self): - os.chmod(new_img, 0444) - self.vm.add_drive(old_img, 'media=3Ddisk', 'floppy') + os.chmod(self.new_img, 0444) + self.vm.add_drive(self.old_img, 'media=3Ddisk', 'floppy') self.vm.launch() =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 result =3D self.vm.qmp('blockdev-add', node_name=3D'new', driver=3Diotests.imgfmt, read_only=3DTrue, - file=3D{'filename': new_img, + file=3D{'filename': self.new_img, 'driver': 'file'}) self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', False) - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 result =3D self.vm.qmp('x-blockdev-remove-medium', device=3D'drive= 0') self.assert_qmp(result, 'return', {}) @@ -632,11 +639,11 @@ class TestChangeReadOnly(ChangeBaseClass): =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 result =3D self.vm.qmp('query-block') self.assert_qmp(result, 'return[0]/inserted/ro', True) - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) =20 GeneralChangeTestsBaseClass =3D None TestInitiallyFilled =3D None @@ -644,8 +651,10 @@ TestInitiallyEmpty =3D None =20 =20 class TestBlockJobsAfterCycle(ChangeBaseClass): + ChangeBaseClass =3D ChangeBaseClass def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, old_img, '1M') + self.ChangeBaseClass.setUp(self) + qemu_img('create', '-f', iotests.imgfmt, self.old_img, '1M') =20 self.vm =3D iotests.VM() self.vm.add_drive_raw("id=3Ddrive0,driver=3Dnull-co,if=3Dnone") @@ -665,7 +674,7 @@ class TestBlockJobsAfterCycle(ChangeBaseClass): result =3D self.vm.qmp('blockdev-add', node_name=3D'node0', driver=3Diotests.imgfmt, - file=3D{'filename': old_img, + file=3D{'filename': self.old_img, 'driver': 'file'}) self.assert_qmp(result, 'return', {}) =20 @@ -674,15 +683,10 @@ class TestBlockJobsAfterCycle(ChangeBaseClass): self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/image/filename', old_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= old_img) =20 def tearDown(self): self.vm.shutdown() - os.remove(old_img) - try: - os.remove(new_img) - except OSError: - pass =20 def test_snapshot_and_commit(self): # We need backing file support @@ -690,15 +694,15 @@ class TestBlockJobsAfterCycle(ChangeBaseClass): return =20 result =3D self.vm.qmp('blockdev-snapshot-sync', device=3D'drive0', - snapshot_file=3Dnew= _img, + snapshot_file=3Dsel= f.new_img, format=3Diotests.im= gfmt) self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/inserted/image/filename', new_i= mg) + self.assert_qmp(result, 'return[0]/inserted/image/filename', self.= new_img) self.assert_qmp(result, 'return[0]/inserted/image/backing-image/filename', - old_img) + self.old_img) =20 result =3D self.vm.qmp('block-commit', device=3D'drive0') self.assert_qmp(result, 'return', {}) diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index 8e76e62..91ca06d 100644 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -54,11 +54,12 @@ def transaction_drive_backup(device, target, **kwargs): =20 =20 class Bitmap: - def __init__(self, name, drive): + def __init__(self, name, drive, workdir=3Diotests.test_dir): self.name =3D name self.drive =3D drive self.num =3D 0 self.backups =3D list() + self.workdir =3D workdir =20 def base_target(self): return (self.drive['backup'], None) @@ -67,7 +68,7 @@ class Bitmap: if num is None: num =3D self.num self.num =3D num + 1 - base =3D os.path.join(iotests.test_dir, + base =3D os.path.join(self.workdir, "%s.%s." % (self.drive['id'], self.name)) suff =3D "%i.%s" % (num, self.drive['fmt']) target =3D base + "inc" + suff @@ -85,12 +86,6 @@ class Bitmap: try_remove(image) self.num -=3D 1 =20 - def cleanup(self): - for backup in self.backups: - for image in backup: - try_remove(image) - - class TestIncrementalBackupBase(iotests.QMPTestCase): def __init__(self, *args): super(TestIncrementalBackupBase, self).__init__(*args) @@ -98,7 +93,7 @@ class TestIncrementalBackupBase(iotests.QMPTestCase): self.files =3D list() self.drives =3D list() self.vm =3D iotests.VM() - self.err_img =3D os.path.join(iotests.test_dir, 'err.%s' % iotests= .imgfmt) + self.err_img =3D os.path.join(self.workdir, 'err.%s' % iotests.img= fmt) =20 =20 def setUp(self): @@ -118,9 +113,9 @@ class TestIncrementalBackupBase(iotests.QMPTestCase): =20 def add_node(self, node_id, fmt=3Diotests.imgfmt, path=3DNone, backup= =3DNone): if path is None: - path =3D os.path.join(iotests.test_dir, '%s.%s' % (node_id, fm= t)) + path =3D os.path.join(self.workdir, '%s.%s' % (node_id, fmt)) if backup is None: - backup =3D os.path.join(iotests.test_dir, + backup =3D os.path.join(self.workdir, '%s.full.backup.%s' % (node_id, fmt)) =20 self.drives.append({ @@ -196,7 +191,7 @@ class TestIncrementalBackupBase(iotests.QMPTestCase): =20 =20 def add_bitmap(self, name, drive, **kwargs): - bitmap =3D Bitmap(name, drive) + bitmap =3D Bitmap(name, drive, self.workdir) self.bitmaps.append(bitmap) result =3D self.vm.qmp('block-dirty-bitmap-add', node=3Ddrive['id'= ], name=3Dbitmap.name, **kwargs) @@ -273,11 +268,6 @@ class TestIncrementalBackupBase(iotests.QMPTestCase): =20 def tearDown(self): self.vm.shutdown() - for bitmap in self.bitmaps: - bitmap.cleanup() - for filename in self.files: - try_remove(filename) - =20 =20 class TestIncrementalBackup(TestIncrementalBackupBase): diff --git a/tests/qemu-iotests/129 b/tests/qemu-iotests/129 index 9e87e1c..8293649 100644 --- a/tests/qemu-iotests/129 +++ b/tests/qemu-iotests/129 @@ -23,11 +23,11 @@ import iotests import time =20 class TestStopWithBlockJob(iotests.QMPTestCase): - test_img =3D os.path.join(iotests.test_dir, 'test.img') - target_img =3D os.path.join(iotests.test_dir, 'target.img') - base_img =3D os.path.join(iotests.test_dir, 'base.img') =20 def setUp(self): + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') + self.base_img =3D os.path.join(self.workdir, 'base.img') iotests.qemu_img('create', '-f', iotests.imgfmt, self.base_img, "1= G") iotests.qemu_img('create', '-f', iotests.imgfmt, self.test_img, "-= b", self.base_img) iotests.qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x5d 1M 128M'= , self.test_img) diff --git a/tests/qemu-iotests/132 b/tests/qemu-iotests/132 index f53ef6e..3ca6f06 100644 --- a/tests/qemu-iotests/132 +++ b/tests/qemu-iotests/132 @@ -23,36 +23,31 @@ import os import iotests from iotests import qemu_img, qemu_io =20 -test_img =3D os.path.join(iotests.test_dir, 'test.img') -target_img =3D os.path.join(iotests.test_dir, 'target.img') =20 class TestSingleDrive(iotests.QMPTestCase): image_len =3D 2 * 1024 * 1024 # MB =20 def setUp(self): + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') # Write data to the image so we can compare later - qemu_img('create', '-f', iotests.imgfmt, test_img, str(TestSingleD= rive.image_len)) - qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x5d 0 2M', test_img) + qemu_img('create', '-f', iotests.imgfmt, self.test_img, str(TestSi= ngleDrive.image_len)) + qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x5d 0 2M', self.test= _img) =20 - self.vm =3D iotests.VM().add_drive(test_img, 'discard=3Dunmap') + self.vm =3D iotests.VM().add_drive(self.test_img, 'discard=3Dunmap= ') self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - try: - os.remove(target_img) - except OSError: - pass =20 def test_mirror_discard(self): result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - target=3Dtarget_img) + target=3Dself.target_img) self.assert_qmp(result, 'return', {}) self.vm.hmp_qemu_io('drive0', 'discard 0 64k') self.complete_and_wait('drive0') self.vm.shutdown() - self.assertTrue(iotests.compare_images(test_img, target_img), + self.assertTrue(iotests.compare_images(self.test_img, self.target_= img), 'target image does not match source after mirrorin= g') =20 if __name__ =3D=3D '__main__': diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136 index 4b99489..8109d63 100644 --- a/tests/qemu-iotests/136 +++ b/tests/qemu-iotests/136 @@ -27,7 +27,6 @@ nsec_per_sec =3D 1000000000 op_latency =3D nsec_per_sec / 1000 # See qtest_latency_ns in accounting.c bad_sector =3D 8192 bad_offset =3D bad_sector * 512 -blkdebug_file =3D os.path.join(iotests.test_dir, 'blkdebug.conf') =20 class BlockDeviceStatsTestCase(iotests.QMPTestCase): test_img =3D "null-aio://" @@ -53,7 +52,7 @@ class BlockDeviceStatsTestCase(iotests.QMPTestCase): raise Exception("Device not found for blockstats: %s" % device) =20 def create_blkdebug_file(self): - file =3D open(blkdebug_file, 'w') + file =3D open(self.blkdebug_file, 'w') file.write(''' [inject-error] event =3D "read_aio" @@ -68,6 +67,7 @@ sector =3D "%d" file.close() =20 def setUp(self): + self.blkdebug_file =3D os.path.join(self.workdir, 'blkdebug.conf') drive_args =3D [] drive_args.append("stats-intervals.0=3D%d" % interval_length) drive_args.append("stats-account-invalid=3D%s" % @@ -76,7 +76,7 @@ sector =3D "%d" (self.account_failed and "on" or "off")) self.create_blkdebug_file() self.vm =3D iotests.VM().add_drive('blkdebug:%s:%s' % - (blkdebug_file, self.test_img), + (self.blkdebug_file, self.test_im= g), ','.join(drive_args)) self.vm.launch() # Set an initial value for the clock @@ -84,7 +84,6 @@ sector =3D "%d" =20 def tearDown(self): self.vm.shutdown() - os.remove(blkdebug_file) =20 def accounted_ops(self, read =3D False, write =3D False, flush =3D Fal= se): ops =3D 0 diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139 index f8f0280..7699dd2 100644 --- a/tests/qemu-iotests/139 +++ b/tests/qemu-iotests/139 @@ -23,8 +23,6 @@ import os import iotests import time =20 -base_img =3D os.path.join(iotests.test_dir, 'base.img') -new_img =3D os.path.join(iotests.test_dir, 'new.img') if iotests.qemu_default_machine =3D=3D 's390-ccw-virtio': default_virtio_blk =3D 'virtio-blk-ccw' else: @@ -33,7 +31,9 @@ else: class TestBlockdevDel(iotests.QMPTestCase): =20 def setUp(self): - iotests.qemu_img('create', '-f', iotests.imgfmt, base_img, '1M') + self.base_img =3D os.path.join(self.workdir, 'base.img') + self.new_img =3D os.path.join(self.workdir, 'new.img') + iotests.qemu_img('create', '-f', iotests.imgfmt, self.base_img, '1= M') self.vm =3D iotests.VM() if iotests.qemu_default_machine =3D=3D 's390-ccw-virtio': self.vm.add_device("virtio-scsi-ccw,id=3Dvirtio-scsi") @@ -44,9 +44,6 @@ class TestBlockdevDel(iotests.QMPTestCase): =20 def tearDown(self): self.vm.shutdown() - os.remove(base_img) - if os.path.isfile(new_img): - os.remove(new_img) =20 # Check whether a BlockDriverState exists def checkBlockDriverState(self, node, must_exist =3D True): @@ -64,7 +61,7 @@ class TestBlockdevDel(iotests.QMPTestCase): 'node-name': node, 'file': {'driver': 'file', 'node-name': file_node, - 'filename': base_img}} + 'filename': self.base_img}} result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) self.assert_qmp(result, 'return', {}) self.checkBlockDriverState(node) @@ -74,12 +71,12 @@ class TestBlockdevDel(iotests.QMPTestCase): def addBlockDriverStateOverlay(self, node): self.checkBlockDriverState(node, False) iotests.qemu_img('create', '-u', '-f', iotests.imgfmt, - '-b', base_img, new_img, '1M') + '-b', self.base_img, self.new_img, '1M') opts =3D {'driver': iotests.imgfmt, 'node-name': node, 'backing': None, 'file': {'driver': 'file', - 'filename': new_img}} + 'filename': self.new_img}} result =3D self.vm.qmp('blockdev-add', conv_keys =3D False, **opts) self.assert_qmp(result, 'return', {}) self.checkBlockDriverState(node) @@ -143,7 +140,7 @@ class TestBlockdevDel(iotests.QMPTestCase): self.checkBlockDriverState(node) self.checkBlockDriverState(overlay, False) opts =3D {'node-name': node, - 'snapshot-file': new_img, + 'snapshot-file': self.new_img, 'snapshot-node-name': overlay, 'format': iotests.imgfmt} result =3D self.vm.qmp('blockdev-snapshot-sync', conv_keys=3DFalse= , **opts) @@ -166,7 +163,7 @@ class TestBlockdevDel(iotests.QMPTestCase): self.checkBlockDriverState(new_node, False) opts =3D {'device': node, 'job-id': node, - 'target': new_img, + 'target': self.new_img, 'node-name': new_node, 'sync': 'top', 'format': iotests.imgfmt} @@ -189,7 +186,7 @@ class TestBlockdevDel(iotests.QMPTestCase): image =3D {'driver': iotests.imgfmt, 'node-name': node, 'file': {'driver': 'file', - 'filename': base_img}} + 'filename': self.base_img}} opts =3D {'driver': 'blkdebug', 'node-name': debug, 'image': image} @@ -205,15 +202,15 @@ class TestBlockdevDel(iotests.QMPTestCase): self.checkBlockDriverState(test, False) self.checkBlockDriverState(raw, False) self.checkBlockDriverState(blkverify, False) - iotests.qemu_img('create', '-f', iotests.imgfmt, new_img, '1M') + iotests.qemu_img('create', '-f', iotests.imgfmt, self.new_img, '1M= ') node_0 =3D {'driver': iotests.imgfmt, 'node-name': test, 'file': {'driver': 'file', - 'filename': base_img}} + 'filename': self.base_img}} node_1 =3D {'driver': iotests.imgfmt, 'node-name': raw, 'file': {'driver': 'file', - 'filename': new_img}} + 'filename': self.new_img}} opts =3D {'driver': 'blkverify', 'node-name': blkverify, 'test': node_0, @@ -229,15 +226,15 @@ class TestBlockdevDel(iotests.QMPTestCase): self.checkBlockDriverState(child0, False) self.checkBlockDriverState(child1, False) self.checkBlockDriverState(quorum, False) - iotests.qemu_img('create', '-f', iotests.imgfmt, new_img, '1M') + iotests.qemu_img('create', '-f', iotests.imgfmt, self.new_img, '1M= ') child_0 =3D {'driver': iotests.imgfmt, 'node-name': child0, 'file': {'driver': 'file', - 'filename': base_img}} + 'filename': self.base_img}} child_1 =3D {'driver': iotests.imgfmt, 'node-name': child1, 'file': {'driver': 'file', - 'filename': new_img}} + 'filename': self.new_img}} opts =3D {'driver': 'quorum', 'node-name': quorum, 'vote-threshold': 1, diff --git a/tests/qemu-iotests/147 b/tests/qemu-iotests/147 index db34838..09194cc 100755 --- a/tests/qemu-iotests/147 +++ b/tests/qemu-iotests/147 @@ -27,8 +27,6 @@ from iotests import cachemode, imgfmt, qemu_img, qemu_nbd =20 NBD_PORT =3D 10811 =20 -test_img =3D os.path.join(iotests.test_dir, 'test.img') -unix_socket =3D os.path.join(iotests.test_dir, 'nbd.socket') =20 =20 def flatten_sock_addr(crumpled_address): @@ -38,6 +36,11 @@ def flatten_sock_addr(crumpled_address): =20 =20 class NBDBlockdevAddBase(iotests.QMPTestCase): + + def setUp(self): + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.unix_socket =3D os.path.join(self.workdir, 'nbd.socket') + def blockdev_add_options(self, address, export=3DNone): options =3D { 'node-name': 'nbd-blockdev', 'driver': 'raw', @@ -70,20 +73,16 @@ class NBDBlockdevAddBase(iotests.QMPTestCase): =20 class QemuNBD(NBDBlockdevAddBase): def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, test_img, '64k') + NBDBlockdevAddBase.setUp(self) + qemu_img('create', '-f', iotests.imgfmt, self.test_img, '64k') self.vm =3D iotests.VM() self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - try: - os.remove(unix_socket) - except OSError: - pass =20 def _server_up(self, *args): - self.assertEqual(qemu_nbd('-f', imgfmt, test_img, *args), 0) + self.assertEqual(qemu_nbd('-f', imgfmt, self.test_img, *args), 0) =20 def test_inet(self): self._server_up('-p', str(NBD_PORT)) @@ -96,21 +95,22 @@ class QemuNBD(NBDBlockdevAddBase): flatten_sock_addr(address)) =20 def test_unix(self): - self._server_up('-k', unix_socket) + self._server_up('-k', self.unix_socket) address =3D { 'type': 'unix', - 'data': { 'path': unix_socket } } - self.client_test('nbd+unix://?socket=3D' + unix_socket, + 'data': { 'path': self.unix_socket } } + self.client_test('nbd+unix://?socket=3D' + self.unix_socket, flatten_sock_addr(address)) =20 =20 class BuiltinNBD(NBDBlockdevAddBase): def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, test_img, '64k') + NBDBlockdevAddBase.setUp(self) + qemu_img('create', '-f', iotests.imgfmt, self.test_img, '64k') self.vm =3D iotests.VM() self.vm.launch() self.server =3D iotests.VM('.server') self.server.add_drive_raw('if=3Dnone,id=3Dnbd-export,' + - 'file=3D%s,' % test_img + + 'file=3D%s,' % self.test_img + 'format=3D%s,' % imgfmt + 'cache=3D%s' % cachemode) self.server.launch() @@ -118,11 +118,6 @@ class BuiltinNBD(NBDBlockdevAddBase): def tearDown(self): self.vm.shutdown() self.server.shutdown() - os.remove(test_img) - try: - os.remove(unix_socket) - except OSError: - pass =20 def _server_up(self, address): result =3D self.server.qmp('nbd-server-start', addr=3Daddress) @@ -173,18 +168,18 @@ class BuiltinNBD(NBDBlockdevAddBase): =20 def test_unix(self): address =3D { 'type': 'unix', - 'data': { 'path': unix_socket } } + 'data': { 'path': self.unix_socket } } self._server_up(address) - self.client_test('nbd+unix:///nbd-export?socket=3D' + unix_socket, + self.client_test('nbd+unix:///nbd-export?socket=3D' + self.unix_so= cket, flatten_sock_addr(address), 'nbd-export') self._server_down() =20 def test_fd(self): self._server_up({ 'type': 'unix', - 'data': { 'path': unix_socket } }) + 'data': { 'path': self.unix_socket } }) =20 sockfd =3D socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - sockfd.connect(unix_socket) + sockfd.connect(self.unix_socket) =20 result =3D self.vm.send_fd_scm(str(sockfd.fileno())) self.assertEqual(result, 0, 'Failed to send socket FD') diff --git a/tests/qemu-iotests/148 b/tests/qemu-iotests/148 index e01b061..9e66616 100644 --- a/tests/qemu-iotests/148 +++ b/tests/qemu-iotests/148 @@ -22,14 +22,6 @@ import os import iotests =20 -imgs =3D (os.path.join(iotests.test_dir, 'quorum0.img'), - os.path.join(iotests.test_dir, 'quorum1.img'), - os.path.join(iotests.test_dir, 'quorum2.img')) - -img_conf =3D (os.path.join(iotests.test_dir, 'quorum0.conf'), - os.path.join(iotests.test_dir, 'quorum1.conf'), - os.path.join(iotests.test_dir, 'quorum2.conf')) - event_rate =3D 1000000000 sector_size =3D 512 offset =3D 10 @@ -48,15 +40,23 @@ sector =3D "%d" file.close() =20 def setUp(self): + self.imgs =3D (os.path.join(self.workdir, 'quorum0.img'), + os.path.join(self.workdir, 'quorum1.img'), + os.path.join(self.workdir, 'quorum2.img')) + + self.img_conf =3D (os.path.join(self.workdir, 'quorum0.conf'), + os.path.join(self.workdir, 'quorum1.conf'), + os.path.join(self.workdir, 'quorum2.conf')) + driveopts =3D ['driver=3Dquorum', 'vote-threshold=3D2'] driveopts.append('read-pattern=3D%s' % self.read_pattern) - for i in range(len(imgs)): - iotests.qemu_img('create', '-f', iotests.imgfmt, imgs[i], '1M') - self.create_blkdebug_file(img_conf[i], i + offset) + for i in range(len(self.imgs)): + iotests.qemu_img('create', '-f', iotests.imgfmt, self.imgs[i],= '1M') + self.create_blkdebug_file(self.img_conf[i], i + offset) driveopts.append('children.%d.driver=3D%s' % (i, iotests.imgfm= t)) driveopts.append('children.%d.file.driver=3Dblkdebug' % i) - driveopts.append('children.%d.file.config=3D%s' % (i, img_conf= [i])) - driveopts.append('children.%d.file.image.filename=3D%s' % (i, = imgs[i])) + driveopts.append('children.%d.file.config=3D%s' % (i, self.img= _conf[i])) + driveopts.append('children.%d.file.image.filename=3D%s' % (i, = self.imgs[i])) driveopts.append('children.%d.node-name=3Dimg%d' % (i, i)) self.vm =3D iotests.VM() self.vm.add_drive(None, opts =3D ','.join(driveopts)) @@ -64,9 +64,6 @@ sector =3D "%d" =20 def tearDown(self): self.vm.shutdown() - for i in range(len(imgs)): - os.remove(imgs[i]) - os.remove(img_conf[i]) =20 def do_check_event(self, node, sector =3D 0): if node =3D=3D None: @@ -107,7 +104,7 @@ sector =3D "%d" =20 # I/O errors in different children: all events are emitted delay =3D 10 - for i in range(len(imgs)): + for i in range(len(self.imgs)): self.vm.hmp_qemu_io("drive0", "aio_read %d %d" % ((offset + i) * sector_size, sector_size)) self.vm.qtest("clock_step %d" % delay) @@ -119,7 +116,7 @@ sector =3D "%d" =20 # I/O errors in different children: all events are emitted delay =3D 2 * event_rate - for i in range(len(imgs)): + for i in range(len(self.imgs)): self.vm.hmp_qemu_io("drive0", "aio_read %d %d" % ((offset + i) * sector_size, sector_size)) self.vm.qtest("clock_step %d" % delay) diff --git a/tests/qemu-iotests/152 b/tests/qemu-iotests/152 index fec546d..07f713d 100644 --- a/tests/qemu-iotests/152 +++ b/tests/qemu-iotests/152 @@ -22,39 +22,34 @@ import os import iotests from iotests import qemu_img =20 -test_img =3D os.path.join(iotests.test_dir, 'test.img') -target_img =3D os.path.join(iotests.test_dir, 'target.img') =20 class TestUnaligned(iotests.QMPTestCase): def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, test_img, '512') - self.vm =3D iotests.VM().add_drive(test_img) + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.target_img =3D os.path.join(self.workdir, 'target.img') + qemu_img('create', '-f', iotests.imgfmt, self.test_img, '512') + self.vm =3D iotests.VM().add_drive(self.test_img) self.vm.launch() =20 def tearDown(self): self.vm.shutdown() - os.remove(test_img) - try: - os.remove(target_img) - except OSError: - pass =20 def test_unaligned(self): result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - granularity=3D65536, target=3Dtarget_img) + granularity=3D65536, target=3Dself.target_img) self.complete_and_wait() self.vm.shutdown() - self.assertEqual(iotests.image_size(test_img), iotests.image_size(= target_img), + self.assertEqual(iotests.image_size(self.test_img), iotests.image_= size(self.target_img), "Target size doesn't match source when granularit= y when unaligend") =20 def test_unaligned_with_update(self): result =3D self.vm.qmp('drive-mirror', device=3D'drive0', sync=3D'= full', - granularity=3D65536, target=3Dtarget_img) + granularity=3D65536, target=3Dself.target_img) self.wait_ready() self.vm.hmp_qemu_io('drive0', 'write 0 512') self.complete_and_wait(wait_ready=3DFalse) self.vm.shutdown() - self.assertEqual(iotests.image_size(test_img), iotests.image_size(= target_img), + self.assertEqual(iotests.image_size(self.test_img), iotests.image_= size(self.target_img), "Target size doesn't match source when granularit= y when unaligend") =20 =20 diff --git a/tests/qemu-iotests/155 b/tests/qemu-iotests/155 index 0b86ea4..66a84e6 100755 --- a/tests/qemu-iotests/155 +++ b/tests/qemu-iotests/155 @@ -25,11 +25,6 @@ import os import iotests from iotests import qemu_img =20 -back0_img =3D os.path.join(iotests.test_dir, 'back0.' + iotests.imgfmt) -back1_img =3D os.path.join(iotests.test_dir, 'back1.' + iotests.imgfmt) -back2_img =3D os.path.join(iotests.test_dir, 'back2.' + iotests.imgfmt) -source_img =3D os.path.join(iotests.test_dir, 'source.' + iotests.imgfmt) -target_img =3D os.path.join(iotests.test_dir, 'target.' + iotests.imgfmt) =20 =20 # Class variables for controlling its behavior: @@ -51,10 +46,15 @@ class BaseClass(iotests.QMPTestCase): target_real_backing =3D None =20 def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, back0_img, '1M') - qemu_img('create', '-f', iotests.imgfmt, '-b', back0_img, back1_im= g) - qemu_img('create', '-f', iotests.imgfmt, '-b', back1_img, back2_im= g) - qemu_img('create', '-f', iotests.imgfmt, '-b', back2_img, source_i= mg) + self.back0_img =3D os.path.join(self.workdir, 'back0.' + iotests.i= mgfmt) + self.back1_img =3D os.path.join(self.workdir, 'back1.' + iotests.i= mgfmt) + self.back2_img =3D os.path.join(self.workdir, 'back2.' + iotests.i= mgfmt) + self.source_img =3D os.path.join(self.workdir, 'source.' + iotests= .imgfmt) + self.target_img =3D os.path.join(self.workdir, 'target.' + iotests= .imgfmt) + qemu_img('create', '-f', iotests.imgfmt, self.back0_img, '1M') + qemu_img('create', '-f', iotests.imgfmt, '-b', self.back0_img, sel= f.back1_img) + qemu_img('create', '-f', iotests.imgfmt, '-b', self.back1_img, sel= f.back2_img) + qemu_img('create', '-f', iotests.imgfmt, '-b', self.back2_img, sel= f.source_img) =20 self.vm =3D iotests.VM() self.vm.add_drive(None, '', 'none') @@ -66,7 +66,7 @@ class BaseClass(iotests.QMPTestCase): node_name=3D'source', driver=3Diotests.imgfmt, file=3D{'driver': 'file', - 'filename': source_img}) + 'filename': self.source_img}) self.assert_qmp(result, 'return', {}) =20 result =3D self.vm.qmp('x-blockdev-insert-medium', @@ -78,15 +78,15 @@ class BaseClass(iotests.QMPTestCase): if self.existing: if self.target_backing: qemu_img('create', '-f', iotests.imgfmt, - '-b', self.target_backing, target_img, '1M') + '-b', self.target_backing, self.target_img, '1M') else: - qemu_img('create', '-f', iotests.imgfmt, target_img, '1M') + qemu_img('create', '-f', iotests.imgfmt, self.target_img, = '1M') =20 if self.cmd =3D=3D 'blockdev-mirror': options =3D { 'node-name': 'target', 'driver': iotests.imgfmt, 'file': { 'driver': 'file', - 'filename': target_img } } + 'filename': self.target_img } } if self.target_blockdev_backing: options['backing'] =3D self.target_blockdev_backing =20 @@ -95,14 +95,6 @@ class BaseClass(iotests.QMPTestCase): =20 def tearDown(self): self.vm.shutdown() - os.remove(source_img) - os.remove(back2_img) - os.remove(back1_img) - os.remove(back0_img) - try: - os.remove(target_img) - except OSError: - pass =20 def findBlockNode(self, node_name, id=3DNone): if id: @@ -124,13 +116,13 @@ class BaseClass(iotests.QMPTestCase): node =3D self.findBlockNode('source') =20 self.assert_qmp(node, 'image' + '/backing-image' * 0 + '/filename', - source_img) + self.source_img) self.assert_qmp(node, 'image' + '/backing-image' * 1 + '/filename', - back2_img) + self.back2_img) self.assert_qmp(node, 'image' + '/backing-image' * 2 + '/filename', - back1_img) + self.back1_img) self.assert_qmp(node, 'image' + '/backing-image' * 3 + '/filename', - back0_img) + self.back0_img) self.assert_qmp_absent(node, 'image' + '/backing-image' * 4) =20 def assertCorrectBackingImage(self, node, default_image): @@ -163,7 +155,7 @@ class MirrorBaseClass(BaseClass): else: mode =3D 'absolute-paths' result =3D self.vm.qmp(self.cmd, device=3D'drive0', sync=3Dsyn= c, - target=3Dtarget_img, format=3Diotests.img= fmt, + target=3Dself.target_img, format=3Diotest= s.imgfmt, mode=3Dmode, node_name=3D'target') =20 self.assert_qmp(result, 'return', {}) @@ -186,14 +178,14 @@ class MirrorBaseClass(BaseClass): self.runMirror('top') =20 node =3D self.findBlockNode('target', 'drive0') - self.assertCorrectBackingImage(node, back2_img) + self.assertCorrectBackingImage(node, self.back2_img) self.assertIntactSourceBackingChain() =20 def testNone(self): self.runMirror('none') =20 node =3D self.findBlockNode('target', 'drive0') - self.assertCorrectBackingImage(node, source_img) + self.assertCorrectBackingImage(node, self.source_img) self.assertIntactSourceBackingChain() =20 =20 @@ -233,7 +225,7 @@ class TestCommit(BaseClass): existing =3D False =20 def testCommit(self): - result =3D self.vm.qmp('block-commit', device=3D'drive0', base=3Db= ack1_img) + result =3D self.vm.qmp('block-commit', device=3D'drive0', base=3Ds= elf.back1_img) self.assert_qmp(result, 'return', {}) =20 self.vm.event_wait('BLOCK_JOB_READY') @@ -245,9 +237,9 @@ class TestCommit(BaseClass): =20 node =3D self.findBlockNode(None, 'drive0') self.assert_qmp(node, 'image' + '/backing-image' * 0 + '/filename', - back1_img) + self.back1_img) self.assert_qmp(node, 'image' + '/backing-image' * 1 + '/filename', - back0_img) + self.back0_img) self.assert_qmp_absent(node, 'image' + '/backing-image' * 2 + '/filename') =20 diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163 index 4038423..7940618 100644 --- a/tests/qemu-iotests/163 +++ b/tests/qemu-iotests/163 @@ -21,8 +21,6 @@ import os, random, iotests, struct, qcow2 from iotests import qemu_img, qemu_io, image_size =20 -test_img =3D os.path.join(iotests.test_dir, 'test.img') -check_img =3D os.path.join(iotests.test_dir, 'check.img') =20 def size_to_int(str): suff =3D ['B', 'K', 'M', 'G', 'T'] @@ -81,41 +79,39 @@ class ShrinkBaseClass(iotests.QMPTestCase): } =20 def setUp(self): + self.test_img =3D os.path.join(self.workdir, 'test.img') + self.check_img =3D os.path.join(self.workdir, 'check.img') if iotests.imgfmt =3D=3D 'raw': - qemu_img('create', '-f', iotests.imgfmt, test_img, self.image_= len) - qemu_img('create', '-f', iotests.imgfmt, check_img, + qemu_img('create', '-f', iotests.imgfmt, self.test_img, self.i= mage_len) + qemu_img('create', '-f', iotests.imgfmt, self.check_img, self.shrink_size) else: qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=3D' + self.cluster_size + ',refcount_bits=3D' + self.refcount_bits, - test_img, self.image_len) + self.test_img, self.image_len) qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=3D%s'% self.cluster_size, - check_img, self.shrink_size) - qemu_io('-c', 'write -P 0xff 0 ' + self.shrink_size, check_img) - - def tearDown(self): - os.remove(test_img) - os.remove(check_img) + self.check_img, self.shrink_size) + qemu_io('-c', 'write -P 0xff 0 ' + self.shrink_size, self.check_im= g) =20 def image_verify(self): - self.assertEqual(image_size(test_img), image_size(check_img), + self.assertEqual(image_size(self.test_img), image_size(self.check_= img), "Verifying image size") - self.image_check[iotests.imgfmt](self, test_img) + self.image_check[iotests.imgfmt](self, self.test_img) =20 if iotests.imgfmt =3D=3D 'raw': return - self.assertEqual(qemu_img('check', test_img), 0, + self.assertEqual(qemu_img('check', self.test_img), 0, "Verifying image corruption") =20 def test_empty_image(self): - qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img, + qemu_img('resize', '-f', iotests.imgfmt, '--shrink', self.test_im= g, self.shrink_size) =20 self.assertEqual( - qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, test_img), - qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, check_img), + qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, self.test_im= g), + qemu_io('-c', 'read -P 0x00 %s'%self.shrink_size, self.check_i= mg), "Verifying image content") =20 self.image_verify() @@ -124,12 +120,12 @@ class ShrinkBaseClass(iotests.QMPTestCase): for offs in range(0, size_to_int(self.image_len), size_to_int(self.chunk_size)): qemu_io('-c', 'write -P 0xff %d %s' % (offs, self.chunk_size), - test_img) + self.test_img) =20 - qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img, + qemu_img('resize', '-f', iotests.imgfmt, '--shrink', self.test_im= g, self.shrink_size) =20 - self.assertEqual(qemu_img("compare", test_img, check_img), 0, + self.assertEqual(qemu_img("compare", self.test_img, self.check_img= ), 0, "Verifying image content") =20 self.image_verify() @@ -140,12 +136,12 @@ class ShrinkBaseClass(iotests.QMPTestCase): random.shuffle(offs_list) for offs in offs_list: qemu_io('-c', 'write -P 0xff %d %s' % (offs, self.chunk_size), - test_img) + self.test_img) =20 - qemu_img('resize', '-f', iotests.imgfmt, '--shrink', test_img, + qemu_img('resize', '-f', iotests.imgfmt, '--shrink', self.test_im= g, self.shrink_size) =20 - self.assertEqual(qemu_img("compare", test_img, check_img), 0, + self.assertEqual(qemu_img("compare", self.test_img, self.check_img= ), 0, "Verifying image content") =20 self.image_verify() diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index a3932db..6672fa9 100755 --- a/tests/qemu-iotests/165 +++ b/tests/qemu-iotests/165 @@ -23,7 +23,6 @@ import re import iotests from iotests import qemu_img =20 -disk =3D os.path.join(iotests.test_dir, 'disk') disk_size =3D 0x40000000 # 1G =20 # regions for qemu_io: (start, count) in bytes @@ -36,16 +35,14 @@ regions2 =3D ((0x10000000, 0x20000), class TestPersistentDirtyBitmap(iotests.QMPTestCase): =20 def setUp(self): - qemu_img('create', '-f', iotests.imgfmt, disk, str(disk_size)) - - def tearDown(self): - os.remove(disk) + self.disk =3D os.path.join(self.workdir, 'disk') + qemu_img('create', '-f', iotests.imgfmt, self.disk, str(disk_size)) =20 def mkVm(self): - return iotests.VM().add_drive(disk) + return iotests.VM().add_drive(self.disk) =20 def mkVmRo(self): - return iotests.VM().add_drive(disk, opts=3D'readonly=3Don') + return iotests.VM().add_drive(self.disk, opts=3D'readonly=3Don') =20 def getSha256(self): result =3D self.vm.qmp('x-debug-block-dirty-bitmap-sha256', --=20 2.9.5 From nobody Thu May 2 20:15:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508258568440174.6120107305892; Tue, 17 Oct 2017 09:42:48 -0700 (PDT) Received: from localhost ([::1]:40507 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Ux3-0006h5-JW for importer@patchew.org; Tue, 17 Oct 2017 12:42:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4UnN-00075A-9o for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4UnM-0006lq-He for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40842) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4UnH-0006by-Cq; Tue, 17 Oct 2017 12:32:39 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 78BBB4ACAE; Tue, 17 Oct 2017 16:32:38 +0000 (UTC) Received: from localhost (ovpn-117-62.phx2.redhat.com [10.3.117.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D36C5D9C8; Tue, 17 Oct 2017 16:32:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 78BBB4ACAE Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jcody@redhat.com From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 12:31:54 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 17 Oct 2017 16:32:38 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 09/10] qemu-iotests: add option to save temp files on error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now that ./check takes care of cleaning up after each tests, it can also selectively not clean up. Add option to leave all output from tests intact if that test encountered an error. Signed-off-by: Jeff Cody --- tests/qemu-iotests/check | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 057ea39..a66f7b0 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -125,6 +125,7 @@ sortme=3Dfalse expunge=3Dtrue have_test_arg=3Dfalse cachemode=3Dfalse +save_on_err=3Dfalse =20 tmp=3D"${TEST_DIR}"/$$ rm -f $tmp.list $tmp.tmp $tmp.sed @@ -263,6 +264,8 @@ other options -o options -o options to pass to qemu-img create/convert -T output timestamps -c mode cache mode + -s save test scratch directory on test failure + =20 testlist options -g group[,group...] include tests from these groups @@ -435,6 +438,10 @@ testlist options xgroup=3Dtrue xpand=3Dfalse ;; + -s) + save_on_err=3Dtrue + xpand=3Dfalse + ;; '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]') echo "No tests?" status=3D1 @@ -853,7 +860,11 @@ do _cleanup_protocols _cleanup_qemu ) - rm -rf "$TEST_DIR_SEQ" + + if [ "$save_on_err" !=3D "true" ] || [ "$err" !=3D "true" ] + then + rm -rf "$TEST_DIR_SEQ" + fi =20 fi =20 --=20 2.9.5 From nobody Thu May 2 20:15:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508258314726359.6015515844781; Tue, 17 Oct 2017 09:38:34 -0700 (PDT) Received: from localhost ([::1]:40481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4Usu-0002wE-RT for importer@patchew.org; Tue, 17 Oct 2017 12:38:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4UnX-0007Ey-NV for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4UnV-0006xh-Gh for qemu-devel@nongnu.org; Tue, 17 Oct 2017 12:32:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46284) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4UnQ-0006r9-Tn; Tue, 17 Oct 2017 12:32:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F0F6FC047B6D; Tue, 17 Oct 2017 16:32:47 +0000 (UTC) Received: from localhost (ovpn-117-62.phx2.redhat.com [10.3.117.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B85D619DB; Tue, 17 Oct 2017 16:32:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F0F6FC047B6D Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jcody@redhat.com From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 12:31:55 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 17 Oct 2017 16:32:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 10/10] qemu-iotests: add support for running multi-threaded iotests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jsnow@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This adds support for running qemu-iotests in an arbitrary number of sub-processes, so that tests can be run in parallel. This necessarily changes the output format, although it should still be familiar. If you run in a single thread, the output format will largely be the same as before this patch. To run in more than one process, use the '-j num' option, e.g.: ./check -qcow2 -j 5 Some caveats: * Some output format options, such as timestamps, are currently not compatible with multiple jobs. If you select multiple jobs, timestamps will be disabled. * Some tests may be more prone to failure with multiple jobs. This isn't a flaw of multiple jobs per se, but rather of fragile tests. Some tests (181, 183) are very sensitive in timing, and high cpu loads can cause them to fail. It may be worth adding support for 'single-thread only' tests in subsequent patches, that complete designated single-thread jobs at the end. * Running protocol tests multi-threaded may fail, as multiple tests may try to bind the same address. If '-j' is not specified, the default is a single iotest being run at a time. Signed-off-by: Jeff Cody --- tests/qemu-iotests/check | 427 +++++++++++++++++++++++++++++---------= ---- tests/qemu-iotests/common.rc | 2 +- tests/qemu-iotests/iotests.py | 4 +- 3 files changed, 297 insertions(+), 136 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index a66f7b0..363617e 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -26,6 +26,8 @@ n_bad=3D0 bad=3D"" notrun=3D"" interrupt=3Dtrue +TEST_DIR_SEQ=3D"$TEST_DIR" +MAX_JOBS=3D1 =20 # by default don't output timestamps timestamp=3D${TIMESTAMP:=3Dfalse} @@ -125,6 +127,7 @@ sortme=3Dfalse expunge=3Dtrue have_test_arg=3Dfalse cachemode=3Dfalse +multijob=3Dfalse save_on_err=3Dfalse =20 tmp=3D"${TEST_DIR}"/$$ @@ -220,6 +223,11 @@ s/ .*//p CACHEMODE_IS_DEFAULT=3Dfalse cachemode=3Dfalse continue + elif $multijob + then + MAX_JOBS=3D"$r" + multijob=3Dfalse + continue fi =20 xpand=3Dtrue @@ -262,9 +270,10 @@ other options -misalign misalign memory allocations -n show me, do not run tests -o options -o options to pass to qemu-img create/convert - -T output timestamps + -T output timestamps, disabled if using '-j' -c mode cache mode -s save test scratch directory on test failure + -j num run tests in 'num' processes =20 =20 testlist options @@ -442,6 +451,10 @@ testlist options save_on_err=3Dtrue xpand=3Dfalse ;; + -j) + multijob=3Dtrue + xpand=3Dfalse + ;; '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]') echo "No tests?" status=3D1 @@ -506,6 +519,20 @@ BEGIN { for (t=3D'$start'; t<=3D'$end'; t++) pr= intf "%03d\n",t }' \ =20 done =20 +# No need for multi-process support, and this keeps output simpler +if $showme +then + MAX_JOBS=3D1 +fi + +# TODO: Change test output format so that this can be useful +# with multi-process jobs +if $timestamp && [ $MAX_JOBS -gt 1 ] +then + echo "Not showing timestamps with multi-job test" + timestamp=3Dfalse +fi + # Set qemu-io cache mode with $CACHEMODE we have QEMU_IO_OPTIONS=3D"$QEMU_IO_OPTIONS --cache $CACHEMODE" =20 @@ -670,8 +697,11 @@ END { if (NR > 0) { =20 if [ ! -z "$notrun" ] then - echo "Not run:$notrun" - echo "Not run:$notrun" >>check.log + # if run with $MAX_JOBS > 1, this will likely be + # out of order + notrun=3D$(echo $notrun|tr " " "\n"|sort|tr "\n" " ") + echo "Not run: $notrun" + echo "Not run: $notrun" >>check.log fi if [ ! -z "$n_bad" -a $n_bad !=3D 0 ] then @@ -694,7 +724,7 @@ END { if (NR > 0) { rm -f $tmp.* } =20 -trap "_wrapup; exit \$status" 0 1 2 3 15 +trap "_wait_to_finish; _wrapup; exit \$status" 0 1 2 3 15 =20 [ -f $TIMESTAMP_FILE ] || touch $TIMESTAMP_FILE =20 @@ -718,11 +748,235 @@ seq=3D"check" =20 [ -n "$TESTS_REMAINING_LOG" ] && echo $list > $TESTS_REMAINING_LOG =20 +# Execute actual test. This will be run in a background process. +_do_test() +{ + local seq=3D$1 + local err=3Dfalse + local tmp=3D"${TEST_DIR}/$seq/$seq" + local TEST_DIR_SEQ=3D$TEST_DIR/$seq + + _wallclock > "${TEST_DIR}/$seq.start.clock" + $timestamp && printf %s " [$(date "+%T")]" + + if [ "$(head -n 1 "$source_iotests/$seq")" =3D=3D "#!/usr/bin/env pyth= on" ]; then + run_command=3D"$PYTHON $seq" + else + run_command=3D"./$seq" + fi + export OUTPUT_DIR=3D$PWD + if $debug; then + # Do this in a sub-shell, so we are operating on the right + # TEST_DIR / QEMU_TEST_DIR + ( + export TEST_DIR=3D$TEST_DIR_SEQ + cd "$source_iotests"; + . ./common.config + . ./common.rc + MALLOC_PERTURB_=3D${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \ + $run_command -d 2>&1 | tee $tmp.out + ) + else + # Do this in a sub-shell, so we are operating on the right + # TEST_DIR / QEMU_TEST_DIR + ( + export TEST_DIR=3D$TEST_DIR_SEQ + cd "$source_iotests"; + . ./common.config + . ./common.rc + MALLOC_PERTURB_=3D${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \ + $run_command >$tmp.out 2>&1 + ) + fi + sts=3D$? + $timestamp && _timestamp + _wallclock > "${TEST_DIR}/$seq.stop.clock" + + if [ -f core ] + then + printf " [dumped core]" + mv core $seq.core + err=3Dtrue + fi + + if [ ! -f $seq.notrun ] + then + if [ $sts -ne 0 ] + then + printf %s " [failed, exit status $sts]" > "$TEST_DIR/$seq.err" + err=3Dtrue + fi + fi + + + # Do this in a sub-shell, so we are operating on the right + # TEST_DIR / QEMU_TEST_DIR + ( + export TEST_DIR=3D$TEST_DIR_SEQ + cd "$source_iotests"; + . ./common.config + . ./common.rc + . ./common.qemu + + _cleanup_protocols + _cleanup_qemu + ) + + if [ "$err" =3D=3D "true" ] + then + touch "$TEST_DIR/$seq.err" + fi +} + +# Runs after we detect a test has completed +function _check_results() +{ + local seq=3D$1 + local err=3Dfalse + local localtmp=3D"${TEST_DIR}/$seq/$seq" + local TEST_DIR_SEQ=3D$TEST_DIR/$seq + local success=3Dtrue + + if [ -f $seq.notrun ] + then + if [ $MAX_JOBS -gt 1 ] + then + printf "$seq " + fi + $timestamp || printf " [not run] " + $timestamp && printf " [not run]" && printf %s " $seq -- " + cat $seq.notrun + notrun=3D"$notrun $seq" + success=3Dfalse + else + reference=3D"$source_iotests/$seq.out" + reference_machine=3D"$source_iotests/$seq.$QEMU_DEFAULT_MACHINE.ou= t" + if [ -f "$reference_machine" ]; then + reference=3D"$reference_machine" + fi + + reference_format=3D"$source_iotests/$seq.out.$IMGFMT" + if [ -f "$reference_format" ]; then + reference=3D"$reference_format" + fi + + if [ "$CACHEMODE" =3D "none" ]; then + [ -f "$source_iotests/$seq.out.nocache" ] && reference=3D"$sou= rce_iotests/$seq.out.nocache" + fi + + if [ ! -f "$reference" ] + then + echo " - no qualified output" + else + if diff -w "$reference" $localtmp.out >/dev/null 2>&1 + then + if $err + then + : + else + stop=3D$(cat "$TEST_DIR/$seq.stop.clock") + start=3D$(cat "$TEST_DIR/$seq.start.clock") + echo "$seq `expr $stop - $start`" >>$tmp.time + fi + else + printf " - output mismatch (see $seq.out.bad)" + mv $localtmp.out $seq.out.bad + $diff -w "$reference" $(realpath $seq.out.bad) + err=3Dtrue + fi + fi + fi + + if [ "$err" =3D=3D "true" ] || [ -f "$TEST_DIR/$seq.err" ] + then + if [ $MAX_JOBS -gt 1 ] + then + printf "\n$seq [ fail ] " + fi + if [ -f "$TEST_DIR/$seq.err" ] + then + cat "$TEST_DIR/$seq.err" + fi + success=3Dfalse + err=3Dtrue + bad=3D"$bad $seq" + n_bad=3D`expr $n_bad + 1` + quick=3Dfalse + fi + + + if [ "$save_on_err" !=3D "true" ] || [ "$err" !=3D "true" ] + then + rm -rf "$TEST_DIR_SEQ" + fi + + [ -f $seq.notrun ] || try=3D`expr $try + 1` + + rm -f "$TEST_DIR/$seq.stop.clock" "$TEST_DIR/$seq.start.clock" + + if [ $MAX_JOBS -eq 1 ] || [ "$success" =3D=3D "false" ] + then + printf "\n" + fi +} + +# Even if interrupted, we want to wait until +# all tests have completed, so we can properly clean +# up after them via _check_results +function _wait_to_finish() +{ + while [ $jobs_running -gt 0 ] + do + i=3D0 + while [ $jobs_running -gt 0 ] + do + job=3D${job_slots[$i]} + if [ $job -gt 0 ] + then + if [ -z "$(ps -o pid -h -p $job)" ] + then + _check_results ${job_seq[$i]} + job_slots[$i]=3D0 + job_seq[$i]=3D-1 + let jobs_running-- + fi + fi + let i++ + let i=3D`expr $i % $MAX_JOBS` + sleep 0.1 + done + done +} + +job_slots=3D + +jobs_running=3D0 + +for i in `seq 0 $MAX_JOBS` +do + job_slots[$i]=3D0 +done + + +# Now iterate of the list of tests for seq in $list do - TEST_DIR_SEQ=3D$TEST_DIR/$seq - err=3Dfalse + + rm -f $seq.out.bad + lasttime=3D`sed -n -e "/^$seq /s/.* //p" <$TIMESTAMP_FILE` printf %s "$seq" + if [ "X$lasttime" !=3D X ]; then + printf %s " ${lasttime}s ..." + else + printf " " # prettier output with timestamps. + fi + rm -f core $seq.notrun + if [ $MAX_JOBS -gt 1 ] + then + printf "\n" + fi + + err=3Dfalse if [ -n "$TESTS_REMAINING_LOG" ] ; then sed -e "s/$seq//" -e 's/ / /' -e 's/^ *//' $TESTS_REMAINING_LOG >= $TESTS_REMAINING_LOG.tmp mv $TESTS_REMAINING_LOG.tmp $TESTS_REMAINING_LOG @@ -743,144 +997,51 @@ do echo " - no such test?" echo "/^$seq\$/d" >>$tmp.expunged else - # really going to try and run this one - # - rm -f $seq.out.bad - lasttime=3D`sed -n -e "/^$seq /s/.* //p" <$TIMESTAMP_FILE` - if [ "X$lasttime" !=3D X ]; then - printf %s " ${lasttime}s ..." - else - printf " " # prettier output with timestamps. - fi - rm -f core $seq.notrun =20 - start=3D`_wallclock` - $timestamp && printf %s " [$(date "+%T")]" - - if [ "$(head -n 1 "$source_iotests/$seq")" =3D=3D "#!/usr/bin/env = python" ]; then - run_command=3D"$PYTHON $seq" - else - run_command=3D"./$seq" - fi - export OUTPUT_DIR=3D$PWD - if $debug; then - # Do this in a sub-shell, so we are operating on the right - # TEST_DIR / QEMU_TEST_DIR - ( - export TEST_DIR=3D$TEST_DIR_SEQ - cd "$source_iotests"; - . ./common.config - . ./common.rc - MALLOC_PERTURB_=3D${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \ - $run_command -d 2>&1 | tee $tmp.out - ) - else - # Do this in a sub-shell, so we are operating on the right - # TEST_DIR / QEMU_TEST_DIR - ( - export TEST_DIR=3D$TEST_DIR_SEQ - cd "$source_iotests"; - . ./common.config - . ./common.rc - MALLOC_PERTURB_=3D${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \ - $run_command >$tmp.out 2>&1 - ) - fi - sts=3D$? - $timestamp && _timestamp - stop=3D`_wallclock` - - if [ -f core ] - then - printf " [dumped core]" - mv core $seq.core - err=3Dtrue - fi - - if [ -f $seq.notrun ] + if [ $MAX_JOBS -eq 1 ] then - $timestamp || printf " [not run] " - $timestamp && echo " [not run]" && printf %s " $seq -- " - cat $seq.notrun - notrun=3D"$notrun $seq" + # This way we can mimic the same output format before multi-pr= ocess test + # support was added, if we are running one test at a time + _do_test $seq + _check_results $seq else - if [ $sts -ne 0 ] - then - printf %s " [failed, exit status $sts]" - err=3Dtrue - fi - - reference=3D"$source_iotests/$seq.out" - reference_machine=3D"$source_iotests/$seq.$QEMU_DEFAULT_MACHIN= E.out" - if [ -f "$reference_machine" ]; then - reference=3D"$reference_machine" - fi - - reference_format=3D"$source_iotests/$seq.out.$IMGFMT" - if [ -f "$reference_format" ]; then - reference=3D"$reference_format" - fi - - if [ "$CACHEMODE" =3D "none" ]; then - [ -f "$source_iotests/$seq.out.nocache" ] && reference=3D"= $source_iotests/$seq.out.nocache" - fi - - if [ ! -f "$reference" ] - then - echo " - no qualified output" - err=3Dtrue - else - if diff -w "$reference" $tmp.out >/dev/null 2>&1 + # loop until a job slot becomes free + i=3D0 + while true + do + job=3D${job_slots[$i]} + if [ $job -le 0 ] + then + let jobs_running++ + job_seq[$i]=3D$seq + # Execute the test in the background + _do_test $seq & + job_slots[$i]=3D$! + break + elif [ -z "$(ps -o pid -h -p $job)" ] then - echo "" - if $err - then - : - else - echo "$seq `expr $stop - $start`" >>$tmp.time - fi - else - echo " - output mismatch (see $seq.out.bad)" - mv $tmp.out $seq.out.bad - $diff -w "$reference" $(realpath $seq.out.bad) - err=3Dtrue + # job has completed + _check_results ${job_seq[$i]} + job_slots[$i]=3D0 + job_seq[$i]=3D-1 + let jobs_running-- + continue fi - fi - fi - - # Do this in a sub-shell, so we are operating on the right - # TEST_DIR / QEMU_TEST_DIR - ( - export TEST_DIR=3D$TEST_DIR_SEQ - cd "$source_iotests"; - . ./common.config - . ./common.rc - . ./common.qemu =20 - _cleanup_protocols - _cleanup_qemu - ) + let i++ + let i=3D`expr $i % $MAX_JOBS` =20 - if [ "$save_on_err" !=3D "true" ] || [ "$err" !=3D "true" ] - then - rm -rf "$TEST_DIR_SEQ" + if [ $i -eq 0 ] + then + sleep 0.25 + fi + done fi - fi - - # come here for each test, except when $showme is true - # - if $err - then - bad=3D"$bad $seq" - n_bad=3D`expr $n_bad + 1` - quick=3Dfalse - fi - [ -f $seq.notrun ] || try=3D`expr $try + 1` - - seq=3D"after_$seq" done =20 +_wait_to_finish + interrupt=3Dfalse status=3D`expr $n_bad` exit diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index b26b02f..273a815 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -392,7 +392,7 @@ _img_info() # _notrun() { - echo "$*" >"$OUTPUT_DIR/$seq.notrun" + printf "$*" >"$OUTPUT_DIR/$seq.notrun" echo "$seq not run: $*" status=3D0 exit diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 7ff400a..11dfcf5 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -427,8 +427,8 @@ def notrun(reason): # Each test in qemu-iotests has a number ("seq") seq =3D os.path.basename(sys.argv[0]) =20 - open('%s/%s.notrun' % (output_dir, seq), 'wb').write(reason + '\n') - print '%s not run: %s' % (seq, reason) + open('%s/%s.notrun' % (output_dir, seq), 'wb').write(reason) + print '%s not run: %s\n' % (seq, reason) sys.exit(0) =20 def verify_image_format(supported_fmts=3D[], unsupported_fmts=3D[]): --=20 2.9.5