mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
qemu-iotests: make create_image() common
Both 030 and 041 use create_image(). Move it to iotests.py. Also drop ImageStreamingTestCase since the class now has no methods. Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
3a3918c396
commit
2499a096a2
3 changed files with 27 additions and 40 deletions
|
@ -23,6 +23,7 @@ import string
|
|||
import unittest
|
||||
import sys; sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'QMP'))
|
||||
import qmp
|
||||
import struct
|
||||
|
||||
__all__ = ['imgfmt', 'imgproto', 'test_dir' 'qemu_img', 'qemu_io',
|
||||
'VM', 'QMPTestCase', 'notrun', 'main']
|
||||
|
@ -56,6 +57,16 @@ def compare_images(img1, img2):
|
|||
return qemu_img('compare', '-f', imgfmt,
|
||||
'-F', imgfmt, img1, img2) == 0
|
||||
|
||||
def create_image(name, size):
|
||||
'''Create a fully-allocated raw image with sector markers'''
|
||||
file = open(name, 'w')
|
||||
i = 0
|
||||
while i < size:
|
||||
sector = struct.pack('>l504xl', i / 512, i / 512)
|
||||
file.write(sector)
|
||||
i = i + 512
|
||||
file.close()
|
||||
|
||||
class VM(object):
|
||||
'''A QEMU VM'''
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue