scripts: kernel-doc: allow passing desired Sphinx C domain dialect
[qemu/ar7.git] / tests / qemu-iotests / 235
blobd1b10ac36bd62f8595c6278678989a5be650bede
1 #!/usr/bin/env python3
3 # Simple mirror test
5 # Copyright (c) 2018 Virtuozzo International GmbH. All rights reserved.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 import sys
22 import os
23 import iotests
24 from iotests import qemu_img_create, qemu_io, file_path, log
26 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
28 from qemu.machine import QEMUMachine
30 iotests.script_initialize(supported_fmts=['qcow2'])
32 # Note:
33 # This test was added to check that mirror dead-lock was fixed (see previous
34 # commit before this test addition).
35 # And it didn't reproduce if at least one of the following:
36 # 1. use small image size
37 # 2. use raw format (not qcow2)
38 # 3. drop kvm and use iotests.VM() (maybe, because of qtest) (however, it still
39 #    reproduces, if just drop kvm, but gdb failed to produce full backtraces
40 #    for me)
41 # 4. add iothread
43 size = 1 * 1024 * 1024 * 1024
45 disk = file_path('disk')
47 # prepare source image
48 qemu_img_create('-f', iotests.imgfmt, '-o', 'preallocation=metadata', disk,
49                 str(size))
51 vm = QEMUMachine(iotests.qemu_prog)
52 vm.add_args('-accel', 'kvm', '-accel', 'tcg')
53 if iotests.qemu_default_machine == 's390-ccw-virtio':
54         vm.add_args('-no-shutdown')
55 vm.add_args('-drive', 'id=src,file=' + disk)
56 vm.launch()
58 log(vm.qmp('object-add', qom_type='throttle-group', id='tg0',
59            props={ 'x-bps-total': size }))
61 log(vm.qmp('blockdev-add',
62            **{ 'node-name': 'target',
63                'driver': 'throttle',
64                'throttle-group': 'tg0',
65                'file': {
66                    'driver': 'null-co',
67                    'size': size
68                 } }))
70 log(vm.qmp('blockdev-mirror', device='src', target='target', sync='full'))
72 try:
73     vm.event_wait('BLOCK_JOB_READY', timeout=10.0)
74 except:
75     vm.shutdown()
76     raise
78 vm.shutdown()