[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/34] iotests: Do not pipe _make_test_img
From: |
Kevin Wolf |
Subject: |
[PULL 12/34] iotests: Do not pipe _make_test_img |
Date: |
Fri, 11 Dec 2020 18:07:50 +0100 |
From: Max Reitz <mreitz@redhat.com>
Executing _make_test_img as part of a pipe will undo all variable
changes it has done. As such, this could not work with FUSE (because
we want to remember all of our exports and their qemu instances).
Replace the pipe by a temporary file in 071 and 174 (the two tests that
can run on FUSE).
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20201027190600.192171-9-mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/qemu-iotests/071 | 19 +++++++++++++++----
tests/qemu-iotests/174 | 10 +++++++++-
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071
index 88faebcc1d..18fe9054b0 100755
--- a/tests/qemu-iotests/071
+++ b/tests/qemu-iotests/071
@@ -61,8 +61,17 @@ echo
echo "=== Testing blkverify through filename ==="
echo
-TEST_IMG="$TEST_IMG.base" IMGFMT="raw" _make_test_img --no-opts $IMG_SIZE |\
- _filter_imgfmt
+# _make_test_img may set variables that we need to retain. Everything
+# in a pipe is executed in a subshell, so doing so would throw away
+# all changes. Therefore, we have to store the output in some temp
+# file and filter that.
+scratch_out="$TEST_DIR/img-create.out"
+
+TEST_IMG="$TEST_IMG.base" IMGFMT="raw" _make_test_img --no-opts $IMG_SIZE \
+ >"$scratch_out"
+_filter_imgfmt <"$scratch_out"
+rm -f "$scratch_out"
+
_make_test_img $IMG_SIZE
$QEMU_IO -c "open -o
driver=raw,file.driver=blkverify,file.raw.filename=$TEST_IMG.base $TEST_IMG" \
-c 'read 0 512' -c 'write -P 42 0x38000 512' -c 'read -P 42 0x38000
512' | _filter_qemu_io
@@ -76,8 +85,10 @@ echo
echo "=== Testing blkverify through file blockref ==="
echo
-TEST_IMG="$TEST_IMG.base" IMGFMT="raw" _make_test_img --no-opts $IMG_SIZE |\
- _filter_imgfmt
+TEST_IMG="$TEST_IMG.base" IMGFMT="raw" _make_test_img --no-opts $IMG_SIZE \
+ >"$scratch_out"
+_filter_imgfmt <"$scratch_out"
+
_make_test_img $IMG_SIZE
$QEMU_IO -c "open -o
driver=raw,file.driver=blkverify,file.raw.filename=$TEST_IMG.base,file.test.driver=$IMGFMT,file.test.file.filename=$TEST_IMG"
\
-c 'read 0 512' -c 'write -P 42 0x38000 512' -c 'read -P 42 0x38000
512' | _filter_qemu_io
diff --git a/tests/qemu-iotests/174 b/tests/qemu-iotests/174
index e2f14a38c6..1b0dd2e8b7 100755
--- a/tests/qemu-iotests/174
+++ b/tests/qemu-iotests/174
@@ -40,7 +40,15 @@ _unsupported_fmt raw
size=256K
-IMGFMT=raw IMGKEYSECRET= _make_test_img --no-opts $size | _filter_imgfmt
+
+# _make_test_img may set variables that we need to retain. Everything
+# in a pipe is executed in a subshell, so doing so would throw away
+# all changes. Therefore, we have to store the output in some temp
+# file and filter that.
+scratch_out="$TEST_DIR/img-create.out"
+IMGFMT=raw IMGKEYSECRET= _make_test_img --no-opts $size >"$scratch_out"
+_filter_imgfmt <"$scratch_out"
+rm -f "$scratch_out"
echo
echo "== reading wrong format should fail =="
--
2.29.2
- [PULL 02/34] block/curl: Use lock guard macros, (continued)
- [PULL 02/34] block/curl: Use lock guard macros, Kevin Wolf, 2020/12/11
- [PULL 01/34] block/accounting: Use lock guard macros, Kevin Wolf, 2020/12/11
- [PULL 04/34] block/iscsi: Use lock guard macros, Kevin Wolf, 2020/12/11
- [PULL 03/34] block/throttle-groups: Use lock guard macros, Kevin Wolf, 2020/12/11
- [PULL 06/34] fuse: Allow exporting BDSs via FUSE, Kevin Wolf, 2020/12/11
- [PULL 08/34] fuse: Allow growable exports, Kevin Wolf, 2020/12/11
- [PULL 07/34] fuse: Implement standard FUSE operations, Kevin Wolf, 2020/12/11
- [PULL 05/34] meson: Detect libfuse, Kevin Wolf, 2020/12/11
- [PULL 09/34] fuse: (Partially) implement fallocate(), Kevin Wolf, 2020/12/11
- [PULL 10/34] fuse: Implement hole detection through lseek, Kevin Wolf, 2020/12/11
- [PULL 12/34] iotests: Do not pipe _make_test_img,
Kevin Wolf <=
- [PULL 11/34] iotests: Do not needlessly filter _make_test_img, Kevin Wolf, 2020/12/11
- [PULL 13/34] iotests: Use convert -n in some cases, Kevin Wolf, 2020/12/11
- [PULL 15/34] iotests: Derive image names from $TEST_IMG, Kevin Wolf, 2020/12/11
- [PULL 14/34] iotests/046: Avoid renaming images, Kevin Wolf, 2020/12/11
- [PULL 17/34] iotests: Restrict some Python tests to file, Kevin Wolf, 2020/12/11
- [PULL 18/34] iotests: Let _make_test_img guess $TEST_IMG_FILE, Kevin Wolf, 2020/12/11
- [PULL 20/34] storage-daemon: Call bdrv_close_all() on exit, Kevin Wolf, 2020/12/11
- [PULL 16/34] iotests/091: Use _cleanup_qemu instad of "wait", Kevin Wolf, 2020/12/11
- [PULL 26/34] iotests/221: Discard image before qemu-img map, Kevin Wolf, 2020/12/11
- [PULL 24/34] iotests/308: Add test for FUSE exports, Kevin Wolf, 2020/12/11