iotests: Restrict file Python tests to file

Most of our Python unittest-style tests only support the file protocol.
You can run them with any other protocol, but the test will simply
ignore your choice and use file anyway.

We should let them signal that they require the file protocol so they
are skipped when you want to test some other protocol.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
stable-4.2
Max Reitz 2019-09-02 21:33:18 +02:00 committed by Kevin Wolf
parent 88d2aa533a
commit 103cbc771e
26 changed files with 52 additions and 26 deletions

View File

@ -957,4 +957,5 @@ class TestSetSpeed(iotests.QMPTestCase):
self.cancel_and_wait(resume=True)
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2', 'qed'])
iotests.main(supported_fmts=['qcow2', 'qed'],
supported_protocols=['file'])

View File

@ -429,4 +429,5 @@ class TestReopenOverlay(ImageCommitTestCase):
self.run_commit_test(self.img1, self.img0)
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2', 'qed'])
iotests.main(supported_fmts=['qcow2', 'qed'],
supported_protocols=['file'])

View File

@ -1122,4 +1122,5 @@ class TestOrphanedSource(iotests.QMPTestCase):
self.assert_qmp(result, 'error/class', 'GenericError')
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2', 'qed'])
iotests.main(supported_fmts=['qcow2', 'qed'],
supported_protocols=['file'])

View File

@ -118,4 +118,5 @@ class TestRefcountTableGrowth(iotests.QMPTestCase):
pass
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
iotests.main(supported_fmts=['qcow2'],
supported_protocols=['file'])

View File

@ -175,4 +175,5 @@ class TestSCMFd(iotests.QMPTestCase):
"File descriptor named '%s' not found" % fdname)
if __name__ == '__main__':
iotests.main(supported_fmts=['raw'])
iotests.main(supported_fmts=['raw'],
supported_protocols=['file'])

View File

@ -563,4 +563,5 @@ class TestDriveCompression(iotests.QMPTestCase):
target='drive1')
if __name__ == '__main__':
iotests.main(supported_fmts=['raw', 'qcow2'])
iotests.main(supported_fmts=['raw', 'qcow2'],
supported_protocols=['file'])

View File

@ -335,4 +335,5 @@ class BackupTest(iotests.QMPTestCase):
self.dismissal_failure(True)
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2', 'qed'])
iotests.main(supported_fmts=['qcow2', 'qed'],
supported_protocols=['file'])

View File

@ -256,4 +256,5 @@ class TestSnapshotDelete(ImageSnapshotTestCase):
self.assert_qmp(result, 'error/class', 'GenericError')
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
iotests.main(supported_fmts=['qcow2'],
supported_protocols=['file'])

View File

@ -129,4 +129,5 @@ TestQemuImgInfo = None
TestQMP = None
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
iotests.main(supported_fmts=['qcow2'],
supported_protocols=['file'])

View File

@ -67,4 +67,5 @@ class TestLiveSnapshot(iotests.QMPTestCase):
self.checkConfig('target')
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
iotests.main(supported_fmts=['qcow2'],
supported_protocols=['file'])

View File

@ -717,4 +717,5 @@ if __name__ == '__main__':
iotests.qemu_default_machine)
# Need to support image creation
iotests.main(supported_fmts=['vpc', 'parallels', 'qcow', 'vdi', 'qcow2',
'vmdk', 'raw', 'vhdx', 'qed'])
'vmdk', 'raw', 'vhdx', 'qed'],
supported_protocols=['file'])

View File

@ -779,4 +779,5 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase):
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
iotests.main(supported_fmts=['qcow2'],
supported_protocols=['file'])

View File

@ -83,4 +83,5 @@ class TestStopWithBlockJob(iotests.QMPTestCase):
self.do_test_stop("block-commit", device="drive0")
if __name__ == '__main__':
iotests.main(supported_fmts=["qcow2"])
iotests.main(supported_fmts=["qcow2"],
supported_protocols=["file"])

View File

@ -56,4 +56,5 @@ class TestSingleDrive(iotests.QMPTestCase):
'target image does not match source after mirroring')
if __name__ == '__main__':
iotests.main(supported_fmts=['raw', 'qcow2'])
iotests.main(supported_fmts=['raw', 'qcow2'],
supported_protocols=['file'])

View File

@ -358,4 +358,5 @@ class TestBlockdevDel(iotests.QMPTestCase):
if __name__ == '__main__':
iotests.main(supported_fmts=["qcow2"])
iotests.main(supported_fmts=["qcow2"],
supported_protocols=["file"])

View File

@ -137,4 +137,5 @@ class TestFifoQuorumEvents(TestQuorumEvents):
if __name__ == '__main__':
iotests.verify_quorum()
iotests.main(supported_fmts=["raw"])
iotests.main(supported_fmts=["raw"],
supported_protocols=["file"])

View File

@ -142,4 +142,5 @@ class TestActiveMirror(iotests.QMPTestCase):
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2', 'raw'])
iotests.main(supported_fmts=['qcow2', 'raw'],
supported_protocols=['file'])

View File

@ -59,4 +59,5 @@ class TestUnaligned(iotests.QMPTestCase):
if __name__ == '__main__':
iotests.main(supported_fmts=['raw', 'qcow2'])
iotests.main(supported_fmts=['raw', 'qcow2'],
supported_protocols=['file'])

View File

@ -258,4 +258,5 @@ BaseClass = None
MirrorBaseClass = None
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
iotests.main(supported_fmts=['qcow2'],
supported_protocols=['file'])

View File

@ -170,4 +170,5 @@ class TestShrink1M(ShrinkBaseClass):
ShrinkBaseClass = None
if __name__ == '__main__':
iotests.main(supported_fmts=['raw', 'qcow2'])
iotests.main(supported_fmts=['raw', 'qcow2'],
supported_protocols=['file'])

View File

@ -103,4 +103,5 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
self.vm.shutdown()
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
iotests.main(supported_fmts=['qcow2'],
supported_protocols=['file'])

View File

@ -227,4 +227,5 @@ for cmb in list(itertools.product((True, False), repeat=2)):
'do_test_migration_resume_source', *list(cmb))
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
iotests.main(supported_fmts=['qcow2'],
supported_protocols=['file'])

View File

@ -63,4 +63,5 @@ class TestInvalidateAutoclear(iotests.QMPTestCase):
self.assertEqual(f.read(1), b'\x00')
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
iotests.main(supported_fmts=['qcow2'],
supported_protocols=['file'])

View File

@ -115,4 +115,5 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase):
self.assert_qmp(result, 'return/sha256', sha256);
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'], supported_cache_modes=['none'])
iotests.main(supported_fmts=['qcow2'], supported_cache_modes=['none'],
supported_protocols=['file'])

View File

@ -1000,4 +1000,5 @@ class TestBlockdevReopen(iotests.QMPTestCase):
self.reopen(opts, {'backing': 'hd2'})
if __name__ == '__main__':
iotests.main(supported_fmts=["qcow2"])
iotests.main(supported_fmts=["qcow2"],
supported_protocols=["file"])

View File

@ -557,4 +557,5 @@ def main():
test_backup_api()
if __name__ == '__main__':
iotests.script_main(main, supported_fmts=['qcow2'])
iotests.script_main(main, supported_fmts=['qcow2'],
supported_protocols=['file'])