qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

iotests: Split 177 into two parts for compat=0.10

When originally written, test 177 explicitly took care to run
with compat=0.10. Then I botched my own test in commit
81c219ac and f0a9c18f, by adding additional actions that require
v3 images. Split out the new code into a new v3-only test, 204,
and revert 177 back to its original state other than a new comment.

Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-id: 20180117165420.15946-2-eblake@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>

authored by

Eric Blake and committed by
Max Reitz
d6ac6e93 2291712c

+193 -32
+6 -14
tests/qemu-iotests/177
··· 2 2 # 3 3 # Test corner cases with unusual block geometries 4 4 # 5 - # Copyright (C) 2016-2017 Red Hat, Inc. 5 + # Copyright (C) 2016-2018 Red Hat, Inc. 6 6 # 7 7 # This program is free software; you can redistribute it and/or modify 8 8 # it under the terms of the GNU General Public License as published by ··· 36 36 # get standard environment, filters and checks 37 37 . ./common.rc 38 38 . ./common.filter 39 + 40 + # This test is runnable under compat=0.10; see test 204 for additional 41 + # tests specific to compat=1.1. 39 42 40 43 _supported_fmt qcow2 41 44 _supported_proto file ··· 43 46 CLUSTER_SIZE=1M 44 47 size=128M 45 48 options=driver=blkdebug,image.driver=qcow2 46 - nested_opts=image.file.driver=file,image.file.filename=$TEST_IMG 47 49 48 50 echo 49 51 echo "== setting up files ==" ··· 51 53 TEST_IMG="$TEST_IMG.base" _make_test_img $size 52 54 $QEMU_IO -c "write -P 11 0 $size" "$TEST_IMG.base" | _filter_qemu_io 53 55 _make_test_img -b "$TEST_IMG.base" 54 - $QEMU_IO -c "write -P 22 0 110M" "$TEST_IMG" | _filter_qemu_io 56 + $QEMU_IO -c "write -P 22 0 $size" "$TEST_IMG" | _filter_qemu_io 55 57 56 58 # Limited to 64k max-transfer 57 59 echo ··· 82 84 -c "discard 80000001 30M" | _filter_qemu_io 83 85 84 86 echo 85 - echo "== block status smaller than alignment ==" 86 - limits=align=4k 87 - $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \ 88 - -c "alloc 1 1" -c "alloc 0x6dffff0 1000" -c "alloc 127m 5P" \ 89 - -c map | _filter_qemu_io 90 - 91 - echo 92 87 echo "== verify image content ==" 93 88 94 89 function verify_io() ··· 110 105 echo read -P 0 32M 32M 111 106 echo read -P 22 64M 13M 112 107 echo read -P $discarded 77M 29M 113 - echo read -P 22 106M 4M 114 - echo read -P 11 110M 18M 108 + echo read -P 22 106M 22M 115 109 } 116 110 117 111 verify_io | $QEMU_IO -r "$TEST_IMG" | _filter_qemu_io 118 - $QEMU_IMG map --image-opts "$options,$nested_opts,align=4k" \ 119 - | _filter_qemu_img_map 120 112 121 113 _check_test_img 122 114
+4 -18
tests/qemu-iotests/177.out
··· 5 5 wrote 134217728/134217728 bytes at offset 0 6 6 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 7 7 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/t.IMGFMT.base 8 - wrote 115343360/115343360 bytes at offset 0 9 - 110 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 8 + wrote 134217728/134217728 bytes at offset 0 9 + 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 10 10 11 11 == constrained alignment and max-transfer == 12 12 wrote 131072/131072 bytes at offset 1000 ··· 25 25 == non-power-of-2 discard limits == 26 26 discard 31457280/31457280 bytes at offset 80000001 27 27 30 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 28 - 29 - == block status smaller than alignment == 30 - 1/1 bytes allocated at offset 1 bytes 31 - 16/1000 bytes allocated at offset 110 MiB 32 - 0/1048576 bytes allocated at offset 127 MiB 33 - 110 MiB (0x6e00000) bytes allocated at offset 0 bytes (0x0) 34 - 18 MiB (0x1200000) bytes not allocated at offset 110 MiB (0x6e00000) 35 28 36 29 == verify image content == 37 30 read 1000/1000 bytes at offset 0 ··· 50 43 13 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 51 44 read 30408704/30408704 bytes at offset 80740352 52 45 29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 53 - read 4194304/4194304 bytes at offset 111149056 54 - 4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 55 - read 18874368/18874368 bytes at offset 115343360 56 - 18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 57 - Offset Length File 58 - 0 0x800000 TEST_DIR/t.IMGFMT 59 - 0x900000 0x2400000 TEST_DIR/t.IMGFMT 60 - 0x3c00000 0x1100000 TEST_DIR/t.IMGFMT 61 - 0x6a00000 0x400000 TEST_DIR/t.IMGFMT 46 + read 23068672/23068672 bytes at offset 111149056 47 + 22 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 62 48 No errors were found on the image. 63 49 *** done
+119
tests/qemu-iotests/204
··· 1 + #!/bin/bash 2 + # 3 + # Test corner cases with unusual block geometries 4 + # 5 + # Copyright (C) 2016-2018 Red Hat, Inc. 6 + # 7 + # This program is free software; you can redistribute it and/or modify 8 + # it under the terms of the GNU General Public License as published by 9 + # the Free Software Foundation; either version 2 of the License, or 10 + # (at your option) any later version. 11 + # 12 + # This program is distributed in the hope that it will be useful, 13 + # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + # GNU General Public License for more details. 16 + # 17 + # You should have received a copy of the GNU General Public License 18 + # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 + # 20 + 21 + # creator 22 + owner=eblake@redhat.com 23 + 24 + seq=`basename $0` 25 + echo "QA output created by $seq" 26 + 27 + here=`pwd` 28 + status=1 # failure is the default! 29 + 30 + _cleanup() 31 + { 32 + _cleanup_test_img 33 + } 34 + trap "_cleanup; exit \$status" 0 1 2 3 15 35 + 36 + # get standard environment, filters and checks 37 + . ./common.rc 38 + . ./common.filter 39 + 40 + _supported_fmt qcow2 41 + _supported_proto file 42 + # This test assumes that discard leaves zero clusters; see test 177 for 43 + # other tests that also work in older images 44 + _unsupported_imgopts 'compat=0.10' 45 + 46 + CLUSTER_SIZE=1M 47 + size=128M 48 + options=driver=blkdebug,image.driver=qcow2 49 + nested_opts=image.file.driver=file,image.file.filename=$TEST_IMG 50 + 51 + echo 52 + echo "== setting up files ==" 53 + 54 + TEST_IMG="$TEST_IMG.base" _make_test_img $size 55 + $QEMU_IO -c "write -P 11 0 $size" "$TEST_IMG.base" | _filter_qemu_io 56 + _make_test_img -b "$TEST_IMG.base" 57 + $QEMU_IO -c "write -P 22 0 110M" "$TEST_IMG" | _filter_qemu_io 58 + 59 + # Limited to 64k max-transfer 60 + echo 61 + echo "== constrained alignment and max-transfer ==" 62 + limits=align=4k,max-transfer=64k 63 + $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \ 64 + -c "write -P 33 1000 128k" -c "read -P 33 1000 128k" | _filter_qemu_io 65 + 66 + echo 67 + echo "== write zero with constrained max-transfer ==" 68 + limits=align=512,max-transfer=64k,opt-write-zero=$CLUSTER_SIZE 69 + $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \ 70 + -c "write -z 8003584 2093056" | _filter_qemu_io 71 + 72 + # non-power-of-2 write-zero/discard alignments 73 + echo 74 + echo "== non-power-of-2 write zeroes limits ==" 75 + 76 + limits=align=512,opt-write-zero=15M,max-write-zero=15M,opt-discard=15M,max-discard=15M 77 + $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \ 78 + -c "write -z 32M 32M" | _filter_qemu_io 79 + 80 + echo 81 + echo "== non-power-of-2 discard limits ==" 82 + 83 + limits=align=512,opt-write-zero=15M,max-write-zero=15M,opt-discard=15M,max-discard=15M 84 + $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \ 85 + -c "discard 80000001 30M" | _filter_qemu_io 86 + 87 + echo 88 + echo "== block status smaller than alignment ==" 89 + limits=align=4k 90 + $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \ 91 + -c "alloc 1 1" -c "alloc 0x6dffff0 1000" -c "alloc 127m 5P" \ 92 + -c map | _filter_qemu_io 93 + 94 + echo 95 + echo "== verify image content ==" 96 + 97 + function verify_io() 98 + { 99 + echo read -P 22 0 1000 100 + echo read -P 33 1000 128k 101 + echo read -P 22 132072 7871512 102 + echo read -P 0 8003584 2093056 103 + echo read -P 22 10096640 23457792 104 + echo read -P 0 32M 32M 105 + echo read -P 22 64M 13M 106 + echo read -P 0 77M 29M 107 + echo read -P 22 106M 4M 108 + echo read -P 11 110M 18M 109 + } 110 + 111 + verify_io | $QEMU_IO -r "$TEST_IMG" | _filter_qemu_io 112 + $QEMU_IMG map --image-opts "$options,$nested_opts,align=4k" \ 113 + | _filter_qemu_img_map 114 + 115 + _check_test_img 116 + 117 + # success, all done 118 + echo "*** done" 119 + status=0
+63
tests/qemu-iotests/204.out
··· 1 + QA output created by 204 2 + 3 + == setting up files == 4 + Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728 5 + wrote 134217728/134217728 bytes at offset 0 6 + 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 7 + Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/t.IMGFMT.base 8 + wrote 115343360/115343360 bytes at offset 0 9 + 110 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 10 + 11 + == constrained alignment and max-transfer == 12 + wrote 131072/131072 bytes at offset 1000 13 + 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 14 + read 131072/131072 bytes at offset 1000 15 + 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 16 + 17 + == write zero with constrained max-transfer == 18 + wrote 2093056/2093056 bytes at offset 8003584 19 + 1.996 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 20 + 21 + == non-power-of-2 write zeroes limits == 22 + wrote 33554432/33554432 bytes at offset 33554432 23 + 32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 24 + 25 + == non-power-of-2 discard limits == 26 + discard 31457280/31457280 bytes at offset 80000001 27 + 30 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 28 + 29 + == block status smaller than alignment == 30 + 1/1 bytes allocated at offset 1 bytes 31 + 16/1000 bytes allocated at offset 110 MiB 32 + 0/1048576 bytes allocated at offset 127 MiB 33 + 110 MiB (0x6e00000) bytes allocated at offset 0 bytes (0x0) 34 + 18 MiB (0x1200000) bytes not allocated at offset 110 MiB (0x6e00000) 35 + 36 + == verify image content == 37 + read 1000/1000 bytes at offset 0 38 + 1000 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 39 + read 131072/131072 bytes at offset 1000 40 + 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 41 + read 7871512/7871512 bytes at offset 132072 42 + 7.507 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 43 + read 2093056/2093056 bytes at offset 8003584 44 + 1.996 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 45 + read 23457792/23457792 bytes at offset 10096640 46 + 22.371 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 47 + read 33554432/33554432 bytes at offset 33554432 48 + 32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 49 + read 13631488/13631488 bytes at offset 67108864 50 + 13 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 51 + read 30408704/30408704 bytes at offset 80740352 52 + 29 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 53 + read 4194304/4194304 bytes at offset 111149056 54 + 4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 55 + read 18874368/18874368 bytes at offset 115343360 56 + 18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 57 + Offset Length File 58 + 0 0x800000 TEST_DIR/t.IMGFMT 59 + 0x900000 0x2400000 TEST_DIR/t.IMGFMT 60 + 0x3c00000 0x1100000 TEST_DIR/t.IMGFMT 61 + 0x6a00000 0x400000 TEST_DIR/t.IMGFMT 62 + No errors were found on the image. 63 + *** done
+1
tests/qemu-iotests/group
··· 200 200 201 rw auto migration 201 201 202 rw auto quick 202 202 203 rw auto 203 + 204 rw auto quick