Commit c15badee authored by Max Reitz's avatar Max Reitz Committed by Kevin Wolf
Browse files

qemu-iotests: Extend 041 for unbacked mirroring



Add a new test case in file 041 for mirroring unbacked images in
"absolute-paths" mode. This should work, if possible, but most
importantly, qemu should never crash.

Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
Reviewed-by: default avatarWenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 14526864
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -677,5 +677,30 @@ class TestSetSpeed(ImageMirroringTestCase):

        self.wait_ready_and_cancel()

class TestUnbackedSource(ImageMirroringTestCase):
    image_len = 2 * 1024 * 1024 # MB

    def setUp(self):
        qemu_img('create', '-f', iotests.imgfmt, test_img,
                 str(TestUnbackedSource.image_len))
        self.vm = iotests.VM().add_drive(test_img)
        self.vm.launch()

    def tearDown(self):
        self.vm.shutdown()
        os.remove(test_img)
        os.remove(target_img)

    def test_absolute_paths(self):
        self.assert_no_active_block_jobs()

        for sync_mode in ['full', 'top', 'none']:
            result = self.vm.qmp('drive-mirror', device='drive0',
                                 sync=sync_mode, target=target_img,
                                 mode='absolute-paths')
            self.assert_qmp(result, 'return', {})
            self.complete_and_wait()
            self.assert_no_active_block_jobs()

if __name__ == '__main__':
    iotests.main(supported_fmts=['qcow2', 'qed'])
+2 −2
Original line number Diff line number Diff line
........................
.........................
----------------------------------------------------------------------
Ran 24 tests
Ran 25 tests

OK