Patchwork [PATCHv2,07/18] qemu-iotests: fix test 019 to work with any protocol

login
register
mail settings
Submitter Peter Lieven
Date Jan. 5, 2014, 5:21 p.m.
Message ID <1388942528-10453-8-git-send-email-pl@kamp.de>
Download mbox | patch
Permalink /patch/306995/
State New
Headers show

Comments

Peter Lieven - Jan. 5, 2014, 5:21 p.m.
Signed-off-by: Peter Lieven <pl@kamp.de>
---
 tests/qemu-iotests/019     |   30 ++++++++++++++----------------
 tests/qemu-iotests/019.out |    4 ++--
 2 files changed, 16 insertions(+), 18 deletions(-)

Patch

diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019
index d75d125..5638611 100755
--- a/tests/qemu-iotests/019
+++ b/tests/qemu-iotests/019
@@ -32,9 +32,11 @@  status=1	# failure is the default!
 
 _cleanup()
 {
-	_cleanup_test_img
-    rm -f "$TEST_IMG.base"
-    rm -f "$TEST_IMG.orig"
+    _cleanup_test_img
+    if [ "$IMGPROTO" = "file" ]; then
+        rm -f "$TEST_IMG.base"
+        rm -f "$TEST_IMG.orig"
+    fi
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
@@ -45,46 +47,42 @@  trap "_cleanup; exit \$status" 0 1 2 3 15
 
 # Any format supporting backing files
 _supported_fmt qcow qcow2 vmdk qed
-_supported_proto file
+_supported_proto generic
 _supported_os Linux
 
 TEST_OFFSETS="0 4294967296"
 CLUSTER_SIZE=65536
 
-_make_test_img 6G
+TEST_IMG=$TEST_IMG.base _make_test_img 6G
 
 echo "Filling base image"
 echo
 
 for offset in $TEST_OFFSETS; do
     # Some clusters with alternating backing file/image file reads
-    io_pattern writev $(( offset )) 512 1024 64 42
+    TEST_IMG=$TEST_IMG.base io_pattern writev $(( offset )) 512 1024 64 42
 
     # Complete backing clusters
-    io_pattern writev $(( offset  + 1024 * 1024))  $CLUSTER_SIZE $CLUSTER_SIZE 1 42
+    TEST_IMG=$TEST_IMG.base io_pattern writev $(( offset  + 1024 * 1024))  $CLUSTER_SIZE $CLUSTER_SIZE 1 42
 done
-_check_test_img
+TEST_IMG=$TEST_IMG.base _check_test_img
 
 echo "Creating test image with backing file"
 echo
 
-mv "$TEST_IMG" "$TEST_IMG.base"
-_make_test_img -b "$TEST_IMG.base" 6G
+TEST_IMG=$TEST_IMG.orig _make_test_img -b "$TEST_IMG.base" 6G
 
 echo "Filling test image"
 echo
 
 for offset in $TEST_OFFSETS; do
     # Some clusters with alternating backing file/image file reads
-    io_pattern writev $(( offset + 512 )) 512 1024 64 43
+    TEST_IMG=$TEST_IMG.orig io_pattern writev $(( offset + 512 )) 512 1024 64 43
 
     # Complete test image clusters
-    io_pattern writev $(( offset + 1024 * 1024 + $CLUSTER_SIZE))  $CLUSTER_SIZE $CLUSTER_SIZE 1 43
+    TEST_IMG=$TEST_IMG.orig io_pattern writev $(( offset + 1024 * 1024 + $CLUSTER_SIZE))  $CLUSTER_SIZE $CLUSTER_SIZE 1 43
 done
-_check_test_img
-
-mv "$TEST_IMG" "$TEST_IMG.orig"
-
+TEST_IMG=$TEST_IMG.orig _check_test_img
 
 
 # Test the conversion twice: One test with the old-style -B option and another
diff --git a/tests/qemu-iotests/019.out b/tests/qemu-iotests/019.out
index f0c6e63..f2c3da3 100644
--- a/tests/qemu-iotests/019.out
+++ b/tests/qemu-iotests/019.out
@@ -1,5 +1,5 @@ 
 QA output created by 019
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=6442450944 
 Filling base image
 
 === IO: pattern 42
@@ -269,7 +269,7 @@  wrote 65536/65536 bytes at offset 4296015872
 No errors were found on the image.
 Creating test image with backing file
 
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 backing_file='TEST_DIR/t.IMGFMT.base' 
+Formatting 'TEST_DIR/t.IMGFMT.orig', fmt=IMGFMT size=6442450944 backing_file='TEST_DIR/t.IMGFMT.base' 
 Filling test image
 
 === IO: pattern 43