~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to tests/qemu-iotests/056

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
#
 
3
# Tests for drive-backup
 
4
#
 
5
# Copyright (C) 2013 Red Hat, Inc.
 
6
#
 
7
# Based on 041.
 
8
#
 
9
# This program is free software; you can redistribute it and/or modify
 
10
# it under the terms of the GNU General Public License as published by
 
11
# the Free Software Foundation; either version 2 of the License, or
 
12
# (at your option) any later version.
 
13
#
 
14
# This program is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
# GNU General Public License for more details.
 
18
#
 
19
# You should have received a copy of the GNU General Public License
 
20
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
21
#
 
22
 
 
23
import time
 
24
import os
 
25
import iotests
 
26
from iotests import qemu_img, qemu_io, create_image
 
27
 
 
28
backing_img = os.path.join(iotests.test_dir, 'backing.img')
 
29
test_img = os.path.join(iotests.test_dir, 'test.img')
 
30
target_img = os.path.join(iotests.test_dir, 'target.img')
 
31
 
 
32
class TestSyncModesNoneAndTop(iotests.QMPTestCase):
 
33
    image_len = 64 * 1024 * 1024 # MB
 
34
 
 
35
    def setUp(self):
 
36
        create_image(backing_img, TestSyncModesNoneAndTop.image_len)
 
37
        qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, test_img)
 
38
        qemu_io('-c', 'write -P0x41 0 512', test_img)
 
39
        qemu_io('-c', 'write -P0xd5 1M 32k', test_img)
 
40
        qemu_io('-c', 'write -P0xdc 32M 124k', test_img)
 
41
        qemu_io('-c', 'write -P0xdc 67043328 64k', test_img)
 
42
        self.vm = iotests.VM().add_drive(test_img)
 
43
        self.vm.launch()
 
44
 
 
45
    def tearDown(self):
 
46
        self.vm.shutdown()
 
47
        os.remove(test_img)
 
48
        os.remove(backing_img)
 
49
        try:
 
50
            os.remove(target_img)
 
51
        except OSError:
 
52
            pass
 
53
 
 
54
    def test_complete_top(self):
 
55
        self.assert_no_active_block_jobs()
 
56
        result = self.vm.qmp('drive-backup', device='drive0', sync='top',
 
57
                             format=iotests.imgfmt, target=target_img)
 
58
        self.assert_qmp(result, 'return', {})
 
59
 
 
60
        # Custom completed check as we are not copying all data.
 
61
        completed = False
 
62
        while not completed:
 
63
            for event in self.vm.get_qmp_events(wait=True):
 
64
                if event['event'] == 'BLOCK_JOB_COMPLETED':
 
65
                    self.assert_qmp(event, 'data/device', 'drive0')
 
66
                    self.assert_qmp_absent(event, 'data/error')
 
67
                    completed = True
 
68
 
 
69
        self.assert_no_active_block_jobs()
 
70
        self.vm.shutdown()
 
71
        self.assertTrue(iotests.compare_images(test_img, target_img),
 
72
                        'target image does not match source after backup')
 
73
 
 
74
    def test_cancel_sync_none(self):
 
75
        self.assert_no_active_block_jobs()
 
76
 
 
77
        result = self.vm.qmp('drive-backup', device='drive0',
 
78
                             sync='none', target=target_img)
 
79
        self.assert_qmp(result, 'return', {})
 
80
        time.sleep(1)
 
81
        self.vm.hmp_qemu_io('drive0', 'write -P0x5e 0 512')
 
82
        self.vm.hmp_qemu_io('drive0', 'aio_flush')
 
83
        # Verify that the original contents exist in the target image.
 
84
 
 
85
        event = self.cancel_and_wait()
 
86
        self.assert_qmp(event, 'data/type', 'backup')
 
87
 
 
88
        self.vm.shutdown()
 
89
        time.sleep(1)
 
90
        self.assertEqual(-1, qemu_io('-c', 'read -P0x41 0 512', target_img).find("verification failed"))
 
91
 
 
92
 
 
93
if __name__ == '__main__':
 
94
    iotests.main(supported_fmts=['qcow2', 'qed'])