From: Thomas Huth Date: Fri, 5 Dec 2025 13:00:14 +0000 (+0100) Subject: tests/qemu-iotests: Check for a functional "secret" object before using it X-Git-Tag: v10.2.0-rc3~3^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a55d610bac73bd3a0f222b6d851565375d822085;p=thirdparty%2Fqemu.git tests/qemu-iotests: Check for a functional "secret" object before using it 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 Signed-off-by: Thomas Huth Message-ID: <20251205130014.693799-1-thuth@redhat.com> Signed-off-by: Alex Bennée --- diff --git a/tests/qemu-iotests/049 b/tests/qemu-iotests/049 index ed12fa49d7..a1b922060d 100755 --- a/tests/qemu-iotests/049 +++ b/tests/qemu-iotests/049 @@ -39,6 +39,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file +_require_secret + filter_test_dir() { diff --git a/tests/qemu-iotests/134 b/tests/qemu-iotests/134 index b2c3c03f08..cc1e35eb16 100755 --- a/tests/qemu-iotests/134 +++ b/tests/qemu-iotests/134 @@ -39,6 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow qcow2 _supported_proto file +_require_secret size=128M diff --git a/tests/qemu-iotests/158 b/tests/qemu-iotests/158 index 3a9ad7eed0..8fc4e98653 100755 --- a/tests/qemu-iotests/158 +++ b/tests/qemu-iotests/158 @@ -39,6 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow qcow2 _supported_proto file +_require_secret size=128M diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index e977cb4eb6..10d83d8361 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -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