thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-iotests-026-Move-v3-exclusive-test-to-new-file.patch

be904d
From a4a984e67e276e643b8a51f39ca426d0967754a0 Mon Sep 17 00:00:00 2001
be904d
From: Max Reitz <mreitz@redhat.com>
be904d
Date: Mon, 13 Jul 2020 14:24:51 -0400
be904d
Subject: [PATCH 4/4] iotests/026: Move v3-exclusive test to new file
be904d
MIME-Version: 1.0
be904d
Content-Type: text/plain; charset=UTF-8
be904d
Content-Transfer-Encoding: 8bit
be904d
be904d
RH-Author: Max Reitz <mreitz@redhat.com>
be904d
Message-id: <20200713142451.289703-5-mreitz@redhat.com>
be904d
Patchwork-id: 97956
be904d
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH 4/4] iotests/026: Move v3-exclusive test to new file
be904d
Bugzilla: 1807057
be904d
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
be904d
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
be904d
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
be904d
be904d
data_file does not work with v2, and we probably want 026 to keep
be904d
working for v2 images.  Thus, open a new file for v3-exclusive error
be904d
path test cases.
be904d
be904d
Fixes: 81311255f217859413c94f2cd9cebf2684bbda94
be904d
       (“iotests/026: Test EIO on allocation in a data-file”)
be904d
Signed-off-by: Max Reitz <mreitz@redhat.com>
be904d
Message-Id: <20200311140707.1243218-1-mreitz@redhat.com>
be904d
Reviewed-by: John Snow <jsnow@redhat.com>
be904d
Tested-by: John Snow <jsnow@redhat.com>
be904d
Signed-off-by: Max Reitz <mreitz@redhat.com>
be904d
(cherry picked from commit c264e5d2f9f5d73977eac8e5d084f727b3d07ea9)
be904d
be904d
Conflicts:
be904d
      tests/qemu-iotests/group
be904d
      - As per usual.
be904d
be904d
Signed-off-by: Max Reitz <mreitz@redhat.com>
be904d
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
be904d
---
be904d
 tests/qemu-iotests/026             | 31 -----------
be904d
 tests/qemu-iotests/026.out         |  6 --
be904d
 tests/qemu-iotests/026.out.nocache |  6 --
be904d
 tests/qemu-iotests/289             | 89 ++++++++++++++++++++++++++++++
be904d
 tests/qemu-iotests/289.out         |  8 +++
be904d
 tests/qemu-iotests/group           |  1 +
be904d
 6 files changed, 98 insertions(+), 43 deletions(-)
be904d
 create mode 100755 tests/qemu-iotests/289
be904d
 create mode 100644 tests/qemu-iotests/289.out
be904d
be904d
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
be904d
index c1c96a41d9..3afd708863 100755
be904d
--- a/tests/qemu-iotests/026
be904d
+++ b/tests/qemu-iotests/026
be904d
@@ -237,37 +237,6 @@ $QEMU_IO -c "write 0 $CLUSTER_SIZE" "$BLKDBG_TEST_IMG" | _filter_qemu_io
be904d
 
be904d
 _check_test_img
be904d
 
be904d
-echo
be904d
-echo === Avoid freeing external data clusters on failure ===
be904d
-echo
be904d
-
be904d
-# Similar test as the last one, except we test what happens when there
be904d
-# is an error when writing to an external data file instead of when
be904d
-# writing to a preallocated zero cluster
be904d
-_make_test_img -o "data_file=$TEST_IMG.data_file" $CLUSTER_SIZE
be904d
-
be904d
-# Put blkdebug above the data-file, and a raw node on top of that so
be904d
-# that blkdebug will see a write_aio event and emit an error
be904d
-$QEMU_IO -c "write 0 $CLUSTER_SIZE" \
be904d
-    "json:{
be904d
-         'driver': 'qcow2',
be904d
-         'file': { 'driver': 'file', 'filename': '$TEST_IMG' },
be904d
-         'data-file': {
be904d
-             'driver': 'raw',
be904d
-             'file': {
be904d
-                 'driver': 'blkdebug',
be904d
-                 'config': '$TEST_DIR/blkdebug.conf',
be904d
-                 'image': {
be904d
-                     'driver': 'file',
be904d
-                     'filename': '$TEST_IMG.data_file'
be904d
-                 }
be904d
-             }
be904d
-         }
be904d
-     }" \
be904d
-    | _filter_qemu_io
be904d
-
be904d
-_check_test_img
be904d
-
be904d
 # success, all done
be904d
 echo "*** done"
be904d
 rm -f $seq.full
be904d
diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out
be904d
index c1b3b58482..83989996ff 100644
be904d
--- a/tests/qemu-iotests/026.out
be904d
+++ b/tests/qemu-iotests/026.out
be904d
@@ -653,10 +653,4 @@ wrote 1024/1024 bytes at offset 0
be904d
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
be904d
 write failed: Input/output error
be904d
 No errors were found on the image.
be904d
-
be904d
-=== Avoid freeing external data clusters on failure ===
be904d
-
be904d
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024 data_file=TEST_DIR/t.IMGFMT.data_file
be904d
-write failed: Input/output error
be904d
-No errors were found on the image.
be904d
 *** done
be904d
diff --git a/tests/qemu-iotests/026.out.nocache b/tests/qemu-iotests/026.out.nocache
be904d
index 8d5001648a..9359d26d7e 100644
be904d
--- a/tests/qemu-iotests/026.out.nocache
be904d
+++ b/tests/qemu-iotests/026.out.nocache
be904d
@@ -661,10 +661,4 @@ wrote 1024/1024 bytes at offset 0
be904d
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
be904d
 write failed: Input/output error
be904d
 No errors were found on the image.
be904d
-
be904d
-=== Avoid freeing external data clusters on failure ===
be904d
-
be904d
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024 data_file=TEST_DIR/t.IMGFMT.data_file
be904d
-write failed: Input/output error
be904d
-No errors were found on the image.
be904d
 *** done
be904d
diff --git a/tests/qemu-iotests/289 b/tests/qemu-iotests/289
be904d
new file mode 100755
be904d
index 0000000000..1c11d4030e
be904d
--- /dev/null
be904d
+++ b/tests/qemu-iotests/289
be904d
@@ -0,0 +1,89 @@
be904d
+#!/usr/bin/env bash
be904d
+#
be904d
+# qcow2 v3-exclusive error path testing
be904d
+# (026 tests paths common to v2 and v3)
be904d
+#
be904d
+# Copyright (C) 2020 Red Hat, Inc.
be904d
+#
be904d
+# This program is free software; you can redistribute it and/or modify
be904d
+# it under the terms of the GNU General Public License as published by
be904d
+# the Free Software Foundation; either version 2 of the License, or
be904d
+# (at your option) any later version.
be904d
+#
be904d
+# This program is distributed in the hope that it will be useful,
be904d
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
be904d
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
be904d
+# GNU General Public License for more details.
be904d
+#
be904d
+# You should have received a copy of the GNU General Public License
be904d
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
be904d
+#
be904d
+
be904d
+seq=$(basename $0)
be904d
+echo "QA output created by $seq"
be904d
+
be904d
+status=1	# failure is the default!
be904d
+
be904d
+_cleanup()
be904d
+{
be904d
+    _cleanup_test_img
be904d
+    rm "$TEST_DIR/blkdebug.conf"
be904d
+    rm -f "$TEST_IMG.data_file"
be904d
+}
be904d
+trap "_cleanup; exit \$status" 0 1 2 3 15
be904d
+
be904d
+# get standard environment, filters and checks
be904d
+. ./common.rc
be904d
+. ./common.filter
be904d
+. ./common.pattern
be904d
+
be904d
+_supported_fmt qcow2
be904d
+_supported_proto file
be904d
+# This is a v3-exclusive test;
be904d
+# As for data_file, error paths often very much depend on whether
be904d
+# there is an external data file or not; so we create one exactly when
be904d
+# we want to test it
be904d
+_unsupported_imgopts 'compat=0.10' data_file
be904d
+
be904d
+echo
be904d
+echo === Avoid freeing external data clusters on failure ===
be904d
+echo
be904d
+
be904d
+cat > "$TEST_DIR/blkdebug.conf" <
be904d
+[inject-error]
be904d
+event = "write_aio"
be904d
+errno = "5"
be904d
+once = "on"
be904d
+EOF
be904d
+
be904d
+# Test what happens when there is an error when writing to an external
be904d
+# data file instead of when writing to a preallocated zero cluster
be904d
+_make_test_img -o "data_file=$TEST_IMG.data_file" 64k
be904d
+
be904d
+# Put blkdebug above the data-file, and a raw node on top of that so
be904d
+# that blkdebug will see a write_aio event and emit an error.  This
be904d
+# will then trigger the alloc abort code, which we want to test here.
be904d
+$QEMU_IO -c "write 0 64k" \
be904d
+    "json:{
be904d
+         'driver': 'qcow2',
be904d
+         'file': { 'driver': 'file', 'filename': '$TEST_IMG' },
be904d
+         'data-file': {
be904d
+             'driver': 'raw',
be904d
+             'file': {
be904d
+                 'driver': 'blkdebug',
be904d
+                 'config': '$TEST_DIR/blkdebug.conf',
be904d
+                 'image': {
be904d
+                     'driver': 'file',
be904d
+                     'filename': '$TEST_IMG.data_file'
be904d
+                 }
be904d
+             }
be904d
+         }
be904d
+     }" \
be904d
+    | _filter_qemu_io
be904d
+
be904d
+_check_test_img
be904d
+
be904d
+# success, all done
be904d
+echo "*** done"
be904d
+rm -f $seq.full
be904d
+status=0
be904d
diff --git a/tests/qemu-iotests/289.out b/tests/qemu-iotests/289.out
be904d
new file mode 100644
be904d
index 0000000000..e54e2629d4
be904d
--- /dev/null
be904d
+++ b/tests/qemu-iotests/289.out
be904d
@@ -0,0 +1,8 @@
be904d
+QA output created by 289
be904d
+
be904d
+=== Avoid freeing external data clusters on failure ===
be904d
+
be904d
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536 data_file=TEST_DIR/t.IMGFMT.data_file
be904d
+write failed: Input/output error
be904d
+No errors were found on the image.
be904d
+*** done
be904d
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
be904d
index cddae00ded..07ce9c2249 100644
be904d
--- a/tests/qemu-iotests/group
be904d
+++ b/tests/qemu-iotests/group
be904d
@@ -291,4 +291,5 @@
be904d
 280 rw migration quick
be904d
 281 rw quick
be904d
 284 rw
be904d
+289 rw quick
be904d
 291 rw quick
be904d
-- 
be904d
2.27.0
be904d