Skip to contentSkip to conversation

Improve test for qemu-img convert with backing file

PATCH Superseded Kevin Wolf 2 participants 6 messages Oct 14, 2010 – Oct 15, 2010

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 Improve test for qemu-img convert with backing file

Additionally to testing the qemu-img convert -B option, also test -o backing_file.

Also, the old test acidentlly used a pattern of zeros for most of the writes, so that the allocation test didn't really work out. This is fixed by using an explicit pattern.

---
 019 |   59 ++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 36 insertions(+), 23 deletions(-)
019 +36 -23
index 711255e..896b8d9 100755
@@ -57,10 +57,10 @@ echo
 
 for offset in $TEST_OFFSETS; do
     # Some clusters with alternating backing file/image file reads
-    io writev $(( offset )) 512 1024 64
+    io_pattern writev $(( offset )) 512 1024 64 42
 
     # Complete backing clusters
-    io writev $(( offset  + 1024 * 1024))  $CLUSTER_SIZE $CLUSTER_SIZE 1
+    io_pattern writev $(( offset  + 1024 * 1024))  $CLUSTER_SIZE $CLUSTER_SIZE 1 42
 done
 _check_test_img
 
@@ -75,39 +75,52 @@ echo
 
 for offset in $TEST_OFFSETS; do
     # Some clusters with alternating backing file/image file reads
-    io writev $(( offset + 512 )) 512 1024 64
+    io_pattern writev $(( offset + 512 )) 512 1024 64 43
 
     # Complete test image clusters
-    io writev $(( offset + 1024 * 1024 + $CLUSTER_SIZE))  $CLUSTER_SIZE $CLUSTER_SIZE 1
+    io_pattern writev $(( offset + 1024 * 1024 + $CLUSTER_SIZE))  $CLUSTER_SIZE $CLUSTER_SIZE 1 43
 done
 _check_test_img
 
 mv $TEST_IMG $TEST_IMG.orig
-$QEMU_IMG convert -O $IMGFMT -B $TEST_IMG.base $TEST_IMG.orig $TEST_IMG
 
-echo "Checking if backing clusters are allocated when they shouldn't"
-echo
-for offset in $TEST_OFFSETS; do
-    # Complete backing clusters
-    is_allocated $(( offset  + 1024 * 1024))  $CLUSTER_SIZE $CLUSTER_SIZE 1
-done
 
-echo "Reading"
-echo
 
-for offset in $TEST_OFFSETS; do
-    # Some clusters with alternating backing file/image file reads
-    io readv $(( offset )) 512 1024 64
-    io readv $(( offset + 512 )) 512 1024 64
+# Test the conversion twice: One test with the old-style -B option and another
+# one with -o backing_file
 
-    # Complete test image clusters
-    io readv $(( offset  + 1024 * 1024))  $CLUSTER_SIZE $CLUSTER_SIZE 1
-    io readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE))  $CLUSTER_SIZE $CLUSTER_SIZE 1
+for backing_option in "-B $TEST_IMG.base" "-o backing_file=$TEST_IMG.base"; do
+
+    echo
+    echo Testing conversion with $backing_option
+    echo
+    $QEMU_IMG convert -O $IMGFMT $backing_option $TEST_IMG.orig $TEST_IMG
+
+    echo "Checking if backing clusters are allocated when they shouldn't"
+    echo
+    for offset in $TEST_OFFSETS; do
+        # Complete backing clusters
+        is_allocated $(( offset  + 1024 * 1024))  $CLUSTER_SIZE $CLUSTER_SIZE 1
+    done
+
+    echo "Reading"
+    echo
+
+    for offset in $TEST_OFFSETS; do
+        # Some clusters with alternating backing file/image file reads
+        io_pattern readv $(( offset )) 512 1024 64 42
+        io_pattern readv $(( offset + 512 )) 512 1024 64 43
+
+        # Complete test image clusters
+        io_pattern readv $(( offset  + 1024 * 1024))  $CLUSTER_SIZE $CLUSTER_SIZE 1 42
+        io_pattern readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE))  $CLUSTER_SIZE $CLUSTER_SIZE 1 43
+
+        # Empty sectors
+        io_zero readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE * 4 )) $CLUSTER_SIZE $CLUSTER_SIZE 1
+    done
+    _check_test_img
 
-    # Empty sectors
-    io_zero readv $(( offset + 1024 * 1024 + $CLUSTER_SIZE * 4 )) $CLUSTER_SIZE $CLUSTER_SIZE 1
 done
-_check_test_img
 
 # success, all done
 echo "*** done"
Signature · 1 line
1.7.2.3
#1 lore raw
Quoted 11 lines · Kevin Wolf

Additionally to testing the qemu-img convert -B option, also test -o backing_file.

Also, the old test acidentlly used a pattern of zeros for most of the writes, so that the allocation test didn't really work out. This is fixed by using an explicit pattern.

---
 019 |   59 ++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 36 insertions(+), 23 deletions(-)

It's missing the update to the golden output an now fails.

Btw, did you change the qemu-img check to tell people that leaked clusters are harmless? That message causes 026 to fail for me with a recent qemu-img.

author
#2 lore raw

Am 15.10.2010 16:57, schrieb Christoph Hellwig:

Quoted 8 lines · Kevin Wolf
Quoted 7 lines

Additionally to testing the qemu-img convert -B option, also test -o backing_file.

Also, the old test acidentlly used a pattern of zeros for most of the writes, so that the allocation test didn't really work out. This is fixed by using an explicit pattern.

Quoted 6 lines
Quoted 4 lines
---
 019 |   59 ++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 36 insertions(+), 23 deletions(-)

It's missing the update to the golden output an now fails.

Oops... Will send a new version.

Quoted 3 lines

Btw, did you change the qemu-img check to tell people that leaked clusters are harmless? That message causes 026 to fail for me with a recent qemu-img.

Didn't I send a patch for qemu-iotests, too? I do have local commit updating this at least.

Kevin

#3 lore raw
Quoted 2 lines · Kevin Wolf

Didn't I send a patch for qemu-iotests, too? I do have local commit updating this at least.

If you have it around please just resend it.

author
#4 lore raw

PATCH 1/1 qemu-iotests: Update expected results after qemu-img changes

The error message for leaked clusters has changed. qemu-iotests needs to be updated to pass 026 again.

---
 026.out |  120 +++++++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 90 insertions(+), 30 deletions(-)
026.out +90 -30
index da611e5..b503cf2 100644
@@ -5,42 +5,58 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024
 
 Event: l1_update; errno: 5; imm: off; once: on; write 
 write failed: Input/output error
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l1_update; errno: 5; imm: off; once: on; write -b
 write failed: Input/output error
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l1_update; errno: 5; imm: off; once: off; write 
 write failed: Input/output error
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l1_update; errno: 5; imm: off; once: off; write -b
 write failed: Input/output error
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l1_update; errno: 28; imm: off; once: on; write 
 write failed: No space left on device
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l1_update; errno: 28; imm: off; once: on; write -b
 write failed: No space left on device
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l1_update; errno: 28; imm: off; once: off; write 
 write failed: No space left on device
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l1_update; errno: 28; imm: off; once: off; write -b
 write failed: No space left on device
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_load; errno: 5; imm: off; once: on; write 
@@ -109,42 +125,58 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024
 
 Event: l2_update; errno: 5; imm: off; once: on; write 
 write failed: Input/output error
-128 errors were found on the image.
+
+128 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_update; errno: 5; imm: off; once: on; write -b
 write failed: Input/output error
-128 errors were found on the image.
+
+128 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_update; errno: 5; imm: off; once: off; write 
 write failed: Input/output error
-128 errors were found on the image.
+
+128 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_update; errno: 5; imm: off; once: off; write -b
 write failed: Input/output error
-128 errors were found on the image.
+
+128 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_update; errno: 28; imm: off; once: on; write 
 write failed: No space left on device
-128 errors were found on the image.
+
+128 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_update; errno: 28; imm: off; once: on; write -b
 write failed: No space left on device
-128 errors were found on the image.
+
+128 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_update; errno: 28; imm: off; once: off; write 
 write failed: No space left on device
-128 errors were found on the image.
+
+128 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_update; errno: 28; imm: off; once: off; write -b
 write failed: No space left on device
-128 errors were found on the image.
+
+128 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_alloc.write; errno: 5; imm: off; once: on; write 
@@ -154,7 +186,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024
 
 Event: l2_alloc.write; errno: 5; imm: off; once: on; write -b
 write failed: Input/output error
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_alloc.write; errno: 5; imm: off; once: off; write 
@@ -164,7 +198,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024
 
 Event: l2_alloc.write; errno: 5; imm: off; once: off; write -b
 write failed: Input/output error
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_alloc.write; errno: 28; imm: off; once: on; write 
@@ -174,7 +210,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024
 
 Event: l2_alloc.write; errno: 28; imm: off; once: on; write -b
 write failed: No space left on device
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l2_alloc.write; errno: 28; imm: off; once: off; write 
@@ -184,7 +222,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024
 
 Event: l2_alloc.write; errno: 28; imm: off; once: off; write -b
 write failed: No space left on device
-1 errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: write_aio; errno: 5; imm: off; once: on; write 
@@ -402,12 +442,16 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=512
 
 Event: refblock_alloc.hookup; errno: 28; imm: off; once: off; write 
 write failed: No space left on device
-55 errors were found on the image.
+
+55 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=512 
 
 Event: refblock_alloc.hookup; errno: 28; imm: off; once: off; write -b
 write failed: No space left on device
-251 errors were found on the image.
+
+251 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=512 
 
 Event: refblock_alloc.write; errno: 28; imm: off; once: on; write 
@@ -442,12 +486,16 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=512
 
 Event: refblock_alloc.write_blocks; errno: 28; imm: off; once: off; write 
 write failed: No space left on device
-10 errors were found on the image.
+
+10 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=512 
 
 Event: refblock_alloc.write_blocks; errno: 28; imm: off; once: off; write -b
 write failed: No space left on device
-23 errors were found on the image.
+
+23 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=512 
 
 Event: refblock_alloc.write_table; errno: 28; imm: off; once: on; write 
@@ -462,12 +510,16 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=512
 
 Event: refblock_alloc.write_table; errno: 28; imm: off; once: off; write 
 write failed: No space left on device
-10 errors were found on the image.
+
+10 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=512 
 
 Event: refblock_alloc.write_table; errno: 28; imm: off; once: off; write -b
 write failed: No space left on device
-23 errors were found on the image.
+
+23 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=512 
 
 Event: refblock_alloc.switch_table; errno: 28; imm: off; once: on; write 
@@ -482,12 +534,16 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=512
 
 Event: refblock_alloc.switch_table; errno: 28; imm: off; once: off; write 
 write failed: No space left on device
-10 errors were found on the image.
+
+10 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=512 
 
 Event: refblock_alloc.switch_table; errno: 28; imm: off; once: off; write -b
 write failed: No space left on device
-23 errors were found on the image.
+
+23 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 
 === L1 growth tests ===
 
@@ -543,7 +599,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024
 Event: l1_grow.activate_table; errno: 5; imm: off; once: off
 qcow2_free_clusters failed: Input/output error
 write failed: Input/output error
-96 errors were found on the image.
+
+96 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024 
 
 Event: l1_grow.activate_table; errno: 28; imm: off; once: on
@@ -554,5 +612,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 cluster_size=1024
 Event: l1_grow.activate_table; errno: 28; imm: off; once: off
 qcow2_free_clusters failed: No space left on device
 write failed: No space left on device
-96 errors were found on the image.
+
+96 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 *** done
Signature · 1 line
1.7.2.3
#5 lore raw

[Qemu-devel] Re: [PATCH] qemu-iotests: Update expected results after qemu-img changes

Quoted 2 lines · Kevin Wolf

The error message for leaked clusters has changed. qemu-iotests needs to be updated to pass 026 again.

Thanks, applied!