[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/31] iotests/common.rc: Add _require_working_luks
From: |
Max Reitz |
Subject: |
[PULL 05/31] iotests/common.rc: Add _require_working_luks |
Date: |
Mon, 6 Jul 2020 12:04:06 +0200 |
That the luks driver is present is little indication on whether it is
actually working. Without the crypto libraries linked in, it does not
work. So add this function, which tries to create a luks image to see
whether that actually works.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200625125548.870061-4-mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
---
tests/qemu-iotests/common.rc | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index ba912555ca..f3667f48ab 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -740,6 +740,33 @@ _unsupported_imgopts()
done
}
+# Caution: Overwrites $TEST_DIR/t.luks
+_require_working_luks()
+{
+ file="$TEST_DIR/t.luks"
+
+ output=$(
+ $QEMU_IMG create -f luks \
+ --object secret,id=sec0,data=hunter0 \
+ -o key-secret=sec0 \
+ -o iter-time=10 \
+ "$file" \
+ 1M \
+ 2>&1
+ )
+ status=$?
+
+ IMGFMT='luks' _rm_test_img "$file"
+
+ if [ $status != 0 ]; then
+ reason=$(echo "$output" | grep "$file:" | $SED -e "s#.*$file: *##")
+ if [ -z "$reason" ]; then
+ reason="Failed to create a LUKS image"
+ fi
+ _notrun "$reason"
+ fi
+}
+
# this test requires that a specified command (executable) exists
#
_require_command()
--
2.26.2
- [PULL 00/31] Block patches, Max Reitz, 2020/07/06
- [PULL 01/31] block/block-copy: block_copy_dirty_clusters: fix failure check, Max Reitz, 2020/07/06
- [PULL 02/31] qcow2: Fix preallocation on images with unaligned sizes, Max Reitz, 2020/07/06
- [PULL 03/31] iotests: Make _filter_img_create more active, Max Reitz, 2020/07/06
- [PULL 05/31] iotests/common.rc: Add _require_working_luks,
Max Reitz <=
- [PULL 04/31] iotests: filter few more luks specific create options, Max Reitz, 2020/07/06
- [PULL 07/31] iotests.py: Add (verify|has)_working_luks(), Max Reitz, 2020/07/06
- [PULL 08/31] iotests: Check whether luks works, Max Reitz, 2020/07/06
- [PULL 06/31] iotests.py: Add qemu_img_pipe_and_status(), Max Reitz, 2020/07/06
- [PULL 09/31] qcrypto/core: add generic infrastructure for crypto options amendment, Max Reitz, 2020/07/06
- [PULL 10/31] qcrypto/luks: implement encryption key management, Max Reitz, 2020/07/06
- [PULL 11/31] block/amend: add 'force' option, Max Reitz, 2020/07/06
- [PULL 12/31] block/amend: separate amend and create options for qemu-img, Max Reitz, 2020/07/06
- [PULL 14/31] block/crypto: rename two functions, Max Reitz, 2020/07/06
- [PULL 13/31] block/amend: refactor qcow2 amend options, Max Reitz, 2020/07/06