cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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