def test_make_installer(self):
        config = """install_mode = test_install_mode
vm_type = test"""

        class Installer:
            def __init__(self, mode, name, test, params):
                pass

        installer.INSTALLER_REGISTRY.register('test_install_mode', Installer,
                                              'test')

        config_parser = cartesian_config.Parser()
        config_parser.parse_string(config)
        params = config_parser.get_dicts().next()

        instance = installer.make_installer("test_install_mode_test", params)
        self.assertTrue(isinstance(instance, Installer))
Example #2
0
    def test_make_installer(self):
        config = """install_mode = test_install_mode
vm_type = test"""

        class Installer:
            def __init__(self, mode, name, test, params):
                pass

        installer.INSTALLER_REGISTRY.register('test_install_mode',
                                              Installer,
                                              'test')

        config_parser = cartesian_config.Parser()
        config_parser.parse_string(config)
        params = config_parser.get_dicts().next()

        instance = installer.make_installer("test_install_mode_test", params)
        self.assertTrue(isinstance(instance, Installer))
Example #3
0
def run_build(test, params, env):
    """
    Installs KVM using the selected install mode. Most install methods will
    take kvm source code, build it and install it to a given location.

    @param test: kvm test object.
    @param params: Dictionary with test parameters.
    @param env: Test environment.
    """
    srcdir = params.get("srcdir", test.srcdir)
    params["srcdir"] = srcdir

    try:
        installer_object = installer.make_installer(params)
        installer_object.set_install_params(test, params)
        installer_object.install()
        env.register_installer(installer_object)
    except Exception, e:
        # if the build/install fails, don't allow other tests
        # to get a installer.
        msg = "KVM install failed: %s" % (e)
        env.register_installer(installer.FailedInstaller(msg))
        raise