iotests: Use _rm_test_img for deleting test images

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 <mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-id: 20191107163708.833192-16-mreitz@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Max Reitz
2020-01-06 13:43:07 +01:00
parent 52a97b5a42
commit f91ecbd74e
57 changed files with 118 additions and 95 deletions
+3 -3
View File
@@ -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
+3 -3
View File
@@ -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
+5 -5
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -28,7 +28,7 @@ status=1 # failure is the default!
_cleanup()
{
rm -f $TEST_IMG.snap
_rm_test_img "$TEST_IMG.snap"
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+3 -1
View File
@@ -29,7 +29,9 @@ status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
rm -f "$TEST_IMG".[123].base
for img in "$TEST_IMG".[123].base; do
_rm_test_img "$img"
done
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+1 -1
View File
@@ -31,7 +31,7 @@ _cleanup()
{
echo "Cleanup"
_cleanup_test_img
rm "${TEST_IMG_FILE2}"
_rm_test_img "${TEST_IMG_FILE2}"
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+2 -2
View File
@@ -29,8 +29,8 @@ status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
rm -f "$TEST_IMG.old"
rm -f "$TEST_IMG.new"
_rm_test_img "$TEST_IMG.old"
_rm_test_img "$TEST_IMG.new"
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+2 -2
View File
@@ -28,8 +28,8 @@ status=1 # failure is the default!
_cleanup()
{
rm -f "$TEST_IMG.orig"
_cleanup_test_img
_rm_test_img "$TEST_IMG.orig"
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+1 -1
View File
@@ -42,7 +42,7 @@ _cleanup()
{
nbd_server_stop
_cleanup_test_img
rm -f "$converted_image"
_rm_test_img "$converted_image"
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+1 -1
View File
@@ -29,7 +29,7 @@ status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
rm -f "$TEST_IMG.qcow2"
IMGFMT=qcow2 _rm_test_img "$TEST_IMG.qcow2"
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+1 -1
View File
@@ -29,7 +29,7 @@ status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
rm -f $TEST_IMG.data
_rm_test_img "$TEST_IMG.data"
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+4 -2
View File
@@ -29,8 +29,10 @@ status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
rm -f "$TEST_IMG.orig" "$TEST_IMG.raw1" "$TEST_IMG.raw2"
_cleanup_test_img
for img in "$TEST_IMG".{orig,raw1,raw2,target}; do
_rm_test_img "$img"
done
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+1 -1
View File
@@ -47,7 +47,7 @@ echo "=== Creating an image with a backing file and deleting that file ==="
echo
TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE
_make_test_img -b "$TEST_IMG.base" $IMG_SIZE
rm -f "$TEST_IMG.base"
_rm_test_img "$TEST_IMG.base"
# Just open the image and close it right again (this should print an error message)
$QEMU_IO -c quit "$TEST_IMG" 2>&1 | _filter_testdir | _filter_imgfmt
+1 -1
View File
@@ -31,7 +31,7 @@ _cleanup()
{
echo "Cleanup"
_cleanup_test_img
rm "${TEST_IMG2}"
_rm_test_img "${TEST_IMG2}"
rm -f "$TEST_DIR/blkdebug.conf"
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+1 -1
View File
@@ -28,7 +28,7 @@ status=1 # failure is the default!
_cleanup()
{
rm -f $TEST_IMG.snap
_rm_test_img "$TEST_IMG.snap"
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+3 -3
View File
@@ -28,9 +28,9 @@ status=1 # failure is the default!
_cleanup()
{
rm -rf $TEST_DIR/1.raw
rm -rf $TEST_DIR/2.raw
rm -rf $TEST_DIR/3.raw
_rm_test_img "$TEST_DIR/1.raw"
_rm_test_img "$TEST_DIR/2.raw"
_rm_test_img "$TEST_DIR/3.raw"
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+6 -3
View File
@@ -41,10 +41,13 @@ _cleanup()
_cleanup_qemu
for i in $(seq 1 ${SNAPSHOTS})
do
rm -f "${TEST_DIR}/${i}-${snapshot_virt0}"
rm -f "${TEST_DIR}/${i}-${snapshot_virt1}"
_rm_test_img "${TEST_DIR}/${i}-${snapshot_virt0}"
_rm_test_img "${TEST_DIR}/${i}-${snapshot_virt1}"
done
for img in "${TEST_IMG}".{1,2,base}
do
_rm_test_img "$img"
done
rm -f "${TEST_IMG}" "${TEST_IMG}.1" "${TEST_IMG}.2" "${TEST_IMG}.base"
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+1 -1
View File
@@ -28,7 +28,7 @@ status=1 # failure is the default!
_cleanup()
{
rm -f $TEST_IMG.snap
_rm_test_img "$TEST_IMG.snap"
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15
+1 -1
View File
@@ -28,7 +28,7 @@ status=1 # failure is the default!
_cleanup()
{
rm -f $TEST_IMG.snap
_rm_test_img "$TEST_IMG.snap"
_cleanup_test_img
}
trap "_cleanup; exit \$status" 0 1 2 3 15

Some files were not shown because too many files have changed in this diff Show More