Skip to contentSkip to conversation

iotests: Clean up "mv $TEST_IMG $TEST_IMG.XXX"

PATCH Superseded Fam Zheng 2 participants 14 messages Dec 16, 2015 – Dec 22, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

cover iotests: Clean up "mv $TEST_IMG $TEST_IMG.XXX"

Commit 794d00f71d fixed two "mv" commands into the TEST_IMG override approach. There are still more occasions of "mv", this series fixes them.

The benefit is it drops the assumption that the created image is a single file, which is not true for VMDK or the coming QBM format. On top of this, those formats can be added to these cases later.

The patches stems from QBM work, but I will also take a look at adding applicable VMDK subformats once merged.

Please review.

Fam

Fam Zheng (10):
iotests: 018: Use TEST_IMG override instead of "mv"
iotests: 019: Use TEST_IMG override instead of "mv"
iotests: 020: Use TEST_IMG override instead of "mv"
iotests: 024: Use TEST_IMG override instead of "mv"
iotests: 028: Use TEST_IMG override instead of "mv"
iotests: 034: Use TEST_IMG override instead of "mv"
iotests: 037: Use TEST_IMG override instead of "mv"
iotests: 038: Use TEST_IMG override instead of "mv"
iotests: 050: Use TEST_IMG override instead of "mv"
iotests: 095: Use TEST_IMG override instead of "mv"

 tests/qemu-iotests/018     |  8 ++++----
 tests/qemu-iotests/018.out |  2 +-
 tests/qemu-iotests/019     | 13 +++++++------
 tests/qemu-iotests/019.out |  4 ++--
 tests/qemu-iotests/020     |  7 +++++--
 tests/qemu-iotests/020.out |  2 +-
 tests/qemu-iotests/024     | 10 ++++++++--
 tests/qemu-iotests/024.out |  4 ++--
 tests/qemu-iotests/028     |  5 ++++-
 tests/qemu-iotests/028.out |  2 +-
 tests/qemu-iotests/034     |  6 +++++-
 tests/qemu-iotests/034.out |  2 +-
 tests/qemu-iotests/037     |  5 ++++-
 tests/qemu-iotests/037.out |  2 +-
 tests/qemu-iotests/038     |  5 ++++-
 tests/qemu-iotests/038.out |  2 +-
 tests/qemu-iotests/050     |  9 +++++++--
 tests/qemu-iotests/050.out |  4 ++--
 tests/qemu-iotests/095     | 12 ++++++------
 tests/qemu-iotests/095.out |  8 ++++----
 20 files changed, 70 insertions(+), 42 deletions(-)
Signature · 1 line
2.4.3
author
#1 lore raw

PATCH 1/10 iotests: 018: Use TEST_IMG override instead of "mv"

---
 tests/qemu-iotests/018     | 8 ++++----
 tests/qemu-iotests/018.out | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
tests/qemu-iotests/018 +4 -4
index d8a7d43..07b2de9 100755
@@ -66,8 +66,8 @@ _check_test_img
 echo "Creating test image with backing file"
 echo
 
-TEST_IMG=$TEST_IMG_SAVE
-_make_test_img -b "$TEST_IMG.base" 6G
+TEST_IMG="$TEST_IMG_SAVE.orig"
+_make_test_img -b "$TEST_IMG_SAVE.base" 6G
 
 echo "Filling test image"
 echo
@@ -81,8 +81,8 @@ for offset in $TEST_OFFSETS; do
 done
 _check_test_img
 
-mv "$TEST_IMG" "$TEST_IMG.orig"
-$QEMU_IMG convert -O $IMGFMT "$TEST_IMG.orig" "$TEST_IMG"
+TEST_IMG="$TEST_IMG_SAVE"
+$QEMU_IMG convert -f $IMGFMT -O $IMGFMT "$TEST_IMG.orig" "$TEST_IMG"
 
 echo "Reading"
 echo
tests/qemu-iotests/018.out +1 -1
index d66bd63..5df9667 100644
@@ -269,7 +269,7 @@ wrote 65536/65536 bytes at offset 4295032832
 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 1
Signature · 1 line
2.4.3
author
#2 lore raw

PATCH 2/10 iotests: 019: Use TEST_IMG override instead of "mv"

In reply to Fam Zheng
---
 tests/qemu-iotests/019     | 13 +++++++------
 tests/qemu-iotests/019.out |  4 ++--
 2 files changed, 9 insertions(+), 8 deletions(-)
tests/qemu-iotests/019 +7 -6
index f5ecbf5..0937b5c 100755
@@ -54,6 +54,9 @@ _unsupported_imgopts "subformat=monolithicFlat" \
 TEST_OFFSETS="0 4294967296"
 CLUSTER_SIZE=65536
 
+TEST_IMG_SAVE="$TEST_IMG"
+TEST_IMG="$TEST_IMG.base"
+
 _make_test_img 6G
 
 echo "Filling base image"
@@ -71,8 +74,8 @@ _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_SAVE.orig"
+_make_test_img -b "$TEST_IMG_SAVE.base" 6G
 
 echo "Filling test image"
 echo
@@ -86,9 +89,7 @@ for offset in $TEST_OFFSETS; do
 done
 _check_test_img
 
-mv "$TEST_IMG" "$TEST_IMG.orig"
-
-
+TEST_IMG="$TEST_IMG_SAVE"
 
 # Test the conversion twice: One test with the old-style -B option and another
 # one with -o backing_file
@@ -98,7 +99,7 @@ for backing_option in "-B " "-o backing_file="; do
     echo
     echo Testing conversion with $backing_option"$TEST_IMG.base" | _filter_testdir | _filter_imgfmt
     echo
-    $QEMU_IMG convert -O $IMGFMT $backing_option"$TEST_IMG.base" "$TEST_IMG.orig" "$TEST_IMG"
+    $QEMU_IMG convert -f $IMGFMT -O $IMGFMT $backing_option"$TEST_IMG.base" "$TEST_IMG.orig" "$TEST_IMG"
 
     echo "Checking if backing clusters are allocated when they shouldn't"
     echo
tests/qemu-iotests/019.out +2 -2
index 615450a..0124264 100644
@@ -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
Signature · 1 line
2.4.3
author
#3 lore raw

PATCH 3/10 iotests: 020: Use TEST_IMG override instead of "mv"

In reply to Fam Zheng
---
 tests/qemu-iotests/020     | 7 +++++--
 tests/qemu-iotests/020.out | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
tests/qemu-iotests/020 +5 -2
index 2f258dc..6625b55 100755
@@ -56,6 +56,9 @@ fi
 
 TEST_OFFSETS="0 4294967296"
 
+TEST_IMG_SAVE="$TEST_IMG"
+TEST_IMG="$TEST_IMG.base"
+
 _make_test_img 6G
 
 echo "Filling base image"
@@ -73,7 +76,7 @@ _check_test_img
 echo "Creating test image with backing file"
 echo
 
-mv "$TEST_IMG" "$TEST_IMG.base"
+TEST_IMG="$TEST_IMG_SAVE"
 _make_test_img -b "$TEST_IMG.base" 6G
 
 echo "Filling test image"
@@ -89,7 +92,7 @@ done
 _check_test_img
 
 $QEMU_IMG commit "$TEST_IMG"
-mv "$TEST_IMG.base" "$TEST_IMG"
+TEST_IMG="$TEST_IMG.base"
 
 echo "Reading from the backing file"
 echo
tests/qemu-iotests/020.out +1 -1
index 134aa29..42f6c1b 100644
@@ -1,5 +1,5 @@
 QA output created by 020
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=6442450944
 Filling base image
 
 === IO: pattern 0
Signature · 1 line
2.4.3
author
#4 lore raw

PATCH 4/10 iotests: 024: Use TEST_IMG override instead of "mv"

In reply to Fam Zheng
---
 tests/qemu-iotests/024     | 10 ++++++++--
 tests/qemu-iotests/024.out |  4 ++--
 2 files changed, 10 insertions(+), 4 deletions(-)
tests/qemu-iotests/024 +8 -2
index 9bf99e1..2c2d148 100755
@@ -60,16 +60,22 @@ CLUSTER_SIZE=65536
 echo "Creating backing file"
 echo
 
+TEST_IMG_SAVE="$TEST_IMG"
+TEST_IMG="$TEST_IMG.base_old"
+
 _make_test_img 1G
 io_pattern writev 0 $CLUSTER_SIZE $((2 * CLUSTER_SIZE)) 8 0x11
-mv "$TEST_IMG" "$TEST_IMG.base_old"
+
+TEST_IMG="$TEST_IMG_SAVE.base_new"
 
 echo "Creating new backing file"
 echo
 
 _make_test_img 1G
 io_pattern writev 0 $((2 * CLUSTER_SIZE)) $((4 * CLUSTER_SIZE)) 4 0x22
-mv "$TEST_IMG" "$TEST_IMG.base_new"
+
+
+TEST_IMG="$TEST_IMG_SAVE"
 
 echo "Creating COW image"
 echo
tests/qemu-iotests/024.out +2 -2
index 9b9ef3a..33cfaf5 100644
@@ -1,7 +1,7 @@
 QA output created by 024
 Creating backing file
 
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
+Formatting 'TEST_DIR/t.IMGFMT.base_old', fmt=IMGFMT size=1073741824
 === IO: pattern 0x11
 wrote 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -21,7 +21,7 @@ wrote 65536/65536 bytes at offset 917504
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Creating new backing file
 
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
+Formatting 'TEST_DIR/t.IMGFMT.base_new', fmt=IMGFMT size=1073741824
 === IO: pattern 0x22
 wrote 131072/131072 bytes at offset 0
 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Signature · 1 line
2.4.3
author
#5 lore raw

PATCH 5/10 iotests: 028: Use TEST_IMG override instead of "mv"

In reply to Fam Zheng
---
 tests/qemu-iotests/028     | 5 ++++-
 tests/qemu-iotests/028.out | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
tests/qemu-iotests/028 +4 -1
index a1f4423..009510d 100755
@@ -60,6 +60,9 @@ base_size=$(( image_size - 1024 * 1024 * 1024 ))
 
 offset=$(( base_size - 32 * 1024 ))
 
+TEST_IMG_SAVE="$TEST_IMG"
+TEST_IMG="$TEST_IMG.base"
+
 _make_test_img $base_size
 
 echo "Filling base image"
@@ -73,7 +76,7 @@ _check_test_img
 echo "Creating test image with backing file"
 echo
 
-mv "$TEST_IMG" "$TEST_IMG.base"
+TEST_IMG="$TEST_IMG_SAVE"
 _make_test_img -b "$TEST_IMG.base" $image_size
 
 echo "Filling test image"
tests/qemu-iotests/028.out +1 -1
index 29c9972..279029d 100644
@@ -1,5 +1,5 @@
 QA output created by 028
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=3221227008
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=3221227008
 Filling base image
 
 === IO: pattern 195
Signature · 1 line
2.4.3
author
#6 lore raw

PATCH 6/10 iotests: 034: Use TEST_IMG override instead of "mv"

In reply to Fam Zheng
---
 tests/qemu-iotests/034     | 6 +++++-
 tests/qemu-iotests/034.out | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
tests/qemu-iotests/034 +5 -1
index 69c7858..c769dd8 100755
@@ -51,9 +51,13 @@ size=128M
 echo
 echo "== creating backing file for COW tests =="
 
+TEST_IMG_SAVE="$TEST_IMG"
+TEST_IMG="$TEST_IMG.base"
+
 _make_test_img $size
 $QEMU_IO -c "write -P 0x55 0 1M" "$TEST_IMG" | _filter_qemu_io
-mv "$TEST_IMG" "$TEST_IMG.base"
+
+TEST_IMG="$TEST_IMG_SAVE"
 
 _make_test_img -b "$TEST_IMG.base" 6G
 
tests/qemu-iotests/034.out +1 -1
index 34fda80..0764ead 100644
@@ -1,7 +1,7 @@
 QA output created by 034
 
 == creating backing file for COW tests ==
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728
 wrote 1048576/1048576 bytes at offset 0
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=6442450944 backing_file=TEST_DIR/t.IMGFMT.base
Signature · 1 line
2.4.3
author
#7 lore raw

PATCH 7/10 iotests: 037: Use TEST_IMG override instead of "mv"

In reply to Fam Zheng
---
 tests/qemu-iotests/037     | 5 ++++-
 tests/qemu-iotests/037.out | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
tests/qemu-iotests/037 +4 -1
index 9171d8c..5862451 100755
@@ -51,6 +51,9 @@ size=128M
 echo
 echo "== creating backing file for COW tests =="
 
+TEST_IMG_SAVE="$TEST_IMG"
+TEST_IMG="$TEST_IMG.base"
+
 _make_test_img $size
 
 function backing_io()
@@ -71,7 +74,7 @@ function backing_io()
 
 backing_io 0 256 write | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
 
-mv "$TEST_IMG" "$TEST_IMG.base"
+TEST_IMG="$TEST_IMG_SAVE"
 
 _make_test_img -b "$TEST_IMG.base" 6G
 
tests/qemu-iotests/037.out +1 -1
index 55b30fd..cd6710c 100644
@@ -1,7 +1,7 @@
 QA output created by 037
 
 == creating backing file for COW tests ==
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 512/512 bytes at offset 512
Signature · 1 line
2.4.3
author
#8 lore raw

PATCH 8/10 iotests: 038: Use TEST_IMG override instead of "mv"

In reply to Fam Zheng
---
 tests/qemu-iotests/038     | 5 ++++-
 tests/qemu-iotests/038.out | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
tests/qemu-iotests/038 +4 -1
index cfaf00a..34fe698 100755
@@ -48,6 +48,9 @@ size=128M
 echo
 echo "== creating backing file for COW tests =="
 
+TEST_IMG_SAVE="$TEST_IMG"
+TEST_IMG="$TEST_IMG.base"
+
 _make_test_img $size
 
 function backing_io()
@@ -68,7 +71,7 @@ function backing_io()
 
 backing_io 0 256 write | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
 
-mv "$TEST_IMG" "$TEST_IMG.base"
+TEST_IMG="$TEST_IMG_SAVE"
 
 _make_test_img -b "$TEST_IMG.base" 6G
 
tests/qemu-iotests/038.out +1 -1
index ecb656e..0bdfb19 100644
@@ -1,7 +1,7 @@
 QA output created by 038
 
 == creating backing file for COW tests ==
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728
 wrote 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 65536/65536 bytes at offset 65536
Signature · 1 line
2.4.3
author
#9 lore raw

PATCH 9/10 iotests: 050: Use TEST_IMG override instead of "mv"

In reply to Fam Zheng
---
 tests/qemu-iotests/050     | 9 +++++++--
 tests/qemu-iotests/050.out | 4 ++--
 2 files changed, 9 insertions(+), 4 deletions(-)
tests/qemu-iotests/050 +7 -2
index 07802bc..13006dd 100755
@@ -51,14 +51,19 @@ fi
 echo
 echo "== Creating images =="
 
+TEST_IMG_SAVE="$TEST_IMG"
+TEST_IMG="$TEST_IMG.old"
+
 size=10M
 _make_test_img $size
 $QEMU_IO -c "write -P 0x40 0 1048576" "$TEST_IMG" | _filter_qemu_io
-mv "$TEST_IMG" "$TEST_IMG.old"
+
+TEST_IMG="$TEST_IMG_SAVE.new"
 
 _make_test_img $size
 $QEMU_IO -c "write -P 0x5a 0 1048576" "$TEST_IMG" | _filter_qemu_io
-mv "$TEST_IMG" "$TEST_IMG.new"
+
+TEST_IMG="$TEST_IMG_SAVE"
 
 _make_test_img -b "$TEST_IMG.old" $size
 $QEMU_IO -c "write -z 0 1048576" "$TEST_IMG" | _filter_qemu_io
tests/qemu-iotests/050.out +2 -2
index 397cf7f..3602d58 100644
@@ -1,10 +1,10 @@
 QA output created by 050
 
 == Creating images ==
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=10485760
+Formatting 'TEST_DIR/t.IMGFMT.old', fmt=IMGFMT size=10485760
 wrote 1048576/1048576 bytes at offset 0
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=10485760
+Formatting 'TEST_DIR/t.IMGFMT.new', fmt=IMGFMT size=10485760
 wrote 1048576/1048576 bytes at offset 0
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=10485760 backing_file=TEST_DIR/t.IMGFMT.old
Signature · 1 line
2.4.3
author
#10 lore raw

PATCH 10/10 iotests: 095: Use TEST_IMG override instead of "mv"

In reply to Fam Zheng
---
 tests/qemu-iotests/095     | 12 ++++++------
 tests/qemu-iotests/095.out |  8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)
tests/qemu-iotests/095 +6 -6
index 6630181..cbe61bc 100755
@@ -50,17 +50,16 @@ _supported_os Linux
 size_smaller=5M
 size_larger=100M
 
-_make_test_img $size_smaller
-mv "${TEST_IMG}" "${TEST_IMG}.base"
+TEST_IMG="$TEST_IMG.base _make_test_img $size_smaller"
 
-_make_test_img -b "${TEST_IMG}.base" $size_larger
-mv "${TEST_IMG}" "${TEST_IMG}.snp1"
+TEST_IMG="$TEST_IMG.snp1 _make_test_img -b "${TEST_IMG}.base" $size_larger"
 
 _make_test_img -b "${TEST_IMG}.snp1" $size_larger
 
 echo
 echo "=== Base image info before commit and resize ==="
-TEST_IMG="${TEST_IMG}.base" _img_info
+TEST_IMG="${TEST_IMG}.base" _img_info | \
+    sed -e 's/^cluster_size: .*$/cluster_size: XXX/'
 
 echo
 echo === Running QEMU Live Commit Test ===
@@ -78,7 +77,8 @@ _send_qemu_cmd $h "{ 'execute': 'block-commit',
 
 echo
 echo "=== Base image info after commit and resize ==="
-TEST_IMG="${TEST_IMG}.base" _img_info
+TEST_IMG="${TEST_IMG}.base" _img_info | \
+    sed -e 's/^cluster_size: .*$/cluster_size: XXX/'
 
 # success, all done
 echo "*** done"
tests/qemu-iotests/095.out +4 -4
index 2360061..b95111e 100644
@@ -1,13 +1,13 @@
 QA output created by 095
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=5242880
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=104857600 backing_file=TEST_DIR/t.IMGFMT.base
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=5242880
+Formatting 'TEST_DIR/t.IMGFMT.snp1', fmt=IMGFMT size=104857600 backing_file=TEST_DIR/t.IMGFMT.base
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=104857600 backing_file=TEST_DIR/t.IMGFMT.snp1
 
 === Base image info before commit and resize ===
 image: TEST_DIR/t.IMGFMT.base
 file format: IMGFMT
 virtual size: 5.0M (5242880 bytes)
-cluster_size: 65536
+cluster_size: XXX
 
 === Running QEMU Live Commit Test ===
 
@@ -19,5 +19,5 @@ cluster_size: 65536
 image: TEST_DIR/t.IMGFMT.base
 file format: IMGFMT
 virtual size: 100M (104857600 bytes)
-cluster_size: 65536
+cluster_size: XXX
 *** done
Signature · 1 line
2.4.3
#11 lore raw

Re: [Qemu-devel] [PATCH 10/10] iotests: 095: Use TEST_IMG override instead of "mv"

Quoted 11 lines · Fam Zheng
---
 tests/qemu-iotests/095     | 12 ++++++------
 tests/qemu-iotests/095.out |  8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)
tests/qemu-iotests/095 +0 -0
index 6630181..cbe61bc 100755

tests/qemu-iotests/095 _supported_os Linux · line 53

Quoted 6 lines
tests/qemu-iotests/095 +1 -2
@@ -50,17 +50,16 @@ _supported_os Linux
 size_smaller=5M
 size_larger=100M
 
-_make_test_img $size_smaller
-mv "${TEST_IMG}" "${TEST_IMG}.base"
+TEST_IMG="$TEST_IMG.base _make_test_img $size_smaller"

I think this should be:

TEST_IMG="$TEST_IMG.base" _make_test_img $size_smaller

tests/qemu-iotests/095 _supported_os Linux · line 55

Quoted 4 lines
tests/qemu-iotests/095 +1 -2
-_make_test_img -b "${TEST_IMG}.base" $size_larger
-mv "${TEST_IMG}" "${TEST_IMG}.snp1"
+TEST_IMG="$TEST_IMG.snp1 _make_test_img -b "${TEST_IMG}.base" $size_larger"

TEST_IMG="$TEST_IMG.snp1" _make_test_img -b "${TEST_IMG}.base" \
$size_larger

(Also, you could strip the {} because the inconsistent usage looks a bit strange inside of a single line.)

tests/qemu-iotests/095 _supported_os Linux · line 62

Quoted 8 lines
tests/qemu-iotests/095 +2 -1
 _make_test_img -b "${TEST_IMG}.snp1" $size_larger
 
 echo
 echo "=== Base image info before commit and resize ==="
-TEST_IMG="${TEST_IMG}.base" _img_info
+TEST_IMG="${TEST_IMG}.base" _img_info | \
+    sed -e 's/^cluster_size: .*$/cluster_size: XXX/'

How about using _filter_img_info instead?

Max

Quoted 41 lines
tests/qemu-iotests/095 +2 -1
 echo
 echo === Running QEMU Live Commit Test ===
@@ -78,7 +77,8 @@ _send_qemu_cmd $h "{ 'execute': 'block-commit',
 
 echo
 echo "=== Base image info after commit and resize ==="
-TEST_IMG="${TEST_IMG}.base" _img_info
+TEST_IMG="${TEST_IMG}.base" _img_info | \
+    sed -e 's/^cluster_size: .*$/cluster_size: XXX/'
 
 # success, all done
 echo "*** done"
tests/qemu-iotests/095.out +4 -4
index 2360061..b95111e 100644
@@ -1,13 +1,13 @@
 QA output created by 095
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=5242880
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=104857600 backing_file=TEST_DIR/t.IMGFMT.base
+Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=5242880
+Formatting 'TEST_DIR/t.IMGFMT.snp1', fmt=IMGFMT size=104857600 backing_file=TEST_DIR/t.IMGFMT.base
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=104857600 backing_file=TEST_DIR/t.IMGFMT.snp1
 
 === Base image info before commit and resize ===
 image: TEST_DIR/t.IMGFMT.base
 file format: IMGFMT
 virtual size: 5.0M (5242880 bytes)
-cluster_size: 65536
+cluster_size: XXX
 
 === Running QEMU Live Commit Test ===
 
@@ -19,5 +19,5 @@ cluster_size: 65536
 image: TEST_DIR/t.IMGFMT.base
 file format: IMGFMT
 virtual size: 100M (104857600 bytes)
-cluster_size: 65536
+cluster_size: XXX
 *** done
author
#12 lore raw

Re: [Qemu-devel] [PATCH 10/10] iotests: 095: Use TEST_IMG override instead of "mv"

Quoted 15 lines · Max Reitz
Quoted 14 lines · Fam Zheng
---
 tests/qemu-iotests/095     | 12 ++++++------
 tests/qemu-iotests/095.out |  8 ++++----
 2 files changed, 10 insertions(+), 10 deletions(-)
tests/qemu-iotests/095 +0 -0
index 6630181..cbe61bc 100755
@@ -50,17 +50,16 @@ _supported_os Linux
 size_smaller=5M
 size_larger=100M
 
Quoted 7 lines

tests/qemu-iotests/095 _supported_os Linux · line 53

Quoted 3 lines
tests/qemu-iotests/095 +1 -2
-_make_test_img $size_smaller
-mv "${TEST_IMG}" "${TEST_IMG}.base"
+TEST_IMG="$TEST_IMG.base _make_test_img $size_smaller"

I think this should be:

TEST_IMG="$TEST_IMG.base" _make_test_img $size_smaller

Yes, it's a regex search-replace error. Will fix.

Quoted 11 lines

tests/qemu-iotests/095 _supported_os Linux · line 55

Quoted 5 lines
tests/qemu-iotests/095 +1 -2
-_make_test_img -b "${TEST_IMG}.base" $size_larger
-mv "${TEST_IMG}" "${TEST_IMG}.snp1"
+TEST_IMG="$TEST_IMG.snp1 _make_test_img -b "${TEST_IMG}.base" $size_larger"

TEST_IMG="$TEST_IMG.snp1" _make_test_img -b "${TEST_IMG}.base" \
$size_larger

(Also, you could strip the {} because the inconsistent usage looks a bit strange inside of a single line.)

Okay.

Quoted 11 lines

tests/qemu-iotests/095 _supported_os Linux · line 62

Quoted 9 lines
tests/qemu-iotests/095 +2 -1
 _make_test_img -b "${TEST_IMG}.snp1" $size_larger
 
 echo
 echo "=== Base image info before commit and resize ==="
-TEST_IMG="${TEST_IMG}.base" _img_info
+TEST_IMG="${TEST_IMG}.base" _img_info | \
+    sed -e 's/^cluster_size: .*$/cluster_size: XXX/'

How about using _filter_img_info instead?

Will drop this change and do it in a separate patch.

Thanks!

Fam

Reviewed-by on the v1 series
#13 lore raw
In reply to Fam Zheng
Quoted 11 lines · Fam Zheng

Commit 794d00f71d fixed two "mv" commands into the TEST_IMG override approach. There are still more occasions of "mv", this series fixes them.

The benefit is it drops the assumption that the created image is a single file, which is not true for VMDK or the coming QBM format. On top of this, those formats can be added to these cases later.

The patches stems from QBM work, but I will also take a look at adding applicable VMDK subformats once merged.

Please review.

Patches 1 to 9:

Quoted 38 lines

Fam

Fam Zheng (10):
iotests: 018: Use TEST_IMG override instead of "mv"
iotests: 019: Use TEST_IMG override instead of "mv"
iotests: 020: Use TEST_IMG override instead of "mv"
iotests: 024: Use TEST_IMG override instead of "mv"
iotests: 028: Use TEST_IMG override instead of "mv"
iotests: 034: Use TEST_IMG override instead of "mv"
iotests: 037: Use TEST_IMG override instead of "mv"
iotests: 038: Use TEST_IMG override instead of "mv"
iotests: 050: Use TEST_IMG override instead of "mv"
iotests: 095: Use TEST_IMG override instead of "mv"

 tests/qemu-iotests/018     |  8 ++++----
 tests/qemu-iotests/018.out |  2 +-
 tests/qemu-iotests/019     | 13 +++++++------
 tests/qemu-iotests/019.out |  4 ++--
 tests/qemu-iotests/020     |  7 +++++--
 tests/qemu-iotests/020.out |  2 +-
 tests/qemu-iotests/024     | 10 ++++++++--
 tests/qemu-iotests/024.out |  4 ++--
 tests/qemu-iotests/028     |  5 ++++-
 tests/qemu-iotests/028.out |  2 +-
 tests/qemu-iotests/034     |  6 +++++-
 tests/qemu-iotests/034.out |  2 +-
 tests/qemu-iotests/037     |  5 ++++-
 tests/qemu-iotests/037.out |  2 +-
 tests/qemu-iotests/038     |  5 ++++-
 tests/qemu-iotests/038.out |  2 +-
 tests/qemu-iotests/050     |  9 +++++++--
 tests/qemu-iotests/050.out |  4 ++--
 tests/qemu-iotests/095     | 12 ++++++------
 tests/qemu-iotests/095.out |  8 ++++----
 20 files changed, 70 insertions(+), 42 deletions(-)