@@ -230,6 +230,18 @@ def create_image(config, size_mb):
fn.truncate(size_mb * 1024 * 1024)
+def check_cipher_support(config, output):
+ """Check the output of qemu-img or qemu-io for mention of the respective
+ cipher algorithm being unsupported, and if so, skip this test.
+ (Returns `output` for convenience.)"""
+
+ if 'Unsupported cipher algorithm' in output:
+ iotests.notrun('Unsupported cipher algorithm '
+ f'{config.cipher}-{config.keylen}-{config.mode}; '
+ 'consider configuring qemu with a different crypto '
+ 'backend')
+ return output
+
def qemu_img_create(config, size_mb):
"""Create and format a disk image with LUKS using qemu-img"""
@@ -253,7 +265,8 @@ def qemu_img_create(config, size_mb):
"%dM" % size_mb]
iotests.log("qemu-img " + " ".join(args), filters=[iotests.filter_test_dir])
- iotests.log(iotests.qemu_img_pipe(*args), filters=[iotests.filter_test_dir])
+ iotests.log(check_cipher_support(config, iotests.qemu_img_pipe(*args)),
+ filters=[iotests.filter_test_dir])
def qemu_io_image_args(config, dev=False):
"""Get the args for access an image or device with qemu-io"""
@@ -279,8 +292,8 @@ def qemu_io_write_pattern(config, pattern, offset_mb, size_mb, dev=False):
args = ["-c", "write -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)]
args.extend(qemu_io_image_args(config, dev))
iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir])
- iotests.log(iotests.qemu_io(*args), filters=[iotests.filter_test_dir,
- iotests.filter_qemu_io])
+ iotests.log(check_cipher_support(config, iotests.qemu_io(*args)),
+ filters=[iotests.filter_test_dir, iotests.filter_qemu_io])
def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False):
@@ -291,8 +304,8 @@ def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False):
args = ["-c", "read -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)]
args.extend(qemu_io_image_args(config, dev))
iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir])
- iotests.log(iotests.qemu_io(*args), filters=[iotests.filter_test_dir,
- iotests.filter_qemu_io])
+ iotests.log(check_cipher_support(config, iotests.qemu_io(*args)),
+ filters=[iotests.filter_test_dir, iotests.filter_qemu_io])
def test_once(config, qemu_img=False):