Re: [PATCH v2 14/21] iotests: Use _rm_test_img for deleting test images

2019-11-06 Thread Maxim Levitsky
On Tue, 2019-10-15 at 16:27 +0200, Max Reitz wrote:
> Just rm will not delete external data files.  Use _rm_test_img every
> time we delete a test image.
> 
> (In the process, clean up the indentation of every _cleanup() this patch
> touches.)
> 
> ((Also, use quotes consistently.  I am happy to see unquoted instances
> like "rm -rf $TEST_DIR/..." go.))
> 
> Signed-off-by: Max Reitz 
> ---
>  tests/qemu-iotests/005 |  2 +-
>  tests/qemu-iotests/019 |  6 +++---
>  tests/qemu-iotests/020 |  6 +++---
>  tests/qemu-iotests/024 | 10 +-
>  tests/qemu-iotests/028 |  2 +-
>  tests/qemu-iotests/029 |  2 +-
>  tests/qemu-iotests/043 |  4 +++-
>  tests/qemu-iotests/048 |  2 +-
>  tests/qemu-iotests/050 |  4 ++--
>  tests/qemu-iotests/053 |  4 ++--
>  tests/qemu-iotests/058 |  2 +-
>  tests/qemu-iotests/059 |  2 +-
>  tests/qemu-iotests/061 |  2 +-
>  tests/qemu-iotests/063 |  6 --
>  tests/qemu-iotests/069 |  2 +-
>  tests/qemu-iotests/074 |  2 +-
>  tests/qemu-iotests/080 |  2 +-
>  tests/qemu-iotests/081 |  6 +++---
>  tests/qemu-iotests/085 |  9 ++---
>  tests/qemu-iotests/088 |  2 +-
>  tests/qemu-iotests/092 |  2 +-
>  tests/qemu-iotests/094 |  2 +-
>  tests/qemu-iotests/095 |  5 +++--
>  tests/qemu-iotests/099 |  7 ---
>  tests/qemu-iotests/109 |  4 ++--
>  tests/qemu-iotests/110 |  4 ++--
>  tests/qemu-iotests/122 |  6 --
>  tests/qemu-iotests/123 |  2 +-
>  tests/qemu-iotests/141 |  4 +++-
>  tests/qemu-iotests/142 |  2 +-
>  tests/qemu-iotests/144 |  4 +++-
>  tests/qemu-iotests/153 | 10 +++---
>  tests/qemu-iotests/156 |  8 ++--
>  tests/qemu-iotests/159 |  2 +-
>  tests/qemu-iotests/160 |  3 ++-
>  tests/qemu-iotests/161 |  4 ++--
>  tests/qemu-iotests/170 |  2 +-
>  tests/qemu-iotests/172 |  6 +++---
>  tests/qemu-iotests/173 |  3 ++-
>  tests/qemu-iotests/178 |  2 +-
>  tests/qemu-iotests/182 |  2 +-
>  tests/qemu-iotests/183 |  2 +-
>  tests/qemu-iotests/185 |  4 ++--
>  tests/qemu-iotests/187 |  6 +++---
>  tests/qemu-iotests/190 |  2 +-
>  tests/qemu-iotests/191 |  6 +++---
>  tests/qemu-iotests/195 |  2 +-
>  tests/qemu-iotests/197 |  2 +-
>  tests/qemu-iotests/200 |  3 ++-
>  tests/qemu-iotests/215 |  2 +-
>  tests/qemu-iotests/225 |  2 +-
>  tests/qemu-iotests/229 |  3 ++-
>  tests/qemu-iotests/232 |  4 +++-
>  tests/qemu-iotests/243 |  2 +-
>  tests/qemu-iotests/244 |  4 ++--
>  tests/qemu-iotests/247 |  4 +++-
>  tests/qemu-iotests/249 |  4 ++--
>  tests/qemu-iotests/252 |  2 +-
>  58 files changed, 119 insertions(+), 96 deletions(-)
> 
> diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005
> index 58442762fe..2b651f2c37 100755
> --- a/tests/qemu-iotests/005
> +++ b/tests/qemu-iotests/005
> @@ -62,7 +62,7 @@ if [ "$IMGFMT" = "raw" ]; then
>  if ! truncate --size=5T "$TEST_IMG"; then
>  _notrun "file system on $TEST_DIR does not support large enough 
> files"
>  fi
> -rm "$TEST_IMG"
> +_rm_test_img "$TEST_IMG"
>  fi
>  
>  echo
> diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019
> index b4f5234609..813a84acac 100755
> --- a/tests/qemu-iotests/019
> +++ b/tests/qemu-iotests/019
> @@ -30,9 +30,9 @@ status=1# failure is the default!
>  
>  _cleanup()
>  {
> - _cleanup_test_img
> -rm -f "$TEST_IMG.base"
> -rm -f "$TEST_IMG.orig"
> +_cleanup_test_img
> +_rm_test_img "$TEST_IMG.base"
> +_rm_test_img "$TEST_IMG.orig"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
> index f41b92f35f..20f8f185d0 100755
> --- a/tests/qemu-iotests/020
> +++ b/tests/qemu-iotests/020
> @@ -28,9 +28,9 @@ status=1# failure is the default!
>  
>  _cleanup()
>  {
> - _cleanup_test_img
> -rm -f "$TEST_IMG.base"
> -rm -f "$TEST_IMG.orig"
> +_cleanup_test_img
> +_rm_test_img "$TEST_IMG.base"
> +_rm_test_img "$TEST_IMG.orig"
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
> diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024
> index 23298c6f59..e2e766241e 100755
> --- a/tests/qemu-iotests/024
> +++ b/tests/qemu-iotests/024
> @@ -29,12 +29,12 @@ status=1  # failure is the default!
>  _cleanup()
>  {
>  _cleanup_test_img
> -rm -f "$TEST_DIR/t.$IMGFMT.base_old"
> -rm -f "$TEST_DIR/t.$IMGFMT.base_new"
> +_rm_test_img "$TEST_DIR/t.$IMGFMT.base_old"
> +_rm_test_img "$TEST_DIR/t.$IMGFMT.base_new"
>  
> -rm -f "$TEST_DIR/subdir/t.$IMGFMT"
> -rm -f "$TEST_DIR/subdir/t.$IMGFMT.base_old"
> -rm -f "$TEST_DIR/subdir/t.$IMGFMT.base_new"
> +_rm_test_img "$TEST_DIR/subdir/t.$IMGFMT"
> +_rm_test_img "$TEST_DIR/subdir/t.$IMGFMT.base_old"
> +_rm_test_img "$TEST_DIR/subdir/t.$IMGFMT.base_new"
>  rmdir "$TEST_DIR/subdir" 2> /dev/null
>  }
>  trap "_cleanup; exit \$status" 0 1 2 3 15
> diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
> index 71301ec6e5..caf1258647 100755
> --- a/tests/qemu-iotests/028
> +++ b/tests/qemu-iotests/028
> @@ -32,7 +32,7 @@ status=1# failure is the 

[PATCH v2 14/21] iotests: Use _rm_test_img for deleting test images

2019-10-15 Thread Max Reitz
Just rm will not delete external data files.  Use _rm_test_img every
time we delete a test image.

(In the process, clean up the indentation of every _cleanup() this patch
touches.)

((Also, use quotes consistently.  I am happy to see unquoted instances
like "rm -rf $TEST_DIR/..." go.))

Signed-off-by: Max Reitz 
---
 tests/qemu-iotests/005 |  2 +-
 tests/qemu-iotests/019 |  6 +++---
 tests/qemu-iotests/020 |  6 +++---
 tests/qemu-iotests/024 | 10 +-
 tests/qemu-iotests/028 |  2 +-
 tests/qemu-iotests/029 |  2 +-
 tests/qemu-iotests/043 |  4 +++-
 tests/qemu-iotests/048 |  2 +-
 tests/qemu-iotests/050 |  4 ++--
 tests/qemu-iotests/053 |  4 ++--
 tests/qemu-iotests/058 |  2 +-
 tests/qemu-iotests/059 |  2 +-
 tests/qemu-iotests/061 |  2 +-
 tests/qemu-iotests/063 |  6 --
 tests/qemu-iotests/069 |  2 +-
 tests/qemu-iotests/074 |  2 +-
 tests/qemu-iotests/080 |  2 +-
 tests/qemu-iotests/081 |  6 +++---
 tests/qemu-iotests/085 |  9 ++---
 tests/qemu-iotests/088 |  2 +-
 tests/qemu-iotests/092 |  2 +-
 tests/qemu-iotests/094 |  2 +-
 tests/qemu-iotests/095 |  5 +++--
 tests/qemu-iotests/099 |  7 ---
 tests/qemu-iotests/109 |  4 ++--
 tests/qemu-iotests/110 |  4 ++--
 tests/qemu-iotests/122 |  6 --
 tests/qemu-iotests/123 |  2 +-
 tests/qemu-iotests/141 |  4 +++-
 tests/qemu-iotests/142 |  2 +-
 tests/qemu-iotests/144 |  4 +++-
 tests/qemu-iotests/153 | 10 +++---
 tests/qemu-iotests/156 |  8 ++--
 tests/qemu-iotests/159 |  2 +-
 tests/qemu-iotests/160 |  3 ++-
 tests/qemu-iotests/161 |  4 ++--
 tests/qemu-iotests/170 |  2 +-
 tests/qemu-iotests/172 |  6 +++---
 tests/qemu-iotests/173 |  3 ++-
 tests/qemu-iotests/178 |  2 +-
 tests/qemu-iotests/182 |  2 +-
 tests/qemu-iotests/183 |  2 +-
 tests/qemu-iotests/185 |  4 ++--
 tests/qemu-iotests/187 |  6 +++---
 tests/qemu-iotests/190 |  2 +-
 tests/qemu-iotests/191 |  6 +++---
 tests/qemu-iotests/195 |  2 +-
 tests/qemu-iotests/197 |  2 +-
 tests/qemu-iotests/200 |  3 ++-
 tests/qemu-iotests/215 |  2 +-
 tests/qemu-iotests/225 |  2 +-
 tests/qemu-iotests/229 |  3 ++-
 tests/qemu-iotests/232 |  4 +++-
 tests/qemu-iotests/243 |  2 +-
 tests/qemu-iotests/244 |  4 ++--
 tests/qemu-iotests/247 |  4 +++-
 tests/qemu-iotests/249 |  4 ++--
 tests/qemu-iotests/252 |  2 +-
 58 files changed, 119 insertions(+), 96 deletions(-)

diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005
index 58442762fe..2b651f2c37 100755
--- a/tests/qemu-iotests/005
+++ b/tests/qemu-iotests/005
@@ -62,7 +62,7 @@ if [ "$IMGFMT" = "raw" ]; then
 if ! truncate --size=5T "$TEST_IMG"; then
 _notrun "file system on $TEST_DIR does not support large enough files"
 fi
-rm "$TEST_IMG"
+_rm_test_img "$TEST_IMG"
 fi
 
 echo
diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019
index b4f5234609..813a84acac 100755
--- a/tests/qemu-iotests/019
+++ b/tests/qemu-iotests/019
@@ -30,9 +30,9 @@ status=1  # failure is the default!
 
 _cleanup()
 {
-   _cleanup_test_img
-rm -f "$TEST_IMG.base"
-rm -f "$TEST_IMG.orig"
+_cleanup_test_img
+_rm_test_img "$TEST_IMG.base"
+_rm_test_img "$TEST_IMG.orig"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
index f41b92f35f..20f8f185d0 100755
--- a/tests/qemu-iotests/020
+++ b/tests/qemu-iotests/020
@@ -28,9 +28,9 @@ status=1  # failure is the default!
 
 _cleanup()
 {
-   _cleanup_test_img
-rm -f "$TEST_IMG.base"
-rm -f "$TEST_IMG.orig"
+_cleanup_test_img
+_rm_test_img "$TEST_IMG.base"
+_rm_test_img "$TEST_IMG.orig"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024
index 23298c6f59..e2e766241e 100755
--- a/tests/qemu-iotests/024
+++ b/tests/qemu-iotests/024
@@ -29,12 +29,12 @@ status=1# failure is the default!
 _cleanup()
 {
 _cleanup_test_img
-rm -f "$TEST_DIR/t.$IMGFMT.base_old"
-rm -f "$TEST_DIR/t.$IMGFMT.base_new"
+_rm_test_img "$TEST_DIR/t.$IMGFMT.base_old"
+_rm_test_img "$TEST_DIR/t.$IMGFMT.base_new"
 
-rm -f "$TEST_DIR/subdir/t.$IMGFMT"
-rm -f "$TEST_DIR/subdir/t.$IMGFMT.base_old"
-rm -f "$TEST_DIR/subdir/t.$IMGFMT.base_new"
+_rm_test_img "$TEST_DIR/subdir/t.$IMGFMT"
+_rm_test_img "$TEST_DIR/subdir/t.$IMGFMT.base_old"
+_rm_test_img "$TEST_DIR/subdir/t.$IMGFMT.base_new"
 rmdir "$TEST_DIR/subdir" 2> /dev/null
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
index 71301ec6e5..caf1258647 100755
--- a/tests/qemu-iotests/028
+++ b/tests/qemu-iotests/028
@@ -32,7 +32,7 @@ status=1  # failure is the default!
 _cleanup()
 {
 _cleanup_qemu
-rm -f "${TEST_IMG}.copy"
+_rm_test_img "${TEST_IMG}.copy"
 _cleanup_test_img
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029
index 94c2713132..9254ede5e5 100755
--- a/tests/qemu-iotests/029
+++ b/tests/qemu-iotests/029
@@