Skip to content
  • Hanna Reitz's avatar
    d2d5310c
    iotests: Let _make_test_img guess $TEST_IMG_FILE · d2d5310c
    Hanna Reitz authored
    
    
    When most iotests want to create a test image that is named differently
    from the default $TEST_IMG, they do something like this:
    
        TEST_IMG="$TEST_IMG.base" _make_test_img $options
    
    This works fine with the "file" protocol, but not so much for anything
    else: _make_test_img tries to create an image under $TEST_IMG_FILE
    first, and only under $TEST_IMG if the former is not set; and on
    everything but "file", $TEST_IMG_FILE is set.
    
    There are two ways we can fix this: First, we could make all tests
    adjust not only TEST_IMG, but also TEST_IMG_FILE if that is present
    (e.g. with something like _set_test_img_suffix $suffix that would affect
    not only TEST_IMG but also TEST_IMG_FILE, if necessary).  This is a
    pretty clean solution, and this is maybe what we should have done from
    the start.
    
    But it would also require changes to most existing bash tests.  So the
    alternative is this: Let _make_test_img see whether $TEST_IMG_FILE still
    points to the original value.  If so, it is possible that the caller has
    adjusted $TEST_IMG but not $TEST_IMG_FILE.  In such a case, we can (for
    most protocols) derive the corresponding $TEST_IMG_FILE value from
    $TEST_IMG value and thus work around what technically is the caller
    misbehaving.
    
    This second solution is less clean, but it is robust against people
    keeping their old habit of adjusting TEST_IMG only, and requires much
    less changes.  So this patch implements it.
    
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20201027190600.192171-15-mreitz@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    d2d5310c
    iotests: Let _make_test_img guess $TEST_IMG_FILE
    Hanna Reitz authored
    
    
    When most iotests want to create a test image that is named differently
    from the default $TEST_IMG, they do something like this:
    
        TEST_IMG="$TEST_IMG.base" _make_test_img $options
    
    This works fine with the "file" protocol, but not so much for anything
    else: _make_test_img tries to create an image under $TEST_IMG_FILE
    first, and only under $TEST_IMG if the former is not set; and on
    everything but "file", $TEST_IMG_FILE is set.
    
    There are two ways we can fix this: First, we could make all tests
    adjust not only TEST_IMG, but also TEST_IMG_FILE if that is present
    (e.g. with something like _set_test_img_suffix $suffix that would affect
    not only TEST_IMG but also TEST_IMG_FILE, if necessary).  This is a
    pretty clean solution, and this is maybe what we should have done from
    the start.
    
    But it would also require changes to most existing bash tests.  So the
    alternative is this: Let _make_test_img see whether $TEST_IMG_FILE still
    points to the original value.  If so, it is possible that the caller has
    adjusted $TEST_IMG but not $TEST_IMG_FILE.  In such a case, we can (for
    most protocols) derive the corresponding $TEST_IMG_FILE value from
    $TEST_IMG value and thus work around what technically is the caller
    misbehaving.
    
    This second solution is less clean, but it is robust against people
    keeping their old habit of adjusting TEST_IMG only, and requires much
    less changes.  So this patch implements it.
    
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20201027190600.192171-15-mreitz@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading