@samitouri / QOSamiQemu / commits / 73baa14be2

tests: skip HMP-dependent tests when HMP is disabled

Add runtime detection of HMP availability so tests gracefully skip instead of failing when QEMU is built without HMP support. For qtests (drive_del-test), use compile-time #ifndef CONFIG_HMP guards. For bash iotests, add _require_hmp() to common.rc that probes QEMU. For Python iotests, add _verify_hmp() and a require_hmp parameter threaded through execute_setup_common()/main()/script_initialize()/ script_main(). An earlier version of this series did an almost-complete conversion of the tests to QMP. However, this made the series even longer. I decided to post-pone it for now. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Marc-Andre Lureau <marcandre.lureau@redhat.com> Message-ID: <20260828-qemu-no-hmp-v5-29-9227de146347@redhat.com>

Marc-André Lureau committed Aug 28, 2026 at 16:04 UTC 73baa14be2d500af23475c897b5d31ba18dd812a
74 files changed +156 -37
tests/qemu-iotests/028
+1
@@ -49,6 +49,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
49 _supported_fmt qcow2 qed
50 _supported_proto file fuse
51 _supported_os Linux
52 +_require_hmp
53
54 # Choose a size that is not necessarily a cluster size multiple for image
55 # formats that use clusters. This will ensure that the base image doesn't end
tests/qemu-iotests/045
+2 -1
@@ -172,4 +172,5 @@ class TestSCMFd(iotests.QMPTestCase):
172
173 if __name__ == '__main__':
174 iotests.main(supported_fmts=['raw'],
175 - supported_protocols=['file'])
175 + supported_protocols=['file'],
176 + require_hmp=True)
tests/qemu-iotests/051
+1
@@ -45,6 +45,7 @@ _supported_proto file
45 _unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file \
46 compression_type
47 _require_drivers nbd
48 +_require_hmp
49
50 if [ "$QEMU_DEFAULT_MACHINE" = "pc" ]; then
51 _require_devices lsi53c895a
tests/qemu-iotests/056
+2 -1
@@ -332,4 +332,5 @@ class BackupTest(iotests.QMPTestCase):
332
333 if __name__ == '__main__':
334 iotests.main(supported_fmts=['qcow2', 'qed'],
335 - supported_protocols=['file'])
335 + supported_protocols=['file'],
336 + require_hmp=True)
tests/qemu-iotests/060
+1
@@ -56,6 +56,7 @@ _unsupported_imgopts 'compat=0.10' data_file \
56
57 # The repair process will create a large file - so check for availability first
58 _require_large_file 64G
59 +_require_hmp
60
61 rt_offset=65536 # 0x10000 (XXX: just an assumption)
62 rb_offset=131072 # 0x20000 (XXX: just an assumption)
tests/qemu-iotests/068
+1
@@ -43,6 +43,7 @@ _supported_proto generic
43 # Internal snapshots are (currently) impossible with refcount_bits=1,
44 # and generally impossible with external data files
45 _unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
46 +_require_hmp
47
48 IMG_SIZE=128K
49
tests/qemu-iotests/071
+1
@@ -43,6 +43,7 @@ _require_drivers blkdebug blkverify
43 # blkdebug can only inject errors on bs->file, not on the data_file,
44 # so this test does not work with external data files
45 _unsupported_imgopts data_file
46 +_require_hmp
47
48 do_run_qemu()
49 {
tests/qemu-iotests/081
+1
@@ -44,6 +44,7 @@ _supported_proto file
44 _supported_os Linux
45 _require_drivers quorum
46 _require_devices virtio-scsi
47 +_require_hmp
48
49 do_run_qemu()
50 {
tests/qemu-iotests/091
+1
@@ -48,6 +48,7 @@ _supported_fmt qcow2
48 _supported_proto file fuse
49 _supported_os Linux
50 _supported_cache_modes writethrough none writeback
51 +_require_hmp
52 _default_cache_mode none writeback
53
54 size=1G
tests/qemu-iotests/093
+2 -1
@@ -419,4 +419,5 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase):
419 if __name__ == '__main__':
420 if 'null-co' not in iotests.supported_formats():
421 iotests.notrun('null-co driver support missing')
422 - iotests.main(supported_fmts=["raw"])
422 + iotests.main(supported_fmts=["raw"],
423 + require_hmp=True)
tests/qemu-iotests/102
+1
@@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
41
42 _supported_fmt qcow2
43 _supported_proto file fuse
44 +_require_hmp
45
46 IMG_SIZE=64K
47
tests/qemu-iotests/117
+1
@@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
41
42 _supported_fmt qcow2
43 _supported_proto file fuse
44 +_require_hmp
45
46 _make_test_img 64k
47
tests/qemu-iotests/119
+1
@@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
41 _supported_fmt raw
42 _supported_proto nbd
43 _supported_os Linux
44 +_require_hmp
45
46 _make_test_img 64M
47 # This should not crash
tests/qemu-iotests/120
+1
@@ -42,6 +42,7 @@ _supported_fmt generic
42 _supported_proto file fuse
43 _unsupported_fmt luks
44 _require_drivers raw
45 +_require_hmp
46
47 _make_test_img 64M
48
tests/qemu-iotests/124
+2 -1
@@ -750,4 +750,5 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase):
750
751 if __name__ == '__main__':
752 iotests.main(supported_fmts=['qcow2'],
753 - supported_protocols=['file'])
753 + supported_protocols=['file'],
754 + require_hmp=True)
tests/qemu-iotests/130
+1
@@ -46,6 +46,7 @@ _supported_proto file
46 _supported_os Linux
47 # We are going to use lazy-refcounts
48 _unsupported_imgopts 'compat=0.10'
49 +_require_hmp
50
51 qemu_comm_method="monitor"
52
tests/qemu-iotests/132
+2 -1
@@ -57,4 +57,5 @@ class TestSingleDrive(iotests.QMPTestCase):
57
58 if __name__ == '__main__':
59 iotests.main(supported_fmts=['raw', 'qcow2'],
60 - supported_protocols=['file'])
60 + supported_protocols=['file'],
61 + require_hmp=True)
tests/qemu-iotests/136
+2 -1
@@ -410,4 +410,5 @@ class BlockDeviceStatsTestCoroutine(BlockDeviceStatsTestCase):
410 if __name__ == '__main__':
411 if 'null-co' not in iotests.supported_formats():
412 iotests.notrun('null-co driver support missing')
413 - iotests.main(supported_fmts=["raw"])
413 + iotests.main(supported_fmts=["raw"],
414 + require_hmp=True)
tests/qemu-iotests/142
+1
@@ -43,6 +43,7 @@ _supported_proto file
43 # We test all cache modes anyway, but O_DIRECT needs to be supported
44 _default_cache_mode none
45 _supported_cache_modes none directsync
46 +_require_hmp
47
48 do_run_qemu()
49 {
tests/qemu-iotests/145
+1
@@ -40,6 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
40
41 _supported_fmt generic
42 _supported_proto generic
43 +_require_hmp
44
45 _make_test_img 1M
46
tests/qemu-iotests/146
+1
@@ -42,6 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
42 _supported_fmt vpc
43 _supported_proto file
44 _supported_os Linux
45 +_require_hmp
46
47
48 qemu_comm_method="monitor"
tests/qemu-iotests/148
+2 -1
@@ -140,4 +140,5 @@ class TestFifoQuorumEvents(TestQuorumEvents):
140 if __name__ == '__main__':
141 iotests.verify_quorum()
142 iotests.main(supported_fmts=["raw"],
143 - supported_protocols=["file"])
143 + supported_protocols=["file"],
144 + require_hmp=True)
tests/qemu-iotests/151
+2 -1
@@ -434,4 +434,5 @@ class TestHighThrottledWithNbdExport(TestThrottledWithNbdExportBase):
434
435 if __name__ == '__main__':
436 iotests.main(supported_fmts=['qcow2', 'raw'],
437 - supported_protocols=['file'])
437 + supported_protocols=['file'],
438 + require_hmp=True)
tests/qemu-iotests/152
+2 -1
@@ -61,4 +61,5 @@ class TestUnaligned(iotests.QMPTestCase):
61
62 if __name__ == '__main__':
63 iotests.main(supported_fmts=['raw', 'qcow2'],
64 - supported_protocols=['file'])
64 + supported_protocols=['file'],
65 + require_hmp=True)
tests/qemu-iotests/153
+1
@@ -59,6 +59,7 @@ _check_ofd || _notrun "OFD lock not available"
59
60 _supported_fmt qcow2
61 _supported_proto file
62 +_require_hmp
63
64 _run_cmd()
65 {
tests/qemu-iotests/156
+1
@@ -53,6 +53,7 @@ _supported_fmt qcow2 qed
53 _supported_proto file
54 # Copying files around with cp does not work with external data files
55 _unsupported_imgopts data_file
56 +_require_hmp
57
58 # Create source disk
59 TEST_IMG="$TEST_IMG.backing" _make_test_img 1M
tests/qemu-iotests/157
+1
@@ -41,6 +41,7 @@ _supported_fmt generic
41 _supported_proto file
42
43 _require_devices virtio-blk
44 +_require_hmp
45
46 do_run_qemu()
47 {
tests/qemu-iotests/161
+1
@@ -45,6 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
45 _supported_fmt qcow2 qed
46 _supported_proto file fuse
47 _supported_os Linux
48 +_require_hmp
49
50 IMG_SIZE=1M
51
tests/qemu-iotests/165
+2 -1
@@ -154,4 +154,5 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
154 if __name__ == '__main__':
155 iotests.main(supported_fmts=['qcow2'],
156 supported_protocols=['file'],
157 - unsupported_imgopts=['compat'])
157 + unsupported_imgopts=['compat'],
158 + require_hmp=True)
tests/qemu-iotests/172
+1
@@ -42,6 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
42 _supported_fmt qcow2
43 _supported_proto file
44 _supported_os Linux
45 +_require_hmp
46
47 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
48 _notrun "Requires a PC machine"
tests/qemu-iotests/181
+1
@@ -47,6 +47,7 @@ _supported_fmt generic
47 _unsupported_fmt qcow vdi vhdx vmdk vpc vvfat parallels
48 _supported_proto generic
49 _supported_os Linux
50 +_require_hmp
51
52 _flaky_test https://gitlab.com/qemu-project/qemu/-/work_items/3515
53
tests/qemu-iotests/185
+1
@@ -50,6 +50,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
50 _supported_fmt qcow2
51 _supported_proto file
52 _supported_os Linux
53 +_require_hmp
54 _flaky_test https://gitlab.com/qemu-project/qemu/-/issues/3270
55
56 size=$((64 * 1048576))
tests/qemu-iotests/186
+1
@@ -41,6 +41,7 @@ _supported_fmt qcow2
41 _supported_proto file fuse
42 _require_drivers null-co
43 _require_devices virtio-scsi-pci
44 +_require_hmp
45
46 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
47 _notrun "Requires a PC machine"
tests/qemu-iotests/192
+1
@@ -43,6 +43,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
43
44 _supported_fmt generic
45 _supported_proto file
46 +_require_hmp
47
48 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
49 _notrun "Requires a PC machine"
tests/qemu-iotests/201
+1
@@ -47,6 +47,7 @@ _supported_os Linux
47 # Internal snapshots are (currently) impossible with refcount_bits=1,
48 # and generally impossible with external data files
49 _unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
50 +_require_hmp
51
52 size=64M
53 _make_test_img $size
tests/qemu-iotests/216
+2 -1
@@ -25,7 +25,8 @@ from iotests import log, qemu_img, qemu_io
25
26 # Need backing file support
27 iotests.script_initialize(supported_fmts=['qcow2', 'qcow', 'qed', 'vmdk'],
28 - supported_platforms=['linux'])
28 + supported_platforms=['linux'],
29 + require_hmp=True)
30
31 log('')
32 log('=== Copy-on-read across nodes ===')
tests/qemu-iotests/225
+1
@@ -46,6 +46,7 @@ _supported_os Linux
46 _unsupported_imgopts "subformat=monolithicFlat" \
47 "subformat=twoGbMaxExtentFlat" \
48 "subformat=twoGbMaxExtentSparse"
49 +_require_hmp
50
51 TEST_IMG="$TEST_IMG.base" _make_test_img 1M
52 TEST_IMG="$TEST_IMG.not_base" _make_test_img 1M
tests/qemu-iotests/232
+1
@@ -43,6 +43,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
43 _supported_fmt generic
44 _supported_proto file
45 _supported_os Linux
46 +_require_hmp
47
48 do_run_qemu()
49 {
tests/qemu-iotests/236
+2 -1
@@ -23,7 +23,8 @@
23 import iotests
24 from iotests import log
25
26 -iotests.script_initialize(supported_fmts=['generic'])
26 +iotests.script_initialize(supported_fmts=['generic'],
27 + require_hmp=True)
28 size = 64 * 1024 * 1024
29 granularity = 64 * 1024
30
tests/qemu-iotests/245
+2 -1
@@ -1160,4 +1160,5 @@ class TestBlockdevReopen(iotests.QMPTestCase):
1160 if __name__ == '__main__':
1161 iotests.activate_logging()
1162 iotests.main(supported_fmts=["qcow2"],
1163 - supported_protocols=["file"])
1163 + supported_protocols=["file"],
1164 + require_hmp=True)
tests/qemu-iotests/246
+2 -1
@@ -24,7 +24,8 @@ import iotests
24 from iotests import log
25
26 iotests.script_initialize(supported_fmts=['qcow2'],
27 - unsupported_imgopts=['compat'])
27 + unsupported_imgopts=['compat'],
28 + require_hmp=True)
29 size = 64 * 1024 * 1024 * 1024
30 gran_small = 32 * 1024
31 gran_large = 128 * 1024
tests/qemu-iotests/249
+1
@@ -45,6 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
45 _supported_fmt qcow2 qed
46 _supported_proto file fuse
47 _supported_os Linux
48 +_require_hmp
49
50 IMG_SIZE=1M
51
tests/qemu-iotests/254
+2 -1
@@ -23,7 +23,8 @@ import iotests
23 from iotests import qemu_img_create, file_path, log
24
25 iotests.script_initialize(supported_fmts=['qcow2'],
26 - unsupported_imgopts=['compat'])
26 + unsupported_imgopts=['compat'],
27 + require_hmp=True)
28
29 disk, top = file_path('disk', 'top')
30 size = 1024 * 1024
tests/qemu-iotests/255
+2 -1
@@ -24,7 +24,8 @@
24 import iotests
25 from iotests import imgfmt
26
27 -iotests.script_initialize(supported_fmts=['qcow2'])
27 +iotests.script_initialize(supported_fmts=['qcow2'],
28 + require_hmp=True)
29
30 iotests.log('Finishing a commit job with background reads')
31 iotests.log('============================================')
tests/qemu-iotests/257
+2 -1
@@ -533,4 +533,5 @@ def main():
533
534 if __name__ == '__main__':
535 iotests.script_main(main, supported_fmts=['qcow2'],
536 - supported_protocols=['file'])
536 + supported_protocols=['file'],
537 + require_hmp=True)
tests/qemu-iotests/260
+2 -1
@@ -24,7 +24,8 @@ from iotests import qemu_img_create, file_path, log, filter_qmp_event
24
25 iotests.script_initialize(
26 supported_fmts=['qcow2'],
27 - unsupported_imgopts=['compat']
27 + unsupported_imgopts=['compat'],
28 + require_hmp=True,
29 )
30
31 base, top = file_path('base', 'top')
tests/qemu-iotests/264
+2 -1
@@ -114,4 +114,5 @@ class TestNbdReconnect(iotests.QMPTestCase):
114
115
116 if __name__ == '__main__':
117 - iotests.main(supported_fmts=['qcow2'])
117 + iotests.main(supported_fmts=['qcow2'],
118 + require_hmp=True)
tests/qemu-iotests/267
+1
@@ -48,6 +48,7 @@ _require_drivers copy-on-read
48 _unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
49
50 _require_devices virtio-blk
51 +_require_hmp
52
53 do_run_qemu()
54 {
tests/qemu-iotests/274
+2 -1
@@ -24,7 +24,8 @@ import iotests
24
25 iotests.script_initialize(supported_fmts=['qcow2'],
26 supported_platforms=['linux'],
27 - unsupported_imgopts=['refcount_bits', 'compat'])
27 + unsupported_imgopts=['refcount_bits', 'compat'],
28 + require_hmp=True)
29
30 size_short = 1 * 1024 * 1024
31 size_long = 2 * 1024 * 1024
tests/qemu-iotests/280
+1
@@ -27,6 +27,7 @@ iotests.script_initialize(
27 supported_fmts=['qcow2'],
28 supported_protocols=['file'],
29 supported_platforms=['linux'],
30 + require_hmp=True,
31 )
32
33 with iotests.FilePath('base') as base_path , \
tests/qemu-iotests/281
+2 -1
@@ -336,4 +336,5 @@ class TestYieldingAndTimers(iotests.QMPTestCase):
336 if __name__ == '__main__':
337 iotests.main(supported_fmts=['qcow2'],
338 supported_protocols=['file'],
339 - unsupported_imgopts=['compat'])
339 + unsupported_imgopts=['compat'],
340 + require_hmp=True)
tests/qemu-iotests/283
+1
@@ -24,6 +24,7 @@ import iotests
24 # The test is unrelated to formats, restrict it to qcow2 to avoid extra runs
25 iotests.script_initialize(
26 supported_fmts=['qcow2'],
27 + require_hmp=True,
28 )
29
30 size = 1024 * 1024
tests/qemu-iotests/286
+1
@@ -40,6 +40,7 @@ _supported_proto file fuse
40 # Internal snapshots are (currently) impossible with refcount_bits=1,
41 # and generally impossible with external data files
42 _unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
43 +_require_hmp
44
45 _make_test_img 64M
46
tests/qemu-iotests/298
+2 -1
@@ -177,4 +177,5 @@ class TestTruncate(iotests.QMPTestCase):
177
178
179 if __name__ == '__main__':
180 - iotests.main(supported_fmts=['qcow2'], required_fmts=['preallocate'])
180 + iotests.main(supported_fmts=['qcow2'], required_fmts=['preallocate'],
181 + require_hmp=True)
tests/qemu-iotests/300
+2 -1
@@ -683,4 +683,5 @@ class TestAliasTransformMigration(TestDirtyBitmapMigration):
683 self.verify_dest_error(None)
684
685 if __name__ == '__main__':
686 - iotests.main(supported_protocols=['file'])
686 + iotests.main(supported_protocols=['file'],
687 + require_hmp=True)
tests/qemu-iotests/304
+2 -1
@@ -24,7 +24,8 @@ import iotests
24 from iotests import qemu_img_create, qemu_img_log, file_path
25
26 iotests.script_initialize(supported_fmts=['qcow2'],
27 - supported_protocols=['file'])
27 + supported_protocols=['file'],
28 + require_hmp=True)
29
30 test_img = file_path('test.qcow2')
31 target_img = file_path('target.qcow2')
tests/qemu-iotests/310
+2 -1
@@ -25,7 +25,8 @@ from iotests import log, qemu_img, qemu_io
25
26 # Need backing file support
27 iotests.script_initialize(supported_fmts=['qcow2'],
28 - supported_platforms=['linux'])
28 + supported_platforms=['linux'],
29 + require_hmp=True)
30
31 log('')
32 log('=== Copy-on-read across nodes ===')
tests/qemu-iotests/common.rc
+8
@@ -995,6 +995,14 @@ _notrun_on_fuse_error()
995 esac
996 }
997
998 +_require_hmp()
999 +{
1000 + if echo quit | $QEMU -M none -display none -monitor stdio 2>&1 |
1001 + grep -q "HMP monitor is not available"; then
1002 + _notrun "HMP monitor not available"
1003 + fi
1004 +}
1005 +
1006 # Check that we have a file system that allows huge (but very sparse) files
1007 #
1008 _require_large_file()
tests/qemu-iotests/iotests.py
+13 -1
@@ -1456,6 +1456,15 @@ def _verify_formats(required_formats: Sequence[str] = ()) -> None:
1456 notrun(f'formats {usf_list} are not whitelisted')
1457
1458
1459 +def _verify_hmp() -> None:
1460 + args = [qemu_prog] + qemu_opts + ['-M', 'none', '-monitor', 'stdio']
1461 + with subprocess.Popen(args, stdin=subprocess.PIPE,
1462 + stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
1463 + universal_newlines=True) as subp:
1464 + out, _ = subp.communicate('quit\n')
1465 + if 'HMP monitor is not available' in out:
1466 + notrun('HMP monitor not available')
1467 +
1468 def _verify_virtio_blk() -> None:
1469 out = qemu_pipe('-M', 'none', '-device', 'help')
1470 if 'virtio-blk' not in out:
@@ -1694,7 +1703,8 @@ def execute_setup_common(supported_fmts: Sequence[str] = (),
1703 supported_protocols: Sequence[str] = (),
1704 unsupported_protocols: Sequence[str] = (),
1705 required_fmts: Sequence[str] = (),
1697 - unsupported_imgopts: Sequence[str] = ()) -> bool:
1706 + unsupported_imgopts: Sequence[str] = (),
1707 + require_hmp: bool = False) -> bool:
1708 """
1709 Perform necessary setup for either script-style or unittest-style tests.
1710
@@ -1715,6 +1725,8 @@ def execute_setup_common(supported_fmts: Sequence[str] = (),
1725 _verify_formats(required_fmts)
1726 _verify_virtio_blk()
1727 _verify_imgopts(unsupported_imgopts)
1728 + if require_hmp:
1729 + _verify_hmp()
1730
1731 return debug
1732
tests/qemu-iotests/tests/backup-discard-source
+2 -1
@@ -160,4 +160,5 @@ class TestBackup(iotests.QMPTestCase):
160
161 if __name__ == '__main__':
162 iotests.main(supported_fmts=['qcow2'],
163 - supported_protocols=['file'])
163 + supported_protocols=['file'],
164 + require_hmp=True)
tests/qemu-iotests/tests/copy-before-write
+2 -1
@@ -321,4 +321,5 @@ wrote 524288/524288 bytes at offset 524288
321 if __name__ == '__main__':
322 iotests.main(supported_fmts=['qcow2'],
323 supported_protocols=['file'],
324 - required_fmts=['copy-before-write'])
324 + required_fmts=['copy-before-write'],
325 + require_hmp=True)
tests/qemu-iotests/tests/image-fleecing
+2 -1
@@ -31,7 +31,8 @@ iotests.script_initialize(
31 supported_fmts=['qcow2'],
32 supported_platforms=['linux'],
33 required_fmts=['copy-before-write'],
34 - unsupported_imgopts=['compat']
34 + unsupported_imgopts=['compat'],
35 + require_hmp=True,
36 )
37
38 patterns = [('0x5d', '0', '64k'),
tests/qemu-iotests/tests/iothreads-create
+2 -1
@@ -22,7 +22,8 @@ import asyncio
22 import iotests
23
24 iotests.script_initialize(supported_fmts=['qcow2', 'qcow', 'qed', 'vdi',
25 - 'vmdk', 'parallels'])
25 + 'vmdk', 'parallels'],
26 + require_hmp=True)
27 iotests.verify_virtio_scsi_pci_or_ccw()
28
29 with iotests.FilePath('disk.img') as img_path, \
tests/qemu-iotests/tests/luks-detached-header
+2 -1
@@ -313,4 +313,5 @@ class TestDetachedLUKSHeader(QMPTestCase):
313
314 if __name__ == "__main__":
315 # Test image creation and I/O
316 - iotests.main(supported_fmts=["luks"], supported_protocols=["file"])
316 + iotests.main(supported_fmts=["luks"], supported_protocols=["file"],
317 + require_hmp=True)
tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
+2 -1
@@ -279,4 +279,5 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase):
279
280 if __name__ == '__main__':
281 iotests.main(supported_fmts=['qcow2'],
282 - unsupported_imgopts=['compat'])
282 + unsupported_imgopts=['compat'],
283 + require_hmp=True)
tests/qemu-iotests/tests/migrate-bitmaps-test
+2 -1
@@ -329,7 +329,8 @@ def main() -> None:
329 iotests.main(
330 supported_fmts=['qcow2'],
331 supported_protocols=['file'],
332 - unsupported_imgopts=['compat']
332 + unsupported_imgopts=['compat'],
333 + require_hmp=True,
334 )
335
336
tests/qemu-iotests/tests/mirror-change-copy-mode
+2 -1
@@ -190,4 +190,5 @@ class TestMirrorChangeCopyMode(iotests.QMPTestCase):
190
191 if __name__ == '__main__':
192 iotests.main(supported_fmts=['qcow2', 'raw'],
193 - supported_protocols=['file'])
193 + supported_protocols=['file'],
194 + require_hmp=True)
tests/qemu-iotests/tests/mirror-ready-cancel-error
+2 -1
@@ -139,4 +139,5 @@ if __name__ == '__main__':
139 # LUKS would require special key-secret handling in add_blockdevs()
140 iotests.main(supported_fmts=['generic'],
141 unsupported_fmts=['luks'],
142 - supported_protocols=['file'])
142 + supported_protocols=['file'],
143 + require_hmp=True)
tests/qemu-iotests/tests/qcow2-internal-snapshots
+1
@@ -43,6 +43,7 @@ _supported_proto file
43 # Internal snapshots are (currently) impossible with refcount_bits=1,
44 # and generally impossible with external data files
45 _unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file
46 +_require_hmp
47
48 IMG_SIZE=64M
49
tests/qemu-iotests/tests/qsd-migrate
+2 -1
@@ -24,7 +24,8 @@ from iotests import filter_qemu_io, filter_qtest
24
25 iotests.script_initialize(supported_fmts=['qcow2', 'qed', 'raw'],
26 supported_protocols=['file'],
27 - supported_platforms=['linux'])
27 + supported_platforms=['linux'],
28 + require_hmp=True)
29
30 with iotests.FilePath('disk.img') as path, \
31 iotests.FilePath('nbd-src.sock', base_dir=iotests.sock_dir) as nbd_src, \
tests/qemu-iotests/tests/reopen-file
+2 -1
@@ -85,4 +85,5 @@ if __name__ == '__main__':
85 # Must support creating images and reopen
86 iotests.main(supported_fmts=['qcow', 'qcow2', 'qed', 'raw', 'vdi', 'vhdx',
87 'vmdk', 'vpc'],
88 - supported_protocols=['file'])
88 + supported_protocols=['file'],
89 + require_hmp=True)
tests/qemu-iotests/tests/write-zeroes-unmap
+1
@@ -33,6 +33,7 @@ _supported_fmt raw
33 _supported_proto file
34 _supported_os Linux
35 _require_disk_usage
36 +_require_hmp
37
38 create_test_image() {
39 _make_test_img -f $IMGFMT 1m
tests/qtest/drive_del-test.c
+25
@@ -167,6 +167,11 @@ static void test_drive_without_dev(void)
167 {
168 QTestState *qts;
169
170 +#ifndef CONFIG_HMP
171 + g_test_skip("HMP not enabled");
172 + return;
173 +#endif
174 +
175 /* Start with an empty drive */
176 qts = qtest_init("-drive if=none,id=drive0 -M none");
177
@@ -187,6 +192,11 @@ static void test_after_failed_device_add(void)
192 QDict *response;
193 QTestState *qts;
194
195 +#ifndef CONFIG_HMP
196 + g_test_skip("HMP not enabled");
197 + return;
198 +#endif
199 +
200 if (!has_device_builtin("virtio-blk")) {
201 g_test_skip("Device virtio-blk is not available");
202 return;
@@ -223,6 +233,11 @@ static void test_drive_del_device_del(void)
233 {
234 QTestState *qts;
235
236 +#ifndef CONFIG_HMP
237 + g_test_skip("HMP not enabled");
238 + return;
239 +#endif
240 +
241 if (!has_device_builtin("virtio-scsi")) {
242 g_test_skip("Device virtio-scsi is not available");
243 return;
@@ -405,6 +420,11 @@ static void test_drive_add_device_add_and_del(void)
420 const char *arch = qtest_get_arch();
421 const char *machine_addition = "";
422
423 +#ifndef CONFIG_HMP
424 + g_test_skip("HMP not enabled");
425 + return;
426 +#endif
427 +
428 if (!has_device_builtin("virtio-blk")) {
429 g_test_skip("Device virtio-blk is not available");
430 return;
@@ -436,6 +456,11 @@ static void test_drive_add_device_add_and_del_q35(void)
456 {
457 QTestState *qts;
458
459 +#ifndef CONFIG_HMP
460 + g_test_skip("HMP not enabled");
461 + return;
462 +#endif
463 +
464 if (!has_device_builtin("virtio-blk")) {
465 g_test_skip("Device virtio-blk is not available");
466 return;
tests/qtest/ide-test.c
+4
@@ -1455,6 +1455,10 @@ static void test_migrate_chs_snapshot(void)
1455 char marker[9];
1456 int fd;
1457
1458 +#ifndef CONFIG_HMP
1459 + g_test_skip("HMP not enabled");
1460 + return;
1461 +#endif
1462 if (!have_qemu_img()) {
1463 g_test_skip("QTEST_QEMU_IMG not set, snapshots need a qcow2 image");
1464 return;