[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 10/12] iotests: add 298 to test new preallocate filter driver
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v3 10/12] iotests: add 298 to test new preallocate filter driver |
Date: |
Mon, 17 Aug 2020 12:15:51 +0300 |
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
tests/qemu-iotests/298 | 50 ++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/298.out | 6 +++++
tests/qemu-iotests/group | 1 +
3 files changed, 57 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..4f2087352a
--- /dev/null
+++ b/tests/qemu-iotests/298
@@ -0,0 +1,50 @@
+#!/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'])
+iotests.verify_o_direct()
+
+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')
+
+# Check that there are no leaks.
+log(iotests.qemu_img_pipe('check', '-f', 'qcow2', disk),
+ filters=[iotests.filter_img_check])
diff --git a/tests/qemu-iotests/298.out b/tests/qemu-iotests/298.out
new file mode 100644
index 0000000000..baf8f8425c
--- /dev/null
+++ b/tests/qemu-iotests/298.out
@@ -0,0 +1,6 @@
+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
+No errors were found on the image.
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 025ed5238d..ac4772b43f 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -306,6 +306,7 @@
295 rw
296 rw
297 meta
+298 auto quick
299 auto quick
301 backing quick
302 quick
--
2.18.0
- [PATCH v3 05/12] block: bdrv_mark_request_serialising: split non-waiting function, (continued)
- [PATCH v3 05/12] block: bdrv_mark_request_serialising: split non-waiting function, Vladimir Sementsov-Ogievskiy, 2020/08/17
- [PATCH v3 06/12] block: introduce BDRV_REQ_NO_WAIT flag, Vladimir Sementsov-Ogievskiy, 2020/08/17
- [PATCH v3 04/12] block/io: bdrv_wait_serialising_requests_locked: drop extra bs arg, Vladimir Sementsov-Ogievskiy, 2020/08/17
- [PATCH v3 07/12] block: introduce preallocate filter, Vladimir Sementsov-Ogievskiy, 2020/08/17
- [PATCH v3 09/12] iotests.py: add filter_img_check, Vladimir Sementsov-Ogievskiy, 2020/08/17
- [PATCH v3 10/12] iotests: add 298 to test new preallocate filter driver,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v3 11/12] block: add bdrv_is_file_on_fuse helper, Vladimir Sementsov-Ogievskiy, 2020/08/17
- [PATCH v3 08/12] iotests.py: add verify_o_direct helper, Vladimir Sementsov-Ogievskiy, 2020/08/17
- [PATCH v3 12/12] block/qcow2: automatically insert preallocate filter when on FUSE, Vladimir Sementsov-Ogievskiy, 2020/08/17
- Re: [PATCH v3 00/12] preallocate filter, no-reply, 2020/08/17
- Re: [PATCH v3 00/12] preallocate filter, no-reply, 2020/08/17