Skip to contentSkip to conversation

fix tests on FreeBSD

PATCH In review Roman Bogorodskiy 3 participants 13 messages Nov 22 – Nov 23

lore
Share & tools
lore
#0 lore raw

cover fix tests on FreeBSD

This series fixes test failures on FreeBSD. Most of the affected tests happen to be iotests.

This brings full test run from:

Ok:                1253
Fail:              72
Skipped:           669
Timeout:           2

to:

Ok:                1343
Fail:              0
Skipped:           653

thus, a successful run.

Roman Bogorodskiy (10):
iotests: use gsed instead of sed
iotests: fix default QEMU_PROG on FreeBSD amd64
iotests: fix the dd() wrapper
tests/qtest: unset socket timeout
iotests: skip preallocation tests if not supported
iotests: mark 149 as Linux-only
iotests: fix test 162
iotests: fix possible race in 145
iotests: properly skip tests that require OFD locking support
iotests: fix test 211

 tests/qemu-iotests/115                        |  2 +-
 tests/qemu-iotests/145                        |  5 +++-
 tests/qemu-iotests/149                        |  3 ++-
 tests/qemu-iotests/162                        | 14 +++++++---
 tests/qemu-iotests/211                        | 19 +++++++++++++-
 tests/qemu-iotests/211.out                    |  1 -
 tests/qemu-iotests/296                        |  1 +
 tests/qemu-iotests/298                        | 10 +++++++
 tests/qemu-iotests/common.filter              | 26 +++++++++----------
 tests/qemu-iotests/common.rc                  |  3 +++
 tests/qemu-iotests/iotests.py                 | 16 ++++++++++++
 tests/qemu-iotests/testenv.py                 |  2 ++
 .../qemu-iotests/tests/migration-permissions  |  3 +++
 tests/qemu-iotests/tests/mirror-top-perms     |  3 +++
 tests/qtest/libqtest.c                        | 13 ++++++++++
 15 files changed, 100 insertions(+), 21 deletions(-)
Signature · 1 line
2.56.0
#1 lore raw

PATCH 1/10 iotests: use gsed instead of sed

Some iotests fail on FreeBSD because the tests call sed directly, and BSD sed is not always compatible with GNU sed. As common.rc already provides the gsed() wrapper, use it instead.

---
 tests/qemu-iotests/115           |  2 +-
 tests/qemu-iotests/common.filter | 26 +++++++++++++-------------
 2 files changed, 14 insertions(+), 14 deletions(-)
tests/qemu-iotests/115 +1 -1
index 5c8a12f85a..e3ff91de7a 100755
@@ -78,7 +78,7 @@ _make_test_img -o "refcount_bits=64,cluster_size=512,preallocation=metadata" 256
 # qemu-img check for that purpose, too.
 
 $QEMU_IMG check "$TEST_IMG" | \
-    sed -e 's/^.* = \([0-9]\+\.[0-9]\+% allocated\).*\(clusters\)$/\1 \2/' \
+    gsed -e 's/^.* = \([0-9]\+\.[0-9]\+% allocated\).*\(clusters\)$/\1 \2/' \
         -e '/^Image end offset/d'
 
 # (Note that we cannot use _check_test_img because that function filters out the
tests/qemu-iotests/common.filter +13 -13
index ce4213cb97..ed31249515 100644
@@ -21,18 +21,18 @@
 
 _filter_date()
 {
-    sed -Ee 's/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/yyyy-mm-dd hh:mm:ss/'
+    gsed -Ee 's/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/yyyy-mm-dd hh:mm:ss/'
 }
 
 _filter_vmstate_size()
 {
-    sed -E -e 's/[0-9. ]{5} [KMGT]iB/     SIZE/' \
+    gsed -E -e 's/[0-9. ]{5} [KMGT]iB/     SIZE/' \
            -e 's/[0-9. ]{5} B/   SIZE/'
 }
 
 _filter_generated_node_ids()
 {
-    sed -Ee 's/\#block[0-9]{3,}/NODE_NAME/'
+    gsed -Ee 's/\#block[0-9]{3,}/NODE_NAME/'
 }
 
 _filter_qom_path()
@@ -43,7 +43,7 @@ _filter_qom_path()
 # replace occurrences of the actual TEST_DIR value with TEST_DIR
 _filter_testdir()
 {
-    sed -e "s#$TEST_DIR/#TEST_DIR/#g" \
+    gsed -e "s#$TEST_DIR/#TEST_DIR/#g" \
         -e "s#$SOCK_DIR/#SOCK_DIR/#g" \
         -e "s#SOCK_DIR/fuse-#TEST_DIR/#g"
 }
@@ -51,7 +51,7 @@ _filter_testdir()
 # replace occurrences of the actual IMGFMT value with IMGFMT
 _filter_imgfmt()
 {
-    sed -e "s#$IMGFMT#IMGFMT#g"
+    gsed -e "s#$IMGFMT#IMGFMT#g"
 }
 
 # Replace error message when the format is not supported and delete
@@ -89,7 +89,7 @@ _filter_qemu()
 # replace occurrences of QEMU_IMG_PROG with "qemu-img"
 _filter_qemu_img()
 {
-    sed -e "s#$QEMU_IMG_PROG#qemu-img#g"
+    gsed -e "s#$QEMU_IMG_PROG#qemu-img#g"
 }
 
 # replace problematic QMP output like timestamps
@@ -130,7 +130,7 @@ _filter_actual_image_size()
 # Filename filters for qemu-img create
 _filter_img_create_filenames()
 {
-    sed \
+    gsed \
         -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
         -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
         -e "s#$TEST_DIR#TEST_DIR#g" \
@@ -178,7 +178,7 @@ _do_filter_img_create()
         | grep -a -e '^fmt' -e '^size' -e '^backing' -e '^preallocation' \
                   -e '^encryption' "${grep_data_file[@]}" \
         | _filter_img_create_filenames \
-        | sed \
+        | gsed \
             -e 's/^\(fmt\)/0-\1/' \
             -e 's/^\(size\)/1-\1/' \
             -e 's/^\(backing\)/2-\1/' \
@@ -186,9 +186,9 @@ _do_filter_img_create()
             -e 's/^\(encryption\)/4-\1/' \
             -e 's/^\(preallocation\)/8-\1/' \
         | LC_ALL=C sort \
-        | sed -e 's/^[0-9]-//' \
+        | gsed -e 's/^[0-9]-//' \
         | tr '\n\0' ' \n' \
-        | sed -e 's/^ *$//' -e 's/ *$//'
+        | gsed -e 's/^ *$//' -e 's/ *$//'
     )
 
     if [ -n "$options" ]; then
@@ -296,7 +296,7 @@ _filter_qemu_img_map()
         data_file_filter=(-e "s#$data_file_pattern#\\1#")
     fi
 
-    sed -e 's/\([0-9a-fx]* *[0-9a-fx]* *\)[0-9a-fx]* */\1/g' \
+    gsed -e 's/\([0-9a-fx]* *[0-9a-fx]* *\)[0-9a-fx]* */\1/g' \
         -e 's/"offset": [0-9]\+/"offset": OFFSET/g' \
         -e 's/Mapped to *//' \
         "${data_file_filter[@]}" \
@@ -310,7 +310,7 @@ _filter_nbd()
     # receive callbacks sometimes, making them unreliable.
     #
     # Filter out the TCP port number since this changes between runs.
-    sed -e '/nbd\/.*\.c:/d' \
+    gsed -e '/nbd\/.*\.c:/d' \
         -e 's#127\.0\.0\.1:[0-9]*#127.0.0.1:PORT#g' \
         -e 's#localhost:[0-9]*#localhost:PORT#g' \
         -e 's#host=127\.0\.0\.1,port=[0-9]*#host=127.0.0.1,port=PORT#g' \
@@ -356,7 +356,7 @@ sys.stdout.write(result)'
 
 _filter_authz_check_tls()
 {
-    sed -e 's/TLS x509 authz check for .* is denied/TLS x509 authz check for DISTINGUISHED-NAME is denied/'
+    gsed -e 's/TLS x509 authz check for .* is denied/TLS x509 authz check for DISTINGUISHED-NAME is denied/'
 }
 
 _filter_qcow2_compression_type_bit()
Signature · 1 line
2.56.0
#2 lore raw

Re: [PATCH 01/10] iotests: use gsed instead of sed

Quoted 16 lines · Roman Bogorodskiy

Some iotests fail on FreeBSD because the tests call sed directly, and BSD sed is not always compatible with GNU sed. As common.rc already provides the gsed() wrapper, use it instead.

---
  tests/qemu-iotests/115           |  2 +-
  tests/qemu-iotests/common.filter | 26 +++++++++++++-------------
  2 files changed, 14 insertions(+), 14 deletions(-)
tests/qemu-iotests/115 +0 -0
index 5c8a12f85a..e3ff91de7a 100755

tests/qemu-iotests/115 _make_test_img -o "refcount_bits=64,cluster_size=512,preallocation=metadata" 256 · line 82

Quoted 6 lines
tests/qemu-iotests/115 +1 -1
@@ -78,7 +78,7 @@ _make_test_img -o "refcount_bits=64,cluster_size=512,preallocation=metadata" 256
  # qemu-img check for that purpose, too.
 
  $QEMU_IMG check "$TEST_IMG" | \
-    sed -e 's/^.* = \([0-9]\+\.[0-9]\+% allocated\).*\(clusters\)$/\1 \2/' \
+    gsed -e 's/^.* = \([0-9]\+\.[0-9]\+% allocated\).*\(clusters\)$/\1 \2/' \
          -e '/^Image end offset/d'

See for history:
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/

#3 lore raw

PATCH 2/10 iotests: fix default QEMU_PROG on FreeBSD amd64

In reply to Roman Bogorodskiy

testenv.py uses 'qemu-system-{arch}' as a default value for QEMU_PROG and it obtains arch from os.uname().machine. As FreeBSD reports it as 'amd64', normalize it to 'x86_64' to use a proper qemu-system binary by default.

---
 tests/qemu-iotests/testenv.py | 2 ++
 1 file changed, 2 insertions(+)
tests/qemu-iotests/testenv.py +2 -0
index 53c9b5d196..20595e680f 100644
@@ -171,6 +171,8 @@ def root(*names: str) -> str:
         arch = os.uname().machine
         if 'ppc64' in arch:
             arch = 'ppc64'
+        elif arch == 'amd64':
+            arch = 'x86_64'
 
         self.qemu_prog = os.getenv('QEMU_PROG', root(f'qemu-system-{arch}'))
         if not os.path.exists(self.qemu_prog):
Signature · 1 line
2.56.0
#4 lore raw

PATCH 3/10 iotests: fix the dd() wrapper

In reply to Roman Bogorodskiy

The dd() wrapper already uses status=noxfer on Linux. Use the same for FreeBSD to fix its consumers.

Add a separate "elif" block rather than extending the already existing Linux block as dd on FreeBSD does not support --help.
The "status=noxfer" is supported since FreeBSD 9.3 and 10.1, so it's been long enough to use it without a check.

---
 tests/qemu-iotests/common.rc | 3 +++
 1 file changed, 3 insertions(+)
tests/qemu-iotests/common.rc +3 -0
index 262fe63da8..82a6b1b5c4 100644
@@ -64,6 +64,9 @@ dd()
             else
                 command dd $@
             fi
+   elif [ "$HOSTOS" == "FreeBSD" ]
+   then
+        command dd status=noxfer $@
    else
         command dd $@
    fi
Signature · 1 line
2.56.0
#5 lore raw

Re: [PATCH 03/10] iotests: fix the dd() wrapper

Quoted 18 lines · Roman Bogorodskiy

The dd() wrapper already uses status=noxfer on Linux. Use the same for FreeBSD to fix its consumers.

Add a separate "elif" block rather than extending the already existing Linux block as dd on FreeBSD does not support --help.
The "status=noxfer" is supported since FreeBSD 9.3 and 10.1, so it's been long enough to use it without a check.

---
  tests/qemu-iotests/common.rc | 3 +++
  1 file changed, 3 insertions(+)
tests/qemu-iotests/common.rc +0 -0
index 262fe63da8..82a6b1b5c4 100644

tests/qemu-iotests/common.rc dd() · line 72

Quoted 9 lines
tests/qemu-iotests/common.rc +3 -0
@@ -64,6 +64,9 @@ dd()
              else
                  command dd $@
              fi
+   elif [ "$HOSTOS" == "FreeBSD" ]
+   then
+        command dd status=noxfer $@
     else
          command dd $@
     fi

|Instead of adding another $HOSTOS check, I think it would be better to check if dd supports status=noxfer, and not rely on --help either. That way it works on any OS that supports it, without OS-specific checks. |

tests/qemu-iotests/common.rc +8 -13
index 262fe63da820..c18ff7d72039 100644
@@ -28,6 +28,13 @@ arch=$(uname -m)
 # make sure we have a standard umask
 umask 022
 
+if command dd if=/dev/null of=/dev/null status=noxfer >/dev/null 2>&1
+then
+    DD_NOXFER="status=noxfer"
+else
+    DD_NOXFER=""
+fi
+
 # bail out, setting up .notrun file
 _notrun()
 {
@@ -54,19 +61,7 @@ fi
 
 dd()
 {
-   if [ "$HOSTOS" == "Linux" ]
-   then
-        command dd --help | grep noxfer > /dev/null 2>&1
-
-        if [ "$?" -eq 0 ]
-            then
-                command dd status=noxfer $@
-            else
-                command dd $@
-            fi
-   else
-        command dd $@
-   fi
+    command dd $DD_NOXFER "$@"
 }
 
 # poke_file 'test.img' 512 '\xff\xfe'
#6 lore raw

PATCH 4/10 tests/qtest: unset socket timeout

In reply to Roman Bogorodskiy

The qtest_socket_accept() sets a timeout on a listening socket. FreeBSD also inherits this timeout for the accepted socket, which breaks some tests. Explicitly set timeout on the accepted socket to 0.

---
 tests/qtest/libqtest.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
tests/qtest/libqtest.c +13 -0
index 7f66c1bbb3..c3d84f9ca9 100644
@@ -151,6 +151,19 @@ static int qtest_socket_accept(QTestState *s, int sock)
     }
     if (ret == -1) {
         fprintf(stderr, "%s failed: %s\n", __func__, strerror(errno));
+    } else {
+        /*
+         * Accepted sockets might inherit listener's timeout on
+         * some systems, so set it to 0 explicitly
+         */
+        memset(&timeout, 0, sizeof(timeout));
+        if (setsockopt(ret, SOL_SOCKET, SO_RCVTIMEO,
+                       (void *)&timeout, sizeof(timeout))) {
+            fprintf(stderr, "%s failed to set SO_RCVTIMEO: %s\n",
+                    __func__, strerror(errno));
+            close(ret);
+            return -1;
+        }
     }
 
     return ret;
Signature · 1 line
2.56.0
#7 lore raw

Re: [PATCH 04/10] tests/qtest: unset socket timeout

Quoted 24 lines · Roman Bogorodskiy

The qtest_socket_accept() sets a timeout on a listening socket. FreeBSD also inherits this timeout for the accepted socket, which breaks some tests. Explicitly set timeout on the accepted socket to 0.

---
  tests/qtest/libqtest.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)
tests/qtest/libqtest.c +6 -0
index 7f66c1bbb3..c3d84f9ca9 100644
@@ -151,6 +151,19 @@ static int qtest_socket_accept(QTestState *s, int sock)
      }
      if (ret == -1) {
          fprintf(stderr, "%s failed: %s\n", __func__, strerror(errno));
+    } else {
+        /*
+         * Accepted sockets might inherit listener's timeout on
+         * some systems, so set it to 0 explicitly
+         */
+        memset(&timeout, 0, sizeof(timeout));

tests/qtest/libqtest.c static int qtest_socket_accept(QTestState *s, int sock) · line 169

Quoted 10 lines
tests/qtest/libqtest.c +7 -0
+        if (setsockopt(ret, SOL_SOCKET, SO_RCVTIMEO,
+                       (void *)&timeout, sizeof(timeout))) {
+            fprintf(stderr, "%s failed to set SO_RCVTIMEO: %s\n",
+                    __func__, strerror(errno));
+            close(ret);
+            return -1;
+        }
      }
 
      return ret;

|The patch looks good to me. This affects the BSDs: an accepted socket inherits SO_RCVTIMEO from the listening socket, so the 250 ms accept timeout also applies to the qtest and QMP reads. Could the comment say "BSD systems" instead of "some systems"? Reviewed-by: Brad Smith <[email protected]>|

#8 lore raw

PATCH 5/10 iotests: skip preallocation tests if not supported

In reply to Roman Bogorodskiy

Skip preallocation tests requiring efficient zero writes if not supported. Support is detected by probing "qemu-io write -z -n".

---
 tests/qemu-iotests/298 | 10 ++++++++++
 1 file changed, 10 insertions(+)
tests/qemu-iotests/298 +10 -0
index f2b94077f4..869bdb3242 100755
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+import errno
 import os
 import iotests
 
@@ -32,6 +33,15 @@ drive_opts = f'node-name=disk,driver={iotests.imgfmt},' \
 
 class TestPreallocateBase(iotests.QMPTestCase):
     def setUp(self):
+        with iotests.FilePath('zero-probe.raw') as probe_path:
+            iotests.qemu_img_create('-f', 'raw', probe_path, '1M')
+            ret = iotests.qemu_io('-f', 'raw', '-c', 'write -z -n -q 0 1M',
+                                  probe_path, check=False)
+            if ret.returncode != 0:
+                if os.strerror(errno.ENOTSUP) in ret.stdout:
+                    self.case_skip("File backend does not support "
+                                   "efficient zero writes")
+            self.assertEqual(ret.returncode, 0, ret.stdout)
         iotests.qemu_img_create('-f', iotests.imgfmt, disk, str(10 * MiB))
 
     def tearDown(self):
Signature · 1 line
2.56.0
#9 lore raw

PATCH 6/10 iotests: mark 149 as Linux-only

In reply to Roman Bogorodskiy

Test 149 requires Linux specific dm-crypt and cryptsetup, so mark it supported only on Linux.

---
 tests/qemu-iotests/149 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/qemu-iotests/149 +2 -1
index 6dff39a28a..7b7afbd539 100755
@@ -404,7 +404,8 @@ def test_once(config, qemu_img=False):
 
 
 # Obviously we only work with the luks image format
-iotests.script_initialize(supported_fmts=['luks'])
+iotests.script_initialize(supported_fmts=['luks'],
+                          supported_platforms=['linux'])
 
 # We need sudo in order to run cryptsetup to create
 # dm-crypt devices. This is safe to use on any
Signature · 1 line
2.56.0
#10 lore raw

PATCH 7/10 iotests: fix test 162

In reply to Roman Bogorodskiy

Test 162 expects Linux error messages. These messages could be different on other OSes, on FreeBSD for example. Add a _normalize_errors() helper to normalize these error messages.

---
 tests/qemu-iotests/162 | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
tests/qemu-iotests/162 +11 -3
index 4f01611886..73a0c43e2c 100755
@@ -33,6 +33,12 @@ _cleanup()
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
+_normalize_errors()
+{
+    sed -e "s/Name does not resolve/Name or service not known/" \
+        -e "s/Can't assign requested address/Connection refused/"
+}
+
 # get standard environment, filters and checks
 . ./common.rc
 . ./common.filter
@@ -45,7 +51,7 @@ echo '=== NBD ==='
 # NBD expects all of its arguments to be strings
 
 # So this should not crash
-$QEMU_IMG info 'json:{"driver": "nbd", "host": -1}'
+$QEMU_IMG info 'json:{"driver": "nbd", "host": -1}' 2>&1 | _normalize_errors
 
 # And this should not treat @port as if it had not been specified
 # (We need to set up a server here, because the error message for "Connection
@@ -78,10 +84,12 @@ echo '=== SSH ==='
 # expected to be an integer
 
 # So "0" should be converted to an integer here (instead of crashing)
-$QEMU_IMG info 'json:{"driver": "ssh", "host": "localhost", "port": "0", "path": "/foo"}'
+$QEMU_IMG info \
+    'json:{"driver": "ssh", "host": "localhost", "port": "0", "path": "/foo"}' 2>&1 | \
+        _normalize_errors
 # The same, basically (all values for --image-opts are seen as strings in qemu)
 $QEMU_IMG info --image-opts \
-    driver=ssh,host=localhost,port=0,path=/foo
+    driver=ssh,host=localhost,port=0,path=/foo 2>&1 | _normalize_errors
 
 # This, however, should fail because of the wrong type
 $QEMU_IMG info 'json:{"driver": "ssh", "host": "localhost", "port": 0.42, "path": "/foo"}'
Signature · 1 line
2.56.0
#11 lore raw

PATCH 8/10 iotests: fix possible race in 145

In reply to Roman Bogorodskiy

Test 145 uses "-incoming 'exec:true'" argument for QEMU. It is possible that it reads the migration input before processing "quit", so it'll report an error and the test will fail.

Fix by using a migration socket, similarly to how test 181 already does that.

---
 tests/qemu-iotests/145 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/qemu-iotests/145 +4 -1
index bbc3c34c19..3711250c7d 100755
@@ -25,8 +25,11 @@ echo "QA output created by $seq"
 
 status=1	# failure is the default!
 
+MIG_SOCKET="${SOCK_DIR}/migrate"
+
 _cleanup()
 {
+	rm -f "${MIG_SOCKET}"
 	_cleanup_test_img
 	true
 }
@@ -56,7 +59,7 @@ else
 fi
 
 echo quit | $QEMU -nographic $SYSEMU_EXTRA_ARGS -drive $SYSEMU_DRIVE_ARG \
-                  -incoming 'exec:true' -snapshot -serial none -monitor stdio \
+                  -incoming "unix:${MIG_SOCKET}" -snapshot -serial none -monitor stdio \
           | _filter_qemu | _filter_hmp
 
 # success, all done
Signature · 1 line
2.56.0
#12 lore raw

PATCH 9/10 iotests: properly skip tests that require OFD locking support

In reply to Roman Bogorodskiy

Tests 296, qemu-iotests/tests/migration-permissions, and tests/mirror-top-perms require OFD locking support and fail when it's not available.

Add the supports_ofd_lock() and verify_ofd_lock() helpers and use them to skip these tests when necessary.

---
 tests/qemu-iotests/296                         |  1 +
 tests/qemu-iotests/iotests.py                  | 16 ++++++++++++++++
 tests/qemu-iotests/tests/migration-permissions |  3 +++
 tests/qemu-iotests/tests/mirror-top-perms      |  3 +++
 4 files changed, 23 insertions(+)
tests/qemu-iotests/296 +1 -0
index 2b63cefff0..84fb8d0d9b 100755
@@ -273,6 +273,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase):
 
 
 if __name__ == '__main__':
+    iotests.verify_ofd_lock()
     # support only raw luks since luks encrypted qcow2 is a proper
     # format driver which doesn't allow any sharing
     iotests.activate_logging()
tests/qemu-iotests/iotests.py +16 -0
index 7017d2016c..90f25272d4 100644
@@ -1588,6 +1588,22 @@ def verify_qcow2_zstd_compression():
     if not supports_qcow2_zstd_compression():
         notrun('zstd compression not supported')
 
+def supports_ofd_lock() -> bool:
+    with FilePath('ofdlock.raw') as img_file:
+        qemu_img_create('-f', 'raw', img_file, '1M')
+        res = qemu_img('info', '--image-opts',
+                       f'driver=file,locking=on,filename={img_file}',
+                       check=False)
+        res.check_returncode()
+        if "falling back to POSIX file" in res.stdout:
+            return False
+        else:
+            return True
+
+def verify_ofd_lock():
+    if not supports_ofd_lock():
+        notrun('OFD locking is unavailable')
+
 def qemu_pipe(*args: str) -> str:
     """
     Run qemu with an option to print something and exit (e.g. a help option).
tests/qemu-iotests/tests/migration-permissions +3 -0
index 0deaad2d3a..7f943113e9 100755
@@ -30,6 +30,9 @@ mig_sock = os.path.join(iotests.sock_dir, 'mig.sock')
 
 class TestMigrationPermissions(iotests.QMPTestCase):
     def setUp(self):
+        if not iotests.supports_ofd_lock():
+            self.case_skip("OFD locking is unavailable")
+
         qemu_img_create('-f', imgfmt, test_img, '1M')
 
         # Set up two VMs (source and destination) accessing the same raw
tests/qemu-iotests/tests/mirror-top-perms +3 -0
index fab9907e92..653f2e4a6d 100755
@@ -33,6 +33,9 @@ source = os.path.join(iotests.test_dir, 'source.img')
 
 class TestMirrorTopPerms(iotests.QMPTestCase):
     def setUp(self):
+        if not iotests.supports_ofd_lock():
+            self.case_skip("OFD locking is unavailable")
+
         qemu_img('create', '-f', iotests.imgfmt, source, str(image_size))
         self.vm = iotests.VM()
         self.vm.add_drive(source)
Signature · 1 line
2.56.0