def run(test, params, env):
    """
    Acceptance installer test:

    1) Create shared directories on the host.
    2) Run virtiofsd daemons on the host.
    3) Boot guest with all virtio device.
    4) Install driver via virtio-win-guest-tools.exe.
    5) Run virtio-win-guest-tools.exe signature check command in guest.
    6) Run QEMU FWCfg Device installed check command in guest.
    7) Verify the qemu-ga version match expected version.
    8) Run driver signature check command in guest.
       Verify target driver.

    :param test: QEMU test object
    :param params: Dictionary with the test parameters
    :param env: Dictionary with test environment
    """
    run_install_cmd = params["run_install_cmd"]
    installer_pkg_check_cmd = params["installer_pkg_check_cmd"]

    # gagent version check test config
    qemu_ga_pkg = params["qemu_ga_pkg"]
    gagent_pkg_info_cmd = params["gagent_pkg_info_cmd"]
    gagent_install_cmd = params["gagent_install_cmd"]
    gagent_uninstall_cmd = params["gagent_uninstall_cmd"]

    vm = env.get_vm(params["main_vm"])
    session = vm.wait_for_login()

    expected_gagent_version = install_gagent(session, test, qemu_ga_pkg,
                                             gagent_install_cmd,
                                             gagent_pkg_info_cmd)
    uninstall_gagent(session, test, gagent_uninstall_cmd)
    win_uninstall_all_drivers(session, test, params)
    session = vm.reboot(session)
    install_test_with_screen_on_desktop(vm,
                                        session,
                                        test,
                                        run_install_cmd,
                                        installer_pkg_check_cmd,
                                        copy_files_params=params)
    win_installer_test(session, test, params)
    check_gagent_version(session, test, gagent_pkg_info_cmd,
                         expected_gagent_version)
    driver_check(session, test, params)

    session.close()
Ejemplo n.º 2
0
def run(test, params, env):
    """
    Acceptance installer test:

    1) Create shared directories on the host.
    2) Run virtiofsd daemons on the host.
    3) Boot guest with all virtio device.
    4) Install driver via virtio-win-guest-tools.exe.
    5) Run virtio-win-guest-tools.exe signature check command in guest.
    6) Run QEMU FWCfg Device installed check command in guest.
    7) Verify the qemu-ga version match expected version.
    8) Run driver signature check command in guest.
       Verify target driver.
    9) Run virtio-win-guest-tools.exe repair test by uninstall driver
       one by one.

    :param test: QEMU test object
    :param params: Dictionary with the test parameters
    :param env: Dictionary with test environment
    """
    devcon_path = params["devcon_path"]
    run_install_cmd = params["run_install_cmd"]
    installer_pkg_check_cmd = params["installer_pkg_check_cmd"]

    # gagent version check test config
    qemu_ga_pkg = params["qemu_ga_pkg"]
    gagent_pkg_info_cmd = params["gagent_pkg_info_cmd"]
    gagent_install_cmd = params["gagent_install_cmd"]
    gagent_uninstall_cmd = params["gagent_uninstall_cmd"]

    vm = env.get_vm(params["main_vm"])
    session = vm.wait_for_login()

    expected_gagent_version = install_gagent(session, test,
                                             qemu_ga_pkg,
                                             gagent_install_cmd,
                                             gagent_pkg_info_cmd)
    uninstall_gagent(session, test, gagent_uninstall_cmd)
    win_uninstall_all_drivers(session, test, params)
    session = vm.reboot(session)
    install_test_with_screen_on_desktop(vm, session, test, run_install_cmd,
                                        installer_pkg_check_cmd,
                                        copy_files_params=params)
    win_installer_test(session, test, params)
    check_gagent_version(session, test, gagent_pkg_info_cmd,
                         expected_gagent_version)
    driver_check(session, test, params)

    if params.get("check_qemufwcfg", "no") == "yes":
        driver_name_list.append('qemufwcfg')

    error_context.context("Run virtio-win-guest-tools.exe repair test",
                          logging.info)
    unrepaired_driver = []
    for driver_name, device_name, device_hwid in zip(driver_name_list,
                                                     device_name_list,
                                                     device_hwid_list):
        error_context.context("Uninstall %s driver"
                              % driver_name, logging.info)
        win_driver_utils.uninstall_driver(session, test, devcon_path,
                                          driver_name, device_name,
                                          device_hwid)
        session = vm.reboot(session)
        vm.send_key('meta_l-d')
        time.sleep(30)
        run_repair_cmd = utils_misc.set_winutils_letter(
                                           session, params["run_repair_cmd"])
        session.cmd(run_repair_cmd)
        time.sleep(30)
        error_context.context("Check if %s driver is repaired"
                              % driver_name, logging.info)
        chk_cmd = params["vio_driver_chk_cmd"] % device_name[0:30]
        status = session.cmd_status(chk_cmd)
        if status != 0:
            unrepaired_driver.append(driver_name)
    if unrepaired_driver:
        test.fail("The missing %s driver repair failed."
                  % unrepaired_driver)

    session.close()
def run(test, params, env):
    """
    Acceptance installer test:

    1) Create shared directories on the host.
    2) Run virtiofsd daemons on the host.
    3) Boot guest with all virtio device.
    4) Install driver via virtio-win-guest-tools.exe.
    5) Run virtio-win-guest-tools.exe signature check command in guest.
    6) Run QEMU FWCfg Device installed check command in guest.
    7) Verify the qemu-ga version match expected version.
    8) Run driver signature check command in guest.
       Verify target driver.
       one by one.
    9) Run virtio-win-guest-tools.exe uninstall test.
    10) Check all drivers are uninstalled.
    11) Run gagent status check command in guest.

    :param test: QEMU test object
    :param params: Dictionary with the test parameters
    :param env: Dictionary with test environment
    """
    run_install_cmd = params["run_install_cmd"]
    installer_pkg_check_cmd = params["installer_pkg_check_cmd"]

    # gagent version check test config
    qemu_ga_pkg = params["qemu_ga_pkg"]
    gagent_pkg_info_cmd = params["gagent_pkg_info_cmd"]
    gagent_install_cmd = params["gagent_install_cmd"]
    gagent_uninstall_cmd = params["gagent_uninstall_cmd"]

    vm = env.get_vm(params["main_vm"])
    session = vm.wait_for_login()

    expected_gagent_version = install_gagent(session, test, qemu_ga_pkg,
                                             gagent_install_cmd,
                                             gagent_pkg_info_cmd)
    uninstall_gagent(session, test, gagent_uninstall_cmd)
    win_uninstall_all_drivers(session, test, params)
    session = vm.reboot(session)
    install_test_with_screen_on_desktop(vm,
                                        session,
                                        test,
                                        run_install_cmd,
                                        installer_pkg_check_cmd,
                                        copy_files_params=params)
    win_installer_test(session, test, params)
    check_gagent_version(session, test, gagent_pkg_info_cmd,
                         expected_gagent_version)
    driver_check(session, test, params)

    error_context.context("Run virtio-win-guest-tools.exe uninstall test",
                          test.log.info)
    vm.send_key('meta_l-d')
    time.sleep(30)
    run_uninstall_cmd = utils_misc.set_winutils_letter(
        session, params["run_uninstall_cmd"])
    session.cmd(run_uninstall_cmd)
    time.sleep(30)
    s_check, o_check = session.cmd_status_output(installer_pkg_check_cmd)
    if s_check == 0:
        test.fail("Could not uninstall Virtio-win-guest-tools package "
                  "in guest', detail: '%s'" % o_check)
    session = vm.reboot(session)

    error_context.context("Check if all drivers are uninstalled.",
                          test.log.info)
    uninstalled_device = []
    device_name_list = [
        'VirtIO RNG Device', 'VirtIO Serial Driver', 'VirtIO Balloon Driver',
        'QEMU PVPanic Device', 'VirtIO Input Driver',
        'Red Hat VirtIO Ethernet Adapter', 'VirtIO FS Device',
        'QEMU FWCfg Device'
    ]
    # viostor and vioscsi drivers can not uninstalled by installer
    for device_name in device_name_list:
        if (device_name == "QEMU FWCfg Device"
                and params.get("check_qemufwcfg", "no") != "yes"):
            continue
        chk_cmd = params["vio_driver_chk_cmd"] % device_name[0:30]
        status = session.cmd_status(chk_cmd)
        if status == 0:
            uninstalled_device.append(device_name)
    if uninstalled_device:
        test.fail("%s uninstall failed" % uninstalled_device)

    error_context.context("Check qemu-ga service.", test.log.info)
    gagent_status_cmd = 'sc query qemu-ga |findstr "RUNNING" '
    status = session.cmd_status(gagent_status_cmd)
    if status == 0:
        test.fail("qemu-ga service still running after uninstall")

    session.close()
def run(test, params, env):
    """
    Acceptance installer test:

    1) Create shared directories on the host.
    2) Run virtiofsd daemons on the host.
    3) Boot guest with all virtio device.
    4) Install driver from previous virtio-win.iso.
       Or virtio-win-guest-tool.
    5) upgrade driver via virtio-win-guest-tools.exe
    6) Verify the qemu-ga version match expected version.
    7) Run driver signature check command in guest.
       Verify target driver.

    :param test: QEMU test object
    :param params: Dictionary with the test parameters
    :param env: Dictionary with test environment
    """
    def change_virtio_media(cdrom_virtio):
        """
        change iso for virtio-win
        :param cdrom_virtio: iso file
        """
        virtio_iso = utils_misc.get_path(data_dir.get_data_dir(), cdrom_virtio)
        logging.info("Changing virtio iso image to '%s'", virtio_iso)
        vm.change_media("drive_virtio", virtio_iso)

    devcon_path = params["devcon_path"]
    installer_pkg_check_cmd = params["installer_pkg_check_cmd"]
    run_install_cmd = params["run_install_cmd"]
    media_type = params["virtio_win_media_type"]

    # gagent version check test config
    qemu_ga_pkg = params["qemu_ga_pkg"]
    gagent_pkg_info_cmd = params["gagent_pkg_info_cmd"]
    gagent_install_cmd = params["gagent_install_cmd"]
    gagent_uninstall_cmd = params["gagent_uninstall_cmd"]

    vm = env.get_vm(params["main_vm"])
    session = vm.wait_for_login()

    expected_gagent_version = install_gagent(session, test, qemu_ga_pkg,
                                             gagent_install_cmd,
                                             gagent_pkg_info_cmd)

    uninstall_gagent(session, test, gagent_uninstall_cmd)

    if params.get("check_qemufwcfg", "no") == "yes":
        driver_name_list.append('qemufwcfg')

    win_uninstall_all_drivers(session, test, params)
    change_virtio_media(params["cdrom_virtio_downgrade"])

    session = vm.reboot(session)

    if params.get("update_from_previous_installer", "no") == "yes":
        error_context.context("install drivers from previous installer",
                              logging.info)
        install_test_with_screen_on_desktop(vm,
                                            session,
                                            test,
                                            run_install_cmd,
                                            installer_pkg_check_cmd,
                                            copy_files_params=params)
    else:
        for driver_name, device_name, device_hwid in zip(
                driver_name_list, device_name_list, device_hwid_list):
            win_driver_utils.install_driver_by_virtio_media(
                session, test, devcon_path, media_type, driver_name,
                device_hwid)
        install_gagent(session, test, qemu_ga_pkg, gagent_install_cmd,
                       gagent_pkg_info_cmd)

    error_context.context("Upgrade virtio driver to original", logging.info)
    change_virtio_media(params["cdrom_virtio"])
    install_test_with_screen_on_desktop(vm,
                                        session,
                                        test,
                                        run_install_cmd,
                                        installer_pkg_check_cmd,
                                        copy_files_params=params)
    if params.get("need_reboot", "no") == "yes":
        session = vm.reboot(session)

    check_gagent_version(session, test, gagent_pkg_info_cmd,
                         expected_gagent_version)
    driver_check(session, test, params)

    session.close()