From patchwork Fri Aug 26 09:16:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reda Sallahi X-Patchwork-Id: 9300989 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 92333601C0 for ; Fri, 26 Aug 2016 09:21:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81556295F2 for ; Fri, 26 Aug 2016 09:21:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75796295F3; Fri, 26 Aug 2016 09:21:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AF276295F0 for ; Fri, 26 Aug 2016 09:21:48 +0000 (UTC) Received: from localhost ([::1]:59657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdDKd-0003Wp-S4 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 26 Aug 2016 05:21:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdDGB-0000C5-ST for qemu-devel@nongnu.org; Fri, 26 Aug 2016 05:17:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bdDG5-0003vG-7H for qemu-devel@nongnu.org; Fri, 26 Aug 2016 05:17:10 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdDG4-0003v0-Sx; Fri, 26 Aug 2016 05:17:05 -0400 Received: by mail-wm0-x244.google.com with SMTP id i5so10546062wmg.2; Fri, 26 Aug 2016 02:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QqgTKRldSs34c1PFZzFhEef4tmhgPO6nMt39h6CEIz8=; b=abZrfPUmiS00SFXHuoCmnQG7gvoy0TEQyZ3MMPQNVObGAB9dIs4NPKoX1DGnrECVAe vgG0SkpDEJAvs37vtosrY8vurGKilxu/Xp6PB0UYbcW44IhfJC07W35XGagVb76IPlyT jYntVh8fThUlyusdn0MTfbKckfcCyLT3jhs0cMbwTM5sxdvb3vM6slnR9PquWMYI37dE 25pautRTvG38+NSNNSFoctCDNafWHO5xvTWSt2900bDrN4u068ljvrxr43uOT1FXid5a D1/2ZvNMrjGApBJ3eSWjxsScDXrQvTniioi/NLCYb7xxnWcSLDsj9x68I4z1HyilpLEg fZaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QqgTKRldSs34c1PFZzFhEef4tmhgPO6nMt39h6CEIz8=; b=blNeWT5GbyNZaT2HDK8al1LGHpvy2ThFNHluko537FU9jaTLEQW9Dae3GRB6Z6hJta /EZhsPVumRZPHW7t83vV3I8cT2Urk+SkuYaFY9gXWnWqtTs2GY4gAFgehcmD0ieani/g /GNs6ePdLRpnFhVIDXTs2Za0bDGrDa1yAZFmHJDhdh/goEhi9fME2S4L4ZGwGm4lsUjr 7BeCliLuFTWBpLk3lhh/NqE/8OgKH+WCf6g1LHOO8+ZeA06ownCsmi7zrb0HuFsba0kc ZExLPec9yDBJcrLhsAVBK0BU8ER3yT/jWssadbwvXkqInxpzR1448sdb0bHMXreYQ/Xj nLRg== X-Gm-Message-State: AE9vXwMKTvB+HGAvBS6soB2ipSe9V3jRYtG4LQyK5gI4nDCBWJ0paUWHh1bysjlzEzre4A== X-Received: by 10.194.179.163 with SMTP id dh3mr2498964wjc.73.1472203023968; Fri, 26 Aug 2016 02:17:03 -0700 (PDT) Received: from cinque_stelle.sm14.sm.cri.epita.net ([163.5.208.144]) by smtp.gmail.com with ESMTPSA id f4sm42716517wmf.8.2016.08.26.02.17.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Aug 2016 02:17:03 -0700 (PDT) From: Reda Sallahi To: qemu-devel@nongnu.org Date: Fri, 26 Aug 2016 11:16:43 +0200 Message-Id: <20160826091643.15841-8-fullmanet@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160826091643.15841-1-fullmanet@gmail.com> References: <20160826091643.15841-1-fullmanet@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PATCH v2 7/7] qemu-img: add a test suite for the count option 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 , Fam Zheng , qemu-block@nongnu.org, Max Reitz , Reda Sallahi , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The count option for dd lacked a test suite so this adds one with four test cases. Signed-off-by: Reda Sallahi Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/168 | 75 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/168.out | 51 +++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 127 insertions(+) create mode 100755 tests/qemu-iotests/168 create mode 100644 tests/qemu-iotests/168.out diff --git a/tests/qemu-iotests/168 b/tests/qemu-iotests/168 new file mode 100755 index 0000000..3ed655e --- /dev/null +++ b/tests/qemu-iotests/168 @@ -0,0 +1,75 @@ +#! /bin/bash +# +# qemu-img dd test for count option +# +# Copyright (C) 2016 Reda Sallahi +# +# 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 . +# + +owner=fullmanet@gmail.com + +seq="$(basename $0)" +echo "QA output created by $seq" + +here="$PWD" +status=1 + +_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 + +_supported_fmt raw +_supported_proto file +_supported_os Linux + +TEST_COUNT_BLOCKS="1 4 19 43K" + +for count in $TEST_COUNT_BLOCKS; do + echo + echo "== Creating image ==" + + size=1M + _make_test_img $size + _check_test_img + + $QEMU_IO -c "write -P 0xa 565k 384k" "$TEST_IMG" | _filter_qemu_io + + echo + echo "== Converting the image with dd with count=$count ==" + + $QEMU_IMG dd if="$TEST_IMG" of="$TEST_IMG.out" count=$count \ + -O "$IMGFMT" status=none conv=notrunc + + TEST_IMG="$TEST_IMG.out" _check_test_img + + dd if="$TEST_IMG" of="$TEST_IMG.out.dd" count=$count status=none + + echo + echo "== Compare the images with qemu-img compare ==" + + $QEMU_IMG compare "$TEST_IMG.out.dd" "$TEST_IMG.out" +done + +echo +echo "*** done" +rm -f "$seq.full" +status=0 diff --git a/tests/qemu-iotests/168.out b/tests/qemu-iotests/168.out new file mode 100644 index 0000000..768a687 --- /dev/null +++ b/tests/qemu-iotests/168.out @@ -0,0 +1,51 @@ +QA output created by 168 + +== Creating image == +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 +No errors were found on the image. +wrote 393216/393216 bytes at offset 578560 +384 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== Converting the image with dd with count=1 == +No errors were found on the image. + +== Compare the images with qemu-img compare == +Images are identical. + +== Creating image == +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 +No errors were found on the image. +wrote 393216/393216 bytes at offset 578560 +384 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== Converting the image with dd with count=4 == +No errors were found on the image. + +== Compare the images with qemu-img compare == +Images are identical. + +== Creating image == +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 +No errors were found on the image. +wrote 393216/393216 bytes at offset 578560 +384 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== Converting the image with dd with count=19 == +No errors were found on the image. + +== Compare the images with qemu-img compare == +Images are identical. + +== Creating image == +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 +No errors were found on the image. +wrote 393216/393216 bytes at offset 578560 +384 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== Converting the image with dd with count=43K == +No errors were found on the image. + +== Compare the images with qemu-img compare == +Images are identical. + +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index fbe0ffe..9e47975 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -167,3 +167,4 @@ 165 rw auto quick 166 rw auto quick 167 rw auto quick +168 rw auto quick