def testAC97(self): # Test setting ac97 version given various version combos def has_ac97(conn): g = _make_guest(conn=conn, os_variant="fedora11") # pylint: disable=unpacking-non-sequence xml, ignore = g.start_install(return_xml=True, dry=True) return "ac97" in xml self.assertTrue(has_ac97(utils.open_kvm(connver=11000))) self.assertFalse(has_ac97(utils.open_kvm(libver=5000))) self.assertFalse(has_ac97(utils.open_kvm(libver=7000, connver=7000)))
def testAC97(self): # Test setting ac97 version given various version combos def has_ac97(conn): g = _make_guest(conn=conn) g.os_variant = "fedora11" # pylint: disable=unpacking-non-sequence xml, ignore = g.start_install(return_xml=True, dry=True) return "ac97" in xml self.assertTrue(has_ac97(utils.open_kvm(connver=11000))) self.assertFalse(has_ac97(utils.open_kvm(libver=5000))) self.assertFalse(has_ac97(utils.open_kvm(libver=7000, connver=7000)))
def _convert_helper(self, infile, outfile, in_type, disk_format): outbuf = io.BytesIO() def print_cb(msg): print(msg, file=outbuf) conn = utils.open_kvm() converter = VirtConverter(conn, infile, print_cb=print_cb) if converter.parser.name != in_type: raise AssertionError("find_parser_by_file for '%s' returned " "wrong parser type.\n" "Expected: %s\n" "Received: %s\n" % (infile, in_type, converter.parser.name)) converter.convert_disks(disk_format, dry=True) guest = converter.get_guest() ignore, out_xml = guest.start_install(return_xml=True) out_expect = out_xml if outbuf.getvalue(): out_expect += ("\n\n" + outbuf.getvalue().replace(base_dir, "")) if not conn.check_support(conn.SUPPORT_CONN_VMPORT): self.skipTest("Not comparing XML because vmport isn't supported") utils.diff_compare(out_expect, outfile) utils.test_create(conn, out_xml)
# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. import glob import traceback import unittest import virtinst from tests import utils conn = utils.open_testdriver() kvmconn = utils.open_kvm() def sanitize_file_xml(xml): # s/"/'/g from generated XML, matches what libxml dumps out # This won't work all the time, but should be good enough for testing return xml.replace("'", "\"") class XMLParseTest(unittest.TestCase): def _roundtrip_compare(self, filename): expectXML = sanitize_file_xml(file(filename).read()) guest = virtinst.Guest(conn, parsexml=expectXML) actualXML = guest.get_xml_config() utils.diff_compare(actualXML, expect_out=expectXML)
def _make(connver): conn = utils.open_kvm(libver=1002002, connver=connver) g = _make_guest(conn=conn, os_variant="win7") g.emulator = "/usr/libexec/qemu-kvm" return g
def _make(connver): conn = utils.open_kvm(libver=1002002, connver=connver) g = _make_guest(conn=conn) g.os_variant = "win7" g.emulator = "/usr/libexec/qemu-kvm" return g