diff options
author | Kevin Wolf <kwolf@redhat.com> | 2017-07-27 15:13:20 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-08-01 18:09:33 +0200 |
commit | 59fa68f3f39cc596f93205f0862c8978c503f2c8 (patch) | |
tree | 84d4da254808cd7fb4d245f12801006fdc81295b /tests/qemu-iotests/common.rc | |
parent | 1803f3f6cfcc900e185a7b94652b7f0f026038f9 (diff) |
qemu-iotests/059: Fix leaked image files
qemu-iotests 059 left a whole lot of image files behind in the scratch
directory because VMDK creates additional files for extents and cleaning
them up requires the original image intact (it parses qemu-img info
output to find all extent files), but the image overwrote it many times
like it works for all other image formats.
In addition, _use_sample_img overwrites the TEST_IMG variable, causing
new images created afterwards to reuse the name of the sample file
rather than the usual t.IMGFMT.
This patch adds an intermediate _cleanup_test_img after each subtest
that created an image file with additional extent files, and also after
each use of a sample image. _cleanup_test_img is also changed so that it
resets TEST_IMG after a sample image is cleaned up.
Note that this test was failing before this commit and continues to do
so after it. This failure was introduced in commit 9877860 ('block/vmdk:
Report failures in vmdk_read_cid()') and needs to be dealt with
separately.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/common.rc')
-rw-r--r-- | tests/qemu-iotests/common.rc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 2548e58b99..bfbc80e5f6 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -92,6 +92,7 @@ else TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT fi fi +ORIG_TEST_IMG="$TEST_IMG" _optstr_add() { @@ -228,6 +229,8 @@ _cleanup_test_img() if [ -n "$SAMPLE_IMG_FILE" ] then rm -f "$TEST_DIR/$SAMPLE_IMG_FILE" + SAMPLE_IMG_FILE= + TEST_IMG="$ORIG_TEST_IMG" fi ;; |