]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/qemu-iotests: Check for a functional "secret" object before using it
authorThomas Huth <thuth@redhat.com>
Fri, 5 Dec 2025 13:00:14 +0000 (14:00 +0100)
committerAlex Bennée <alex.bennee@linaro.org>
Fri, 5 Dec 2025 15:26:06 +0000 (15:26 +0000)
QEMU iotests 049, 134 and 158 are currently failing if you compiled
QEMU without the crypto libraries. Thus make sure that the "secret"
object is really usable and skip the tests otherwise.

Reported-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20251205130014.693799-1-thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
tests/qemu-iotests/049
tests/qemu-iotests/134
tests/qemu-iotests/158
tests/qemu-iotests/common.rc

index ed12fa49d7f5dfeb253d095a301eb56a280fa7b3..a1b922060db3a4fa6893b2d0217ef229518bc26d 100755 (executable)
@@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow2
 _supported_proto file
+_require_secret
+
 
 filter_test_dir()
 {
index b2c3c03f08bb7314767bb79972b3823238df9a28..cc1e35eb161b9df0bec53da2019d97f18e4460f3 100755 (executable)
@@ -39,6 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow qcow2
 _supported_proto file
+_require_secret
 
 
 size=128M
index 3a9ad7eed03a5e971da88e4c9fd5b55fadb5181b..8fc4e986532607f5418eadcc3f65a74e99d4e087 100755 (executable)
@@ -39,6 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow qcow2
 _supported_proto file
+_require_secret
 
 
 size=128M
index e977cb4eb61d622a9802b072b06db3649ff15bf4..10d83d8361bba402181c26df359656361f6de4ce 100644 (file)
@@ -1053,6 +1053,20 @@ _require_one_device_of()
     _notrun "$* not available"
 }
 
+_require_secret()
+{
+    if [ -e "$TEST_IMG" ]; then
+        echo "unwilling to overwrite existing file"
+        exit 1
+    fi
+    if $QEMU_IMG create -f $IMGFMT --object secret,id=sec0,data=123 \
+                 -o encryption=on,encrypt.key-secret=sec0 "$TEST_IMG" 1M 2>&1 \
+                 | grep "Unsupported cipher" ; then
+        _notrun "missing cipher support"
+    fi
+    rm -f "$TEST_IMG"
+}
+
 _qcow2_dump_header()
 {
     if [[ "$1" == "--no-filter-compression" ]]; then