tests: Fix REPLACEME image.py hack

This commit is contained in:
Cole Robinson 2013-09-26 19:56:16 -04:00
parent 153e485bb7
commit 90a610eaef
6 changed files with 17 additions and 25 deletions

View File

@ -20,17 +20,17 @@
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="REPLACEME/tests/image-xml/image-kernel.xml"/>
<source file="/tmp/tests/image-xml/image-kernel.xml"/>
<target dev="hda" bus="ide"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="qcow"/>
<source file="REPLACEME/tests/image-xml/image.xml"/>
<source file="/tmp/tests/image-xml/image.xml"/>
<target dev="hdb" bus="ide"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="vmdk"/>
<source file="REPLACEME/tests/image-xml/image-format.xml"/>
<source file="/tmp/tests/image-xml/image-format.xml"/>
<target dev="hdc" bus="ide"/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -20,15 +20,15 @@
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type="file" device="disk">
<source file="REPLACEME/tests/image-xml/root.raw"/>
<source file="/tmp/tests/image-xml/root.raw"/>
<target dev="hda" bus="ide"/>
</disk>
<disk type="file" device="disk">
<source file="REPLACEME/tests/image-xml/data.raw"/>
<source file="/tmp/tests/image-xml/data.raw"/>
<target dev="hdb" bus="ide"/>
</disk>
<disk type="file" device="disk">
<source file="REPLACEME/tests/image-xml/scratch.raw"/>
<source file="/tmp/tests/image-xml/scratch.raw"/>
<target dev="hdd" bus="ide"/>
</disk>
<input type="mouse" bus="ps2"/>

View File

@ -18,15 +18,15 @@
<on_crash>restart</on_crash>
<devices>
<disk type="file" device="disk">
<source file="REPLACEME/tests/image-xml/root.raw"/>
<source file="/tmp/tests/image-xml/root.raw"/>
<target dev="xvda" bus="xen"/>
</disk>
<disk type="file" device="disk">
<source file="REPLACEME/tests/image-xml/data.raw"/>
<source file="/tmp/tests/image-xml/data.raw"/>
<target dev="xvdb" bus="xen"/>
</disk>
<disk type="file" device="disk">
<source file="REPLACEME/tests/image-xml/scratch.raw"/>
<source file="/tmp/tests/image-xml/scratch.raw"/>
<target dev="xvdc" bus="xen"/>
</disk>
<input type="mouse" bus="xen"/>

View File

@ -13,15 +13,15 @@
<on_crash>restart</on_crash>
<devices>
<disk type="file" device="disk">
<source file="REPLACEME/tests/image-xml/root.raw"/>
<source file="/tmp/tests/image-xml/root.raw"/>
<target dev="xvda" bus="xen"/>
</disk>
<disk type="file" device="disk">
<source file="REPLACEME/tests/image-xml/data.raw"/>
<source file="/tmp/tests/image-xml/data.raw"/>
<target dev="xvdb" bus="xen"/>
</disk>
<disk type="file" device="disk">
<source file="REPLACEME/tests/image-xml/scratch.raw"/>
<source file="/tmp/tests/image-xml/scratch.raw"/>
<target dev="xvdc" bus="xen"/>
</disk>
<input type="mouse" bus="xen"/>

View File

@ -58,8 +58,7 @@ class TestImageParser(unittest.TestCase):
def testBadArch(self):
"""Makes sure we sanitize i386->i686"""
image = virtimage.parse_file(self.basedir +
"image-bad-arch.xml")
image = virtimage.parse_file(self.basedir + "image-bad-arch.xml")
virtimage.ImageInstaller(self.conn, image, 0)
self.assertTrue(True)
@ -85,24 +84,20 @@ class TestImageParser(unittest.TestCase):
else:
g = utils.get_basic_paravirt_guest()
utils.set_conn(conn)
g.os.os_type = capsguest.os_type
g.type = capsdomain.hypervisor_type
g.os.arch = capsguest.arch
utils.set_conn(conn)
g.installer = inst
ignore, actual_out = g.start_install(return_xml=True, dry=True)
actual_out = g.get_install_xml(install=False)
expect_file = os.path.join(image2guestdir + fname)
expect_out = utils.read_file(expect_file)
expect_out = expect_out.replace("REPLACEME", os.getcwd())
utils.diff_compare(actual_out,
expect_file,
expect_out=expect_out)
actual_out = actual_out.replace(os.getcwd(), "/tmp")
utils.diff_compare(actual_out, expect_file)
utils.reset_conn()

View File

@ -393,7 +393,7 @@ class ImageInstaller(Installer):
def _make_disks(self):
for drive in self.boot_caps.drives:
path = self._abspath(drive.disk.file)
path = self.image.abspath(drive.disk.file)
size = None
if drive.disk.size is not None:
size = float(drive.disk.size) / 1024
@ -419,9 +419,6 @@ class ImageInstaller(Installer):
disk.validate()
self.install_devices.append(disk)
def _abspath(self, p):
return self.image.abspath(p)
def match_boots(capabilities, boots):
for b in boots: