From nobody Mon Feb 9 01:20:10 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1603269697; cv=none; d=zohomail.com; s=zohoarc; b=FwaoGk2l0Gc0/j9Q57NQXBhSKb3TMydXKIxFUphH2tcq/Osv1yPu5weoUkJafRrkIgpngag/4ggi4STusigDV+uI7D8XHPGljaSd5fc+aAOI2ocDY5YABxVPZY547FyMk70UN/jcADUDQh2xU8qID21pcD6DsBLwRvPFTqBhTJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603269697; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6dzWq0TU/WDjwS0VqD0rG1nw7L69JuklfWwC1zj6sAQ=; b=QqltSCCRDtiBbdCJe0VWqYVtmvGF/9EdpefRwWEPEvcmTHpjvzISt4oAJD3+8hoK9rCYFcdM+cHux0SSwHJgcEGPWUs3adFWEPRxs6pRQx9ccn5M9U6Llbqme5Y3ADTPT1tC+yCtNPE8TAj2Q3gLBIhEYOyuZnoqz25g9R9aArI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1603269697696297.73443525664356; Wed, 21 Oct 2020 01:41:37 -0700 (PDT) Received: from localhost ([::1]:54448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kV9ge-0000EM-Vh for importer@patchew.org; Wed, 21 Oct 2020 04:41:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kV8dp-0002ni-2n; Wed, 21 Oct 2020 03:34:37 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5197 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kV8dm-0004LO-RU; Wed, 21 Oct 2020 03:34:36 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 166D8F0BEA3EAEAD8D1B; Wed, 21 Oct 2020 15:34:24 +0800 (CST) Received: from DESKTOP-IB00AOP.china.huawei.com (10.174.184.163) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Wed, 21 Oct 2020 15:34:13 +0800 From: To: Subject: [PATCH 3/4] qemu-iotest: add 310 testcase Date: Wed, 21 Oct 2020 15:33:54 +0800 Message-ID: <20201021073355.2499-4-likejun6@huawei.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20201021073355.2499-1-likejun6@huawei.com> References: <20201021073355.2499-1-likejun6@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.184.163] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.190; envelope-from=likejun6@huawei.com; helo=huawei.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 03:34:24 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 21 Oct 2020 04:40:16 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, zhang.zhanghailiang@huawei.com, qemu-devel@nongnu.org, xiexiangyou@huawei.com, mreitz@redhat.com, likejun Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: likejun Test falloc image creation, size and rw Signed-off-by: likejun --- tests/qemu-iotests/310 | 104 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/310.out | 21 ++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 126 insertions(+) create mode 100755 tests/qemu-iotests/310 create mode 100644 tests/qemu-iotests/310.out diff --git a/tests/qemu-iotests/310 b/tests/qemu-iotests/310 new file mode 100755 index 0000000000..af9f03e91f --- /dev/null +++ b/tests/qemu-iotests/310 @@ -0,0 +1,104 @@ +#!/bin/bash +# +# Test falloc image creation, size and rw +# +# Copyright (C) 2020 Huawei, 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=3Dzhangshuai13@huawei.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +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 >/dev/null 2>&1 +. ./common.filter + +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux + +_img_info_tmp() +{ + if [[ "$1" =3D=3D "--format-specific" ]]; then + local format_specific=3D1 + shift + else + local format_specific=3D0 + fi + + discard=3D0 + regex_json_spec_start=3D'^ *"format-specific": \{' + $QEMU_IMG info "$@" "$TEST_IMG" 2>&1 | \ + sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \ + -e "s#$TEST_DIR#TEST_DIR#g" \ + -e "s#$IMGFMT#IMGFMT#g" \ + -e "/actual-size/ D" | \ + while IFS=3D'' read line; do + if [[ $format_specific =3D=3D 1 ]]; then + discard=3D0 + elif [[ $line =3D=3D "Format specific information:" ]]; then + discard=3D1 + elif [[ $line =3D~ $regex_json_spec_start ]]; then + discard=3D2 + regex_json_spec_end=3D"^${line%%[^ ]*}\\},? *$" + fi + if [[ $discard =3D=3D 0 ]]; then + echo "$line" + elif [[ $discard =3D=3D 1 && ! $line ]]; then + echo + discard=3D0 + elif [[ $discard =3D=3D 2 && $line =3D~ $regex_json_spec_end ]= ]; then + discard=3D0 + fi + done +} + +IMGOPTS=3D"preallocation=3Dfalloc" + +echo "=3D=3D=3D Check qemu-img info output =3D=3D=3D" +echo +size=3D64M + +_make_test_img $size +_img_info_tmp | _filter_img_info + +echo +echo "=3D=3D reading whole image =3D=3D" +$QEMU_IO -c "read 0 $size" "$TEST_IMG" | _filter_qemu_io + +echo +echo "=3D=3D rewriting whole image =3D=3D" +$QEMU_IO -c "write -P 0xa 0 $size" "$TEST_IMG" | _filter_qemu_io + +echo +echo "=3D=3D verify pattern =3D=3D" +$QEMU_IO -c "read -P 0xa 0 $size" "$TEST_IMG" | _filter_qemu_io + + +# success, all done +echo "*** done" +rm -f $seq.full +status=3D0 diff --git a/tests/qemu-iotests/310.out b/tests/qemu-iotests/310.out new file mode 100644 index 0000000000..dcca649360 --- /dev/null +++ b/tests/qemu-iotests/310.out @@ -0,0 +1,21 @@ +QA output created by 310 +=3D=3D=3D Check qemu-img info output =3D=3D=3D + +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 preallocation= =3Dfalloc +image: TEST_DIR/t.IMGFMT +file format: IMGFMT +virtual size: 64 MiB (67108864 bytes) +disk size: 64.3 MiB + +=3D=3D reading whole image =3D=3D +read 67108864/67108864 bytes at offset 0 +64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D rewriting whole image =3D=3D +wrote 67108864/67108864 bytes at offset 0 +64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D verify pattern =3D=3D +read 67108864/67108864 bytes at offset 0 +64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 632a05b25e..e8b6480890 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -317,3 +317,4 @@ 307 rw quick export 308 rw auto quick 309 rw auto quick +310 rw auto quick --=20 2.19.1