qemu-iotests: Fix NFS + raw
v2 cover qemu-iotests: Fix NFS + raw
This series fixes the NFS support in qemu-iotests, at least as far as raw is concerned. More fixes would be needed for NFS with qcow2.
v2:
- Introduce $REMOTE_TEST_DIR to avoid breaking non-NFS cases (and to support additional files in the same directory besides $TEST_IMG)
Kevin Wolf (3):
qemu-iotests: Fix paths for NFS
qemu-iotests: Filter NFS paths
qemu-iotests: 086 doesn't work with NFS
tests/qemu-iotests/086 | 2 +- tests/qemu-iotests/common.filter | 6 ++++-- tests/qemu-iotests/common.rc | 12 +++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-)
Signature · 1 line
2.13.6
PATCH v2 1/3 qemu-iotests: Fix paths for NFS
Test cases were trying to use nfs:// URLs as local filenames, which made every test fail for NFS. With TEST_IMG and TEST_IMG_FILE set like for the other protocols, NFS tests can pass again.
--- tests/qemu-iotests/common.rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/common.rc +2 -2
@@ -147,8 +147,8 @@ else TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT TEST_IMG="ssh://127.0.0.1$TEST_IMG_FILE" elif [ "$IMGPROTO" = "nfs" ]; then - TEST_DIR="nfs://127.0.0.1/$TEST_DIR" - TEST_IMG=$TEST_DIR/t.$IMGFMT + TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT + TEST_IMG="nfs://127.0.0.1$TEST_IMG_FILE" elif [ "$IMGPROTO" = "vxhs" ]; then TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT TEST_IMG="vxhs://127.0.0.1:9999/t.$IMGFMT"
Signature · 1 line
2.13.6
Re: [Qemu-devel] [PATCH v2 1/3] qemu-iotests: Fix paths for NFS
Quoted 5 lines · Kevin Wolf
Test cases were trying to use nfs:// URLs as local filenames, which made every test fail for NFS. With
TEST_IMGandTEST_IMG_FILEset like for the other protocols, NFS tests can pass again.Signed-off-by Kevin Wolf <[email protected]>
PATCH v2 2/3 qemu-iotests: Filter NFS paths
In reply to Kevin WolfNFS 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 the test directory not as a host path, but as an NFS URL (the prefix as used for $TEST_IMG).
--- tests/qemu-iotests/common.filter | 6 ++++-- tests/qemu-iotests/common.rc | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-)
tests/qemu-iotests/common.filter +4 -2
@@ -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#$REMOTE_TEST_DIR#TEST_DIR#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#$REMOTE_TEST_DIR#TEST_DIR#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' \
tests/qemu-iotests/common.rc +7 -1
@@ -148,6 +148,7 @@ else TEST_IMG="ssh://127.0.0.1$TEST_IMG_FILE" elif [ "$IMGPROTO" = "nfs" ]; then TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT + REMOTE_TEST_DIR="nfs://127.0.0.1$TEST_DIR" TEST_IMG="nfs://127.0.0.1$TEST_IMG_FILE" elif [ "$IMGPROTO" = "vxhs" ]; then TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
@@ -173,6 +174,10 @@ if [ ! -d "$TEST_DIR" ]; then exit 1 fi +if [ -z "$REMOTE_TEST_DIR" ]; then + REMOTE_TEST_DIR="$TEST_DIR" +fi + if [ ! -d "$SAMPLE_IMG_DIR" ]; then echo "common.config: Error: \$SAMPLE_IMG_DIR ($SAMPLE_IMG_DIR) is not a directory" exit 1
@@ -333,7 +338,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#$REMOTE_TEST_DIR#TEST_DIR#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" \
Signature · 1 line
2.13.6
Re: [Qemu-devel] [PATCH v2 2/3] qemu-iotests: Filter NFS paths
Quoted 49 lines · Kevin Wolf
NFS paths were only partially filtered in
_filter_img_create,_img_infoand_filter_img_info, resulting in "nfs://127.0.0.1TEST_DIR/t.IMGFMT". This adds another replacement to the sed calls that matches the test directory not as a host path, but as an NFS URL (the prefix as used for $TEST_IMG).Signed-off-by Kevin Wolf <[email protected]>--- tests/qemu-iotests/common.filter | 6 ++++-- tests/qemu-iotests/common.rc | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-)tests/qemu-iotests/common.filter +4
-2@@ -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#$REMOTE_TEST_DIR#TEST_DIR#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#$REMOTE_TEST_DIR#TEST_DIR#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' \tests/qemu-iotests/common.rc +1
-0@@ -148,6 +148,7 @@ else TEST_IMG="ssh://127.0.0.1$TEST_IMG_FILE" elif [ "$IMGPROTO" = "nfs" ]; then TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT + REMOTE_TEST_DIR="nfs://127.0.0.1$TEST_DIR" TEST_IMG="nfs://127.0.0.1$TEST_IMG_FILE" elif [ "$IMGPROTO" = "vxhs" ]; then TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
tests/qemu-iotests/common.rc if [ ! -d "$TEST_DIR" ]; then · line 178
Quoted 5 lines
tests/qemu-iotests/common.rc +2
-0@@ -173,6 +174,10 @@ if [ ! -d "$TEST_DIR" ]; then exit 1 fi +if [ -z "$REMOTE_TEST_DIR" ]; then + REMOTE_TEST_DIR="$TEST_DIR"
This has one extra level of indentation.
Quoted 19 lines
tests/qemu-iotests/common.rc +4
-1+fi + if [ ! -d "$SAMPLE_IMG_DIR" ]; then echo "common.config: Error: \$SAMPLE_IMG_DIR ($SAMPLE_IMG_DIR) is not a directory" exit 1@@ -333,7 +338,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#$REMOTE_TEST_DIR#TEST_DIR#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" \Signature · 1 line
2.13.6
PATCH v2 3/3 qemu-iotests: 086 doesn't work with NFS
In reply to Kevin WolfThe reference output file only works for file. 'qemu-img convert -p' makes a lot more progress updates for NFS than for file, so disable the test for NFS.
--- tests/qemu-iotests/086 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/086 +1 -1
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter _supported_fmt qcow2 raw -_supported_proto file nfs +_supported_proto file _supported_os Linux function run_qemu_img()
Signature · 1 line
2.13.6
Re: [Qemu-devel] [PATCH v2 3/3] qemu-iotests: 086 doesn't work with NFS
Quoted 5 lines · Kevin Wolf
The reference output file only works for file. 'qemu-img convert -p' makes a lot more progress updates for NFS than for file, so disable the test for NFS.
Signed-off-by Kevin Wolf <[email protected]>