[Qemu-devel] [PATCH 2/3] qemu-iotests: Filter NFS paths

Kevin Wolf posted 3 patches 7 years, 8 months ago
There is a newer version of this series
[Qemu-devel] [PATCH 2/3] qemu-iotests: Filter NFS paths
Posted by Kevin Wolf 7 years, 8 months ago
NFS paths were only partially filtered in _filter_img_create, _img_info
and _filter_img_info, resulting in "nfs://127.0.0.1TEST_DIR/t.IMGFMT".
This adds another replacement to the sed calls that matches $TEST_IMG as
a whole.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/common.filter | 6 ++++--
 tests/qemu-iotests/common.rc     | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index c5f4bcf578..ae83591337 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -119,7 +119,8 @@ _filter_actual_image_size()
 # replace driver-specific options in the "Formatting..." line
 _filter_img_create()
 {
-    sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
+    sed -e "s#$TEST_IMG#TEST_DIR/t.IMGFMT#g" \
+        -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
         -e "s#$TEST_DIR#TEST_DIR#g" \
         -e "s#$IMGFMT#IMGFMT#g" \
         -e 's#nbd:127.0.0.1:10810#TEST_DIR/t.IMGFMT#g' \
@@ -154,7 +155,8 @@ _filter_img_info()
 
     discard=0
     regex_json_spec_start='^ *"format-specific": \{'
-    sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
+    sed -e "s#$TEST_IMG#TEST_DIR/t.IMGFMT#g" \
+        -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
         -e "s#$TEST_DIR#TEST_DIR#g" \
         -e "s#$IMGFMT#IMGFMT#g" \
         -e 's#nbd://127.0.0.1:10810$#TEST_DIR/t.IMGFMT#g' \
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index cb5fa14e7f..a055d8b032 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -333,7 +333,8 @@ _img_info()
     discard=0
     regex_json_spec_start='^ *"format-specific": \{'
     $QEMU_IMG info $QEMU_IMG_EXTRA_ARGS "$@" "$TEST_IMG" 2>&1 | \
-        sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
+        sed -e "s#$TEST_IMG#TEST_DIR/t.IMGFMT#g" \
+            -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
             -e "s#$TEST_DIR#TEST_DIR#g" \
             -e "s#$IMGFMT#IMGFMT#g" \
             -e "/^disk size:/ D" \
-- 
2.13.6


Re: [Qemu-devel] [PATCH 2/3] qemu-iotests: Filter NFS paths
Posted by Kevin Wolf 7 years, 8 months ago
Am 17.05.2018 um 18:52 hat Kevin Wolf geschrieben:
> NFS paths were only partially filtered in _filter_img_create, _img_info
> and _filter_img_info, resulting in "nfs://127.0.0.1TEST_DIR/t.IMGFMT".
> This adds another replacement to the sed calls that matches $TEST_IMG as
> a whole.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Self-NACK, this replaces a bit too much... (Some places in the test
scripts override $TEST_IMG, but not $TEST_IMG_FILE).

Maybe we need to introduce some $TEST_DIR_REMOTE (any suggestions for
a better name?) that would contain "nfs://127.0.0.1$TEST_DIR" and can be
used in the filter function.

Kevin