diff mbox series

[1/3] iotests: use TEST_IMG_FILE instead of TEST_IMG in _require_large_file

Message ID 20230906140917.559129-2-den@openvz.org
State New
Headers show
Series separated wanted and unwanted skips in QEMU iotests | expand

Commit Message

Denis V. Lunev Sept. 6, 2023, 2:09 p.m. UTC
We need to check that we are able to create large enough file which is
used as an export base rather than connection URL. Unfortunately, there
are cases when the TEST_IMG_FILE is not defined. We should fallback to
TEST_IMG in that case.

This problem has been detected when running
    ./check -nbd 5
The test should be able to run while it does not.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Hanna Reitz <hreitz@redhat.com>
CC: Eric Blake <eblake@redhat.com>
CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
 tests/qemu-iotests/common.rc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Eric Blake Sept. 13, 2023, 2:56 p.m. UTC | #1
On Wed, Sep 06, 2023 at 04:09:15PM +0200, Denis V. Lunev wrote:
> We need to check that we are able to create large enough file which is
> used as an export base rather than connection URL. Unfortunately, there
> are cases when the TEST_IMG_FILE is not defined. We should fallback to
> TEST_IMG in that case.
> 
> This problem has been detected when running
>     ./check -nbd 5
> The test should be able to run while it does not.

Pre-patch it skips, post-patch it passes.  Nice observation!
Tested-by: Eric Blake <eblake@redhat.com>

> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Hanna Reitz <hreitz@redhat.com>
> CC: Eric Blake <eblake@redhat.com>
> CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
>  tests/qemu-iotests/common.rc | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>
diff mbox series

Patch

diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index d145f08201..95c12577dd 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -979,10 +979,15 @@  _require_drivers()
 #
 _require_large_file()
 {
-    if ! truncate --size="$1" "$TEST_IMG"; then
+    if [ -z "$TEST_IMG_FILE" ]; then
+        FILENAME="$TEST_IMG"
+    else
+        FILENAME="$TEST_IMG_FILE"
+    fi
+    if ! truncate --size="$1" "$FILENAME"; then
         _notrun "file system on $TEST_DIR does not support large enough files"
     fi
-    rm "$TEST_IMG"
+    rm "$FILENAME"
 }
 
 # Check that a set of devices is available in the QEMU binary