From nobody Wed Feb 11 02:33:15 2026 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.zoho.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 149374380760075.96661908107205; Tue, 2 May 2017 09:50:07 -0700 (PDT) Received: from localhost ([::1]:60187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5b02-0007AF-7h for importer@patchew.org; Tue, 02 May 2017 12:50:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5aoI-00050F-IE for qemu-devel@nongnu.org; Tue, 02 May 2017 12:38:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5aoH-0001GB-78 for qemu-devel@nongnu.org; Tue, 02 May 2017 12:37:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54440) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d5aoE-0001C5-AW; Tue, 02 May 2017 12:37:54 -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 32F1411C5E6; Tue, 2 May 2017 16:37:53 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-41.pek2.redhat.com [10.72.8.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8EA81862F; Tue, 2 May 2017 16:37:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 32F1411C5E6 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 32F1411C5E6 From: Fam Zheng To: qemu-devel@nongnu.org Date: Wed, 3 May 2017 00:35:58 +0800 Message-Id: <20170502163558.7611-24-famz@redhat.com> In-Reply-To: <20170502163558.7611-1-famz@redhat.com> References: <20170502163558.7611-1-famz@redhat.com> 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.25]); Tue, 02 May 2017 16:37:53 +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 v17 23/23] tests: Add POSIX image locking test case 182 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: Kevin Wolf , famz@redhat.com, qemu-block@nongnu.org, Max Reitz 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" Signed-off-by: Fam Zheng --- tests/qemu-iotests/182 | 73 ++++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/182.out | 8 +++++ tests/qemu-iotests/group | 1 + 3 files changed, 82 insertions(+) create mode 100755 tests/qemu-iotests/182 create mode 100644 tests/qemu-iotests/182.out diff --git a/tests/qemu-iotests/182 b/tests/qemu-iotests/182 new file mode 100755 index 0000000..ddc2f18 --- /dev/null +++ b/tests/qemu-iotests/182 @@ -0,0 +1,73 @@ +#!/bin/bash +# +# Test image locking for POSIX locks +# +# Copyright 2017 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=3Dfamz@redhat.com + +seq=3D"$(basename $0)" +echo "QA output created by $seq" + +here=3D"$PWD" +tmp=3D/tmp/$$ +status=3D1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter +. ./common.qemu + +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux + +size=3D32M + +_make_test_img $size + +_run_cmd() +{ + echo + (echo "$@"; "$@" 1>/dev/null) >&2 | _filter_testdir +} + +echo "Starting QEMU" +_launch_qemu -drive file=3D$TEST_IMG,if=3Dnone,id=3Ddrive0,file.locking=3D= on \ + -device virtio-blk-pci,drive=3Ddrive0 + +echo +echo "Starting a second QEMU using the same image should fail" +echo 'quit' | $QEMU -monitor stdio \ + -drive file=3D$TEST_IMG,if=3Dnone,id=3Ddrive0,file.locking=3Don \ + -device virtio-blk-pci,drive=3Ddrive0 2>&1 | _filter_testdir 2>&1 | + sed -e '/falling back to POSIX file/d' \ + -e '/locks can be lost unexpectedly/d' + +_cleanup_qemu + +# success, all done +echo "*** done" +rm -f $seq.full +status=3D0 diff --git a/tests/qemu-iotests/182.out b/tests/qemu-iotests/182.out new file mode 100644 index 0000000..b4b8f77 --- /dev/null +++ b/tests/qemu-iotests/182.out @@ -0,0 +1,8 @@ +QA output created by 182 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D33554432 +Starting QEMU + +Starting a second QEMU using the same image should fail +qemu-system-x86_64: -drive file=3DTEST_DIR/t.qcow2,if=3Dnone,id=3Ddrive0,f= ile.locking=3Don: Failed to get "write" lock +Is another process using the image? +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index c8ae60e..a4549d8 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -171,3 +171,4 @@ 175 auto quick 176 rw auto backing 181 rw auto migration +182 rw auto quick --=20 2.9.3