qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com,
	Anton.Nefedov@acronis.com, armbru@redhat.com,
	qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com,
	den@openvz.org
Subject: [PATCH 5/5] iotests: add 298 to test new preallocate filter driver
Date: Sat, 20 Jun 2020 17:36:49 +0300	[thread overview]
Message-ID: <20200620143649.225852-6-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20200620143649.225852-1-vsementsov@virtuozzo.com>

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/298     | 45 ++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/298.out |  5 +++++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 51 insertions(+)
 create mode 100644 tests/qemu-iotests/298
 create mode 100644 tests/qemu-iotests/298.out

diff --git a/tests/qemu-iotests/298 b/tests/qemu-iotests/298
new file mode 100644
index 0000000000..a6af14fc55
--- /dev/null
+++ b/tests/qemu-iotests/298
@@ -0,0 +1,45 @@
+#!/usr/bin/env python3
+#
+# Test for preallocate filter
+#
+# Copyright (c) 2020 Virtuozzo International GmbH.
+#
+# 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/>.
+#
+
+import os
+import iotests
+from iotests import log
+
+iotests.script_initialize(supported_fmts=['qcow2'])
+
+size = 10 * 1024 * 1024
+disk = iotests.file_path('disk')
+
+iotests.qemu_img_create('-f', iotests.imgfmt, disk, str(size))
+
+opts = f'driver={iotests.imgfmt},' \
+    f'file.driver=preallocate,file.file.filename={disk}'
+p = iotests.QemuIoInteractive('--image-opts', '-t', 'none', opts)
+
+log(p.cmd('write 0 1M'), filters=[iotests.filter_qemu_io])
+p.cmd('flush')
+
+if os.path.getsize(disk) > 100 * 1024 * 1024:
+    log('file in progress is big, preallocation works')
+
+p.close()
+
+if os.path.getsize(disk) < 10 * 1024 * 1024:
+    log('file is small after close')
diff --git a/tests/qemu-iotests/298.out b/tests/qemu-iotests/298.out
new file mode 100644
index 0000000000..6c34d172a4
--- /dev/null
+++ b/tests/qemu-iotests/298.out
@@ -0,0 +1,5 @@
+wrote 1048576/1048576 bytes at offset 0
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+file in progress is big, preallocation works
+file is small after close
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index d886fa0cb3..1bfb864841 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -302,3 +302,4 @@
 291 rw quick
 292 rw auto quick
 297 meta
+298 meta
-- 
2.18.0



  parent reply	other threads:[~2020-06-20 14:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-20 14:36 [PATCH 0/5] preallocate filter Vladimir Sementsov-Ogievskiy
2020-06-20 14:36 ` [PATCH 1/5] block/io: introduce bdrv_try_mark_request_serialising Vladimir Sementsov-Ogievskiy
2020-07-07 15:56   ` Stefan Hajnoczi
2020-07-08 15:51     ` Vladimir Sementsov-Ogievskiy
2020-07-13 11:23       ` Stefan Hajnoczi
2020-06-20 14:36 ` [PATCH 2/5] block/io: introduce bdrv_co_range_try_lock Vladimir Sementsov-Ogievskiy
2020-07-07 16:10   ` Stefan Hajnoczi
2020-07-08 15:56     ` Vladimir Sementsov-Ogievskiy
2020-07-13 11:23       ` Stefan Hajnoczi
2020-06-20 14:36 ` [PATCH 3/5] block: introduce preallocate filter Vladimir Sementsov-Ogievskiy
2020-07-08 12:07   ` Stefan Hajnoczi
2020-07-08 16:17     ` Vladimir Sementsov-Ogievskiy
2020-07-13 11:27       ` Stefan Hajnoczi
2020-06-20 14:36 ` [PATCH 4/5] iotests: QemuIoInteractive: use qemu_io_args_no_fmt Vladimir Sementsov-Ogievskiy
2020-07-08 12:08   ` Stefan Hajnoczi
2020-06-20 14:36 ` Vladimir Sementsov-Ogievskiy [this message]
2020-07-08 12:09   ` [PATCH 5/5] iotests: add 298 to test new preallocate filter driver Stefan Hajnoczi

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=20200620143649.225852-6-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=Anton.Nefedov@acronis.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=fam@euphon.net \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).