From patchwork Mon Aug 22 07:55:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reda Sallahi X-Patchwork-Id: 9293089 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 77F2F60574 for ; Mon, 22 Aug 2016 08:01:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67E86287DA for ; Mon, 22 Aug 2016 08:01:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C099287EA; Mon, 22 Aug 2016 08:01:05 +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 A15D9287DA for ; Mon, 22 Aug 2016 08:01:04 +0000 (UTC) Received: from localhost ([::1]:40142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbkAJ-0000Ot-Qs for patchwork-qemu-devel@patchwork.kernel.org; Mon, 22 Aug 2016 04:01:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbk5a-0004Yu-BB for qemu-devel@nongnu.org; Mon, 22 Aug 2016 03:56:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bbk5X-0004iK-R0 for qemu-devel@nongnu.org; Mon, 22 Aug 2016 03:56:09 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbk5X-0004hz-Gp; Mon, 22 Aug 2016 03:56:07 -0400 Received: by mail-wm0-x243.google.com with SMTP id i5so12205609wmg.2; Mon, 22 Aug 2016 00:56:07 -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=yQo/BzbuogHDLHRW8MI2pUiF+EXxIGOZ5K97uoF0hxE=; b=yDveSKbvOVpIhYlfJ/+JO2ikslAM22fpFtkvFJBkLoFVcIeibfoPg1YRLeBB7rOhpS NOFwPaAdWFvg9v2XVaI6S0+1ZCOW03TwNeFhDga0fPeJev/4nDS+SOvRzkMq+ZBjrcAA oVTA4G+98RTC+iwKd9XWXMX8xcpy+y4eJsWzVNcShbHNpFhoaHbv4VGH23Z1VAAupYf6 nqG75H4EBhAAKrfkb8CmnBbLikJlTyhCACefAaspiwxtk+BTkcceVJe4P5kjSbnpm7PR Q4vrKXzFjC9UGDyQEZGmr/uEjByxPMvhbjMwZCAsa28yRn3xinsGbSW19Huku9nrzkxu aHzQ== 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=yQo/BzbuogHDLHRW8MI2pUiF+EXxIGOZ5K97uoF0hxE=; b=IwRNMxFhxF2fPClVX/moe9xxKIME4hUiXHCYhLR37NP2EsfRnY0QFR0lv1bFNFioes U9E7pLT/R0dk+c2ARLGinvsjlzf7s1/LW4n1a3uUGqAvOWzhRIrJ7MEOSPnnodz+duVK aq+7cLT6gggodyVe3Ycmr9TXHAvmzytc024lGcQozrXckb2f3H0bJyHjq4ea7FbP46ml Wa+++dpVNFBgsQf7kcXzw4eWjl0xf2sNJMmV3peEK2KtG60JrdGolJod2lAnT3cwaZIC ClUhaxErSfNAPK+AmJuEbwdincQJbQhRrj7dAlGGE1n2UEj4WeCScLwXaqKaUHz4c1oE nOlg== X-Gm-Message-State: AEkoouu1eDySdt2+GYMVVSWNwiRkIJGSnZqBLN+y1yvPIS41P9ioltSZqB5l3bJgTOCH0Q== X-Received: by 10.28.131.199 with SMTP id f190mr14479320wmd.30.1471852566693; Mon, 22 Aug 2016 00:56:06 -0700 (PDT) Received: from cinque_stelle.sm14.sm.cri.epita.net ([163.5.208.89]) by smtp.gmail.com with ESMTPSA id uo4sm22329922wjc.36.2016.08.22.00.56.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Aug 2016 00:56:05 -0700 (PDT) From: Reda Sallahi To: qemu-devel@nongnu.org Date: Mon, 22 Aug 2016 09:55:17 +0200 Message-Id: <20160822075517.5859-8-fullmanet@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160822075517.5859-1-fullmanet@gmail.com> References: <20160822075517.5859-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::243 Subject: [Qemu-devel] [PATCH 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