qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: <likejun6@huawei.com>
To: <qemu-block@nongnu.org>
Cc: kwolf@redhat.com, zhang.zhanghailiang@huawei.com,
	qemu-devel@nongnu.org, xiexiangyou@huawei.com, mreitz@redhat.com,
	likejun <likejun6@huawei.com>
Subject: [PATCH 4/4] qemu-iotest: add 311 testcase
Date: Wed, 21 Oct 2020 15:33:55 +0800	[thread overview]
Message-ID: <20201021073355.2499-5-likejun6@huawei.com> (raw)
In-Reply-To: <20201021073355.2499-1-likejun6@huawei.com>

From: likejun <likejun6@huawei.com>

Test backing file is raw

Signed-off-by: likejun <likejun6@huawei.com>
---
 tests/qemu-iotests/311     | 70 ++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/311.out | 30 ++++++++++++++++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 101 insertions(+)
 create mode 100755 tests/qemu-iotests/311
 create mode 100644 tests/qemu-iotests/311.out

diff --git a/tests/qemu-iotests/311 b/tests/qemu-iotests/311
new file mode 100755
index 0000000000..6c2b9f987f
--- /dev/null
+++ b/tests/qemu-iotests/311
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+# Test backing file is raw
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=zhangshuai13@huawei.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+status=1	# 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
+
+echo "=== Check qemu-img info output ==="
+echo
+size=64M
+
+$QEMU_IMG create -f raw $TEST_IMG $size | _filter_img_create
+_img_info | _filter_img_info
+mv "$TEST_IMG" "$TEST_IMG.base"
+
+_make_test_img -b $TEST_IMG.base -F raw
+_img_info --backing-chain | _filter_img_info
+
+echo
+echo "== reading whole image =="
+$QEMU_IO -c "read 0 $size" "$TEST_IMG" | _filter_qemu_io
+
+echo
+echo "== rewriting whole image =="
+$QEMU_IO -c "write -P 0xa 0 $size" "$TEST_IMG" | _filter_qemu_io
+
+echo
+echo "== verify pattern =="
+$QEMU_IO -c "read -P 0xa 0 $size" "$TEST_IMG" | _filter_qemu_io
+
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/311.out b/tests/qemu-iotests/311.out
new file mode 100644
index 0000000000..03b8374c04
--- /dev/null
+++ b/tests/qemu-iotests/311.out
@@ -0,0 +1,30 @@
+QA output created by 311
+=== Check qemu-img info output ===
+
+Formatting 'TEST_DIR/t.IMGFMT', fmt=raw size=67108864
+image: TEST_DIR/t.IMGFMT
+file format: raw
+virtual size: 64 MiB (67108864 bytes)
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=raw
+image: TEST_DIR/t.IMGFMT
+file format: IMGFMT
+virtual size: 64 MiB (67108864 bytes)
+backing file: TEST_DIR/t.IMGFMT.base
+backing file format: raw
+
+image: TEST_DIR/t.IMGFMT.base
+file format: raw
+virtual size: 64 MiB (67108864 bytes)
+
+== reading whole image ==
+read 67108864/67108864 bytes at offset 0
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+== rewriting whole image ==
+wrote 67108864/67108864 bytes at offset 0
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+== verify pattern ==
+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 e8b6480890..ec57e16f07 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -318,3 +318,4 @@
 308 rw auto quick
 309 rw auto quick
 310 rw auto quick
+311 rw auto quick
-- 
2.19.1




      parent reply	other threads:[~2020-10-21  8:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-21  7:33 [PATCH 0/4] Test qemu-img with different options likejun6
2020-10-21  7:33 ` [PATCH 1/4] qemu-iotest: add 308 testcase likejun6
2020-10-21  7:33 ` [PATCH 2/4] qemu-iotest: add 309 testcase likejun6
2020-10-21  7:33 ` [PATCH 3/4] qemu-iotest: add 310 testcase likejun6
2020-10-21  7:33 ` likejun6 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201021073355.2499-5-likejun6@huawei.com \
    --to=likejun6@huawei.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=xiexiangyou@huawei.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).