diff mbox series

[10/18] iotests: Avoid qemu-img create

Message ID 20190927094242.11152-11-mreitz@redhat.com (mailing list archive)
State New, archived
Headers show
Series iotests: Allow ./check -o data_file | expand

Commit Message

Max Reitz Sept. 27, 2019, 9:42 a.m. UTC
Use _make_test_img whenever possible.  This way, we will not ignore
user-specified image options.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/094 | 2 +-
 tests/qemu-iotests/111 | 3 +--
 tests/qemu-iotests/123 | 2 +-
 tests/qemu-iotests/153 | 2 +-
 tests/qemu-iotests/200 | 4 ++--
 5 files changed, 6 insertions(+), 7 deletions(-)

Comments

Maxim Levitsky Sept. 29, 2019, 4:33 p.m. UTC | #1
On Fri, 2019-09-27 at 11:42 +0200, Max Reitz wrote:
> Use _make_test_img whenever possible.  This way, we will not ignore
> user-specified image options.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/094 | 2 +-
>  tests/qemu-iotests/111 | 3 +--
>  tests/qemu-iotests/123 | 2 +-
>  tests/qemu-iotests/153 | 2 +-
>  tests/qemu-iotests/200 | 4 ++--
>  5 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094
> index 9343e09492..d645952d54 100755
> --- a/tests/qemu-iotests/094
> +++ b/tests/qemu-iotests/094
> @@ -45,7 +45,7 @@ _supported_proto nbd
>  _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat"
>  
>  _make_test_img 64M
> -$QEMU_IMG create -f $IMGFMT "$TEST_DIR/source.$IMGFMT" 64M | _filter_img_create
> +TEST_IMG_FILE="$TEST_DIR/source.$IMGFMT" IMGPROTO=file _make_test_img 64M
>  
>  _launch_qemu -drive if=none,id=src,file="$TEST_DIR/source.$IMGFMT",format=raw \
>               -nodefaults
> diff --git a/tests/qemu-iotests/111 b/tests/qemu-iotests/111
> index 490a5bbcb5..3b43d1bd83 100755
> --- a/tests/qemu-iotests/111
> +++ b/tests/qemu-iotests/111
> @@ -41,8 +41,7 @@ _supported_fmt qed qcow qcow2 vmdk
>  _supported_proto file
>  _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat"
>  
> -$QEMU_IMG create -f $IMGFMT -b "$TEST_IMG.inexistent" "$TEST_IMG" 2>&1 \
> -    | _filter_testdir | _filter_imgfmt
> +_make_test_img -b "$TEST_IMG.inexistent"
>  
>  # success, all done
>  echo '*** done'
> diff --git a/tests/qemu-iotests/123 b/tests/qemu-iotests/123
> index d33950eb54..74d40d0478 100755
> --- a/tests/qemu-iotests/123
> +++ b/tests/qemu-iotests/123
> @@ -44,7 +44,7 @@ _supported_os Linux
>  SRC_IMG="$TEST_DIR/source.$IMGFMT"
>  
>  _make_test_img 1M
> -$QEMU_IMG create -f $IMGFMT "$SRC_IMG" 1M | _filter_img_create
> +TEST_IMG_FILE=$SRC_IMG IMGPROTO=file _make_test_img 1M
>  
>  $QEMU_IO -c 'write -P 42 0 1M' "$SRC_IMG" | _filter_qemu_io
>  
> diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153
> index c969a1a16f..e59090259c 100755
> --- a/tests/qemu-iotests/153
> +++ b/tests/qemu-iotests/153
> @@ -98,7 +98,7 @@ for opts1 in "" "read-only=on" "read-only=on,force-share=on"; do
>  
>      echo
>      echo "== Creating test image =="
> -    $QEMU_IMG create -f $IMGFMT "${TEST_IMG}" -b ${TEST_IMG}.base | _filter_img_create
> +    _make_test_img -b "${TEST_IMG}.base"
>  
>      echo
>      echo "== Launching QEMU, opts: '$opts1' =="
> diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200
> index 72d431f251..d904885136 100755
> --- a/tests/qemu-iotests/200
> +++ b/tests/qemu-iotests/200
> @@ -46,8 +46,8 @@ _supported_proto file
>  BACKING_IMG="${TEST_DIR}/backing.img"
>  TEST_IMG="${TEST_DIR}/test.img"
>  
> -${QEMU_IMG} create -f $IMGFMT "${BACKING_IMG}" 512M | _filter_img_create
> -${QEMU_IMG} create -f $IMGFMT -F $IMGFMT "${TEST_IMG}" -b "${BACKING_IMG}" 512M | _filter_img_create
> +TEST_IMG="$BACKING_IMG" _make_test_img 512M
> +_make_test_img -F $IMGFMT -b "$BACKING_IMG" 512M
>  
>  ${QEMU_IO} -c "write -P 0xa5 512 300M" "${BACKING_IMG}" | _filter_qemu_io
>  
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
diff mbox series

Patch

diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094
index 9343e09492..d645952d54 100755
--- a/tests/qemu-iotests/094
+++ b/tests/qemu-iotests/094
@@ -45,7 +45,7 @@  _supported_proto nbd
 _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat"
 
 _make_test_img 64M
-$QEMU_IMG create -f $IMGFMT "$TEST_DIR/source.$IMGFMT" 64M | _filter_img_create
+TEST_IMG_FILE="$TEST_DIR/source.$IMGFMT" IMGPROTO=file _make_test_img 64M
 
 _launch_qemu -drive if=none,id=src,file="$TEST_DIR/source.$IMGFMT",format=raw \
              -nodefaults
diff --git a/tests/qemu-iotests/111 b/tests/qemu-iotests/111
index 490a5bbcb5..3b43d1bd83 100755
--- a/tests/qemu-iotests/111
+++ b/tests/qemu-iotests/111
@@ -41,8 +41,7 @@  _supported_fmt qed qcow qcow2 vmdk
 _supported_proto file
 _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat"
 
-$QEMU_IMG create -f $IMGFMT -b "$TEST_IMG.inexistent" "$TEST_IMG" 2>&1 \
-    | _filter_testdir | _filter_imgfmt
+_make_test_img -b "$TEST_IMG.inexistent"
 
 # success, all done
 echo '*** done'
diff --git a/tests/qemu-iotests/123 b/tests/qemu-iotests/123
index d33950eb54..74d40d0478 100755
--- a/tests/qemu-iotests/123
+++ b/tests/qemu-iotests/123
@@ -44,7 +44,7 @@  _supported_os Linux
 SRC_IMG="$TEST_DIR/source.$IMGFMT"
 
 _make_test_img 1M
-$QEMU_IMG create -f $IMGFMT "$SRC_IMG" 1M | _filter_img_create
+TEST_IMG_FILE=$SRC_IMG IMGPROTO=file _make_test_img 1M
 
 $QEMU_IO -c 'write -P 42 0 1M' "$SRC_IMG" | _filter_qemu_io
 
diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153
index c969a1a16f..e59090259c 100755
--- a/tests/qemu-iotests/153
+++ b/tests/qemu-iotests/153
@@ -98,7 +98,7 @@  for opts1 in "" "read-only=on" "read-only=on,force-share=on"; do
 
     echo
     echo "== Creating test image =="
-    $QEMU_IMG create -f $IMGFMT "${TEST_IMG}" -b ${TEST_IMG}.base | _filter_img_create
+    _make_test_img -b "${TEST_IMG}.base"
 
     echo
     echo "== Launching QEMU, opts: '$opts1' =="
diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200
index 72d431f251..d904885136 100755
--- a/tests/qemu-iotests/200
+++ b/tests/qemu-iotests/200
@@ -46,8 +46,8 @@  _supported_proto file
 BACKING_IMG="${TEST_DIR}/backing.img"
 TEST_IMG="${TEST_DIR}/test.img"
 
-${QEMU_IMG} create -f $IMGFMT "${BACKING_IMG}" 512M | _filter_img_create
-${QEMU_IMG} create -f $IMGFMT -F $IMGFMT "${TEST_IMG}" -b "${BACKING_IMG}" 512M | _filter_img_create
+TEST_IMG="$BACKING_IMG" _make_test_img 512M
+_make_test_img -F $IMGFMT -b "$BACKING_IMG" 512M
 
 ${QEMU_IO} -c "write -P 0xa5 512 300M" "${BACKING_IMG}" | _filter_qemu_io