Example #1
0
def run(vt_test, test_params, env):
    """Run remote-viewer at client VM.

    Parameters
    ----------
    vt_test : avocado.core.plugins.vt.VirtTest
        QEMU test object.
    test_params : virttest.utils_params.Params
        Dictionary with the test parameters.
    env : virttest.utils_env.Env
        Dictionary with test environment.

    """
    test = stest.ClientGuestTest(vt_test, test_params, env)
    cfg = test.cfg
    act.x_active(test.vmi_c)
    act.x_active(test.vmi_g)
    ssn = act.new_ssn(test.vmi_c)
    act.rv_connect(test.vmi_c, ssn)
    act.clear_cb(test.vmi_g)
    act.clear_cb(test.vmi_c)
    if cfg.vdagent_action:
        act.service_vdagent(test.vmi_g, cfg.vdagent_action)
    if cfg.guest2client:
        src = test.vmi_g
        dst = test.vmi_c
    elif cfg.client2guest:
        src = test.vmi_c
        dst = test.vmi_g
    success = False
    if cfg.copy_text:
        act.text2cb(src, cfg.text)
        text = act.cb2text(dst)
        if cfg.text in text:
            success = True
    elif cfg.copy_text_big:
        act.gen_text2cb(src, cfg.kbytes)
        act.cb2file(src, cfg.dump_file)
        md5src = act.md5sum(src, cfg.dump_file)
        act.cb2file(dst, cfg.dump_file)
        md5dst = act.md5sum(dst, cfg.dump_file)
        if md5src == md5dst:
            success = True
    elif cfg.copy_img:
        dst_img = os.path.join(act.dst_dir(src), cfg.test_image)
        act.imggen(src, dst_img, cfg.test_image_size)
        act.img2cb(src, dst_img)
        act.cb2img(src, cfg.dump_img)
        act.cb2img(dst, cfg.dump_img)
        md5src = act.md5sum(src, cfg.dump_img)
        md5dst = act.md5sum(dst, cfg.dump_img)
        if md5src == md5dst:
            success = True

    if cfg.negative and success \
        or not cfg.negative and not success:
        raise utils.SpiceTestFail(test, "Test failed.")

    pass
Example #2
0
def run(vt_test, test_params, env):
    """Tests for vdagent.

    Parameters
    ----------
    vt_test : avocado.core.plugins.vt.VirtTest
        QEMU test object.
    test_params : virttest.utils_params.Params
        Dictionary with the test parameters.
    env : virttest.utils_env.Env
        Dictionary with test environment.

    """
    test = stest.GuestTest(vt_test, test_params, env)
    cfg = test.cfg
    vmi = test.vmi
    act.x_active(vmi)

    active = act.service_vdagent(vmi, "status")

    if cfg.ttype == "start":
        if active:
            act.service_vdagent(vmi, "stop")
            active = act.service_vdagent(vmi, "status")
        assert not active
        act.service_vdagent(vmi, "start")
        active = act.service_vdagent(vmi, "status")
        assert active
    elif cfg.ttype == "stop":
        if not active:
            act.service_vdagent(vmi, "start")
            active = act.service_vdagent(act, "status")
        assert active
        act.service_vdagent(vmi, "stop")
        active = act.service_vdagent(vmi, "status")
        assert not active
    elif cfg.ttype == "restart_running":
        if not active:
            act.service_vdagent(vmi, "start")
            active = act.service_vdagent(vmi, "status")
        assert active
        act.service_vdagent(vmi, "restart")
        active = act.service_vdagent(vmi, "status")
        assert active
    elif cfg.ttype == "restart_stopped":
        if active:
            act.service_vdagent(vmi, "stop")
            active = act.service_vdagent(vmi, "status")
        assert not active
        act.service_vdagent(vmi, "restart")
        active = act.service_vdagent(vmi, "status")
        assert active
    else:
        raise utils.SpiceTestFail(test, "Bad config.")
Example #3
0
def run(vt_test, test_params, env):
    """Run remote-viewer at client VM.

    Parameters
    ----------
    vt_test : avocado.core.plugins.vt.VirtTest
        QEMU test object.
    test_params : virttest.utils_params.Params
        Dictionary with the test parameters.
    env : virttest.utils_env.Env
        Dictionary with test environment.

    """
    test = stest.ClientGuestTest(vt_test, test_params, env)
    cfg = test.cfg
    act.x_active(test.vmi_c)
    act.x_active(test.vmi_g)
    ssn = act.new_ssn(test.vmi_c, dogtail_ssn=test.vmi_c.vm.is_rhel8())
    act.rv_connect(test.vmi_c, ssn)
    act.clear_cb(test.vmi_g)
    act.clear_cb(test.vmi_c)
    if cfg.vdagent_action:
        if cfg.vdagent_action == "stop":
            act.service_vdagent(test.vmi_g, "mask")
        act.service_vdagent(test.vmi_g, cfg.vdagent_action)
    if cfg.guest2client:
        src = test.vmi_g
        dst = test.vmi_c
    elif cfg.client2guest:
        src = test.vmi_c
        dst = test.vmi_g
    success = False
    if cfg.copy_text:
        act.text2cb(src, cfg.text)
        try:
            text = act.cb2text(dst)
        except aexpect.exceptions.ShellCmdError:
            logger.info('Cannot paste from buffer.')
        else:
            if cfg.text in text:
                success = True
    elif cfg.copy_text_big:
        act.gen_text2cb(src, cfg.kbytes)
        act.cb2file(src, cfg.dump_file)
        md5src = act.md5sum(src, cfg.dump_file)
        try:
            act.cb2file(dst, cfg.dump_file)
        except aexpect.exceptions.ShellCmdError:
            logger.info('Cannot paste from buffer.')
        else:
            md5dst = act.md5sum(dst, cfg.dump_file)
            if md5src == md5dst:
                success = True
    elif cfg.copy_img:
        dst_img = os.path.join(act.dst_dir(src), cfg.test_image)
        act.imggen(src, dst_img, cfg.test_image_size)
        act.img2cb(src, dst_img)
        act.cb2img(src, cfg.dump_img)
        try:
            act.cb2img(dst, cfg.dump_img)
        except aexpect.exceptions.ShellCmdError:
            logger.info('Cannot paste from buffer.')
        else:
            md5src = act.md5sum(src, cfg.dump_img)
            md5dst = act.md5sum(dst, cfg.dump_img)
            if md5src == md5dst:
                success = True

    if cfg.negative and success or not cfg.negative and not success:
        raise utils.SpiceTestFail(test, "Test failed.")
Example #4
0
def run(vt_test, test_params, env):
    """Tests for vdagent.

    Parameters
    ----------
    vt_test : avocado.core.plugins.vt.VirtTest
        QEMU test object.
    test_params : virttest.utils_params.Params
        Dictionary with the test parameters.
    env : virttest.utils_env.Env
        Dictionary with test environment.

    """
    test = stest.GuestTest(vt_test, test_params, env)
    cfg = test.cfg
    vmi = test.vmi
    act.x_active(vmi)

    active = act.service_vdagent(vmi, "status")

    if cfg.ttype == "start":
        if active:
            # spice-vdagentd.service must be masked before stopping, otherwise
            # is immediatelly started by spice-vdagentd.socket
            act.service_vdagent(vmi, "mask")
            act.service_vdagent(vmi, "stop")
            act.service_vdagent(vmi, "unmask")
            active = act.service_vdagent(vmi, "status")
        assert not active
        act.service_vdagent(vmi, "start")
        active = act.service_vdagent(vmi, "status")
        assert active
    elif cfg.ttype == "stop":
        if not active:
            act.service_vdagent(vmi, "start")
            active = act.service_vdagent(vmi, "status")
        assert active
        act.service_vdagent(vmi, "mask")
        act.service_vdagent(vmi, "stop")
        act.service_vdagent(vmi, "unmask")
        active = act.service_vdagent(vmi, "status")
        assert not active
    elif cfg.ttype == "restart_running":
        if not active:
            act.service_vdagent(vmi, "start")
            active = act.service_vdagent(vmi, "status")
        assert active
        act.service_vdagent(vmi, "restart")
        active = act.service_vdagent(vmi, "status")
        assert active
    elif cfg.ttype == "restart_stopped":
        if active:
            act.service_vdagent(vmi, "mask")
            act.service_vdagent(vmi, "stop")
            act.service_vdagent(vmi, "unmask")
            active = act.service_vdagent(vmi, "status")
        assert not active
        act.service_vdagent(vmi, "restart")
        active = act.service_vdagent(vmi, "status")
        assert active
    else:
        raise utils.SpiceTestFail(test, "Bad config.")