Example #1
0
def copy_and_paste_pos(session_to_copy_from, session_to_paste_to,
                       guest_session, params):
    """
    Sending the commands to copy from one session to another, and make
    sure it works correctly

    @param session_to_copy_from: ssh session of the vm to copy from
    @param session_to_paste_to: ssh session of the vm to paste to
    @param guest_session: guest ssh session
    @param params: Dictionary with the test parameters.
    """
    # Get necessary params
    test_timeout = float(params.get("test_timeout", 600))
    interpreter = params.get("interpreter")
    script = params.get("guest_script")
    script_params = params.get("script_params", "")
    dst_path = params.get("dst_dir", "guest_script")
    script_call = os.path.join(dst_path, script)
    testing_text = params.get("text_to_test")

    # Before doing the copy and paste, verify vdagent is
    # installed and the daemon is running on the guest
    utils_spice.verify_vdagent(guest_session, test_timeout)
    # Start vdagent daemon
    utils_spice.start_vdagent(guest_session, test_timeout)
    # Make sure virtio driver is running
    utils_spice.verify_virtio(guest_session, test_timeout)
    # Command to copy text and put it in the keyboard, copy on the client
    place_text_in_clipboard(session_to_copy_from, interpreter, script_call,
                            script_params, testing_text, test_timeout)
    # Now test to see if the copied text from the one session can be
    # pasted on the other
    verify_paste_successful(session_to_paste_to, testing_text, interpreter,
                            script_call, test_timeout)
Example #2
0
def copy_and_paste_cpdisabled_neg(session_to_copy_from, session_to_paste_to,
                                  guest_session, params):
    """
    Negative Test: Sending the commands to copy from one session to another,
    for this test cp/paste will be disabled from qemu-kvm, Verify with vdagent
    started that copy/paste will fail.

    @param session_to_copy_from: ssh session of the vm to copy from
    @param session_to_paste_to: ssh session of the vm to paste to
    @param guest_session: guest ssh session
    @param params: Dictionary with the test parameters.
    """
    #Get necessary params
    test_timeout = float(params.get("test_timeout", 600))
    interpreter = params.get("interpreter")
    script = params.get("guest_script")
    script_params = params.get("script_params", "")
    dst_path = params.get("dst_dir", "guest_script")
    script_call = os.path.join(dst_path, script)
    testing_text = params.get("text_to_test")

    # Before doing the copy and paste, verify vdagent is installed and the
    # daemon is running on the guest
    utils_spice.verify_vdagent(guest_session, test_timeout)
    # Stop vdagent for this negative test
    utils_spice.start_vdagent(guest_session, test_timeout)
    # Make sure virtio driver is running
    utils_spice.verify_virtio(guest_session, test_timeout)
    # Command to copy text and put it in the keyboard, copy on the client
    place_text_in_clipboard(session_to_copy_from, interpreter, script_call,
                            script_params, testing_text, test_timeout)
    # Now test to see if the copied text from the one session can be pasted
    # on the other session
    verify_paste_fails(session_to_paste_to, testing_text, interpreter,
                       script_call, test_timeout)
Example #3
0
def copy_and_paste_cpdisabled_neg(session_to_copy_from, session_to_paste_to,
                                  guest_session, params):
    """
    Negative Test: Sending the commands to copy from one session to another,
    for this test cp/paste will be disabled from qemu-kvm, Verify with vdagent
    started that copy/paste will fail.

    @param session_to_copy_from: ssh session of the vm to copy from
    @param session_to_paste_to: ssh session of the vm to paste to
    @param guest_session: guest ssh session
    @param params: Dictionary with the test parameters.
    """
    #Get necessary params
    test_timeout = float(params.get("test_timeout", 600))
    interpreter = params.get("interpreter")
    script = params.get("guest_script")
    script_params = params.get("script_params", "")
    dst_path = params.get("dst_dir", "guest_script")
    script_call = os.path.join(dst_path, script)
    testing_text = params.get("text_to_test")

    # Before doing the copy and paste, verify vdagent is installed and the
    # daemon is running on the guest
    utils_spice.verify_vdagent(guest_session, test_timeout)
    # Stop vdagent for this negative test
    utils_spice.start_vdagent(guest_session, test_timeout)
    # Make sure virtio driver is running
    utils_spice.verify_virtio(guest_session, test_timeout)
    # Command to copy text and put it in the keyboard, copy on the client
    place_text_in_clipboard(session_to_copy_from, interpreter, script_call,
                            script_params, testing_text, test_timeout)
    # Now test to see if the copied text from the one session can be pasted
    # on the other session
    verify_paste_fails(session_to_paste_to, testing_text, interpreter,
                       script_call, test_timeout)
Example #4
0
def copy_and_paste_pos(session_to_copy_from, session_to_paste_to,
                       guest_session, params):
    """
    Sending the commands to copy from one session to another, and make
    sure it works correctly

    @param session_to_copy_from: ssh session of the vm to copy from
    @param session_to_paste_to: ssh session of the vm to paste to
    @param guest_session: guest ssh session
    @param params: Dictionary with the test parameters.
    """
    # Get necessary params
    test_timeout = float(params.get("test_timeout", 600))
    interpreter = params.get("interpreter")
    script = params.get("guest_script")
    script_params = params.get("script_params", "")
    dst_path = params.get("dst_dir", "guest_script")
    script_call = os.path.join(dst_path, script)
    testing_text = params.get("text_to_test")

    # Before doing the copy and paste, verify vdagent is
    # installed and the daemon is running on the guest
    utils_spice.verify_vdagent(guest_session, test_timeout)
    # Start vdagent daemon
    utils_spice.start_vdagent(guest_session, test_timeout)
    # Make sure virtio driver is running
    utils_spice.verify_virtio(guest_session, test_timeout)
    # Command to copy text and put it in the keyboard, copy on the client
    place_text_in_clipboard(session_to_copy_from, interpreter, script_call,
                            script_params, testing_text, test_timeout)
    # Now test to see if the copied text from the one session can be
    # pasted on the other
    verify_paste_successful(session_to_paste_to, testing_text, interpreter,
                            script_call, test_timeout)
Example #5
0
def copy_and_paste_largetext(session_to_copy_from, session_to_paste_to, guest_session, params):
    """
    Sending the commands to copy large text from one session to another, and
    make sure the data is still correct.

    @param session_to_copy_from: ssh session of the vm to copy from
    @param session_to_paste_to: ssh session of the vm to paste to
    @param guest_session: guest ssh session
    @param params: Dictionary with the test parameters.
    """
    # Get necessary params
    test_timeout = float(params.get("test_timeout", 600))
    interpreter = params.get("interpreter")
    script = params.get("guest_script")
    script_write_params = params.get("script_params_writef")
    script_create_params = params.get("script_params_createf")
    dst_path = params.get("dst_dir", "guest_script")
    final_text_path = os.path.join(params.get("dst_dir"), params.get("final_textfile"))
    script_call = os.path.join(dst_path, script)
    string_length = params.get("text_to_test")

    # Before doing the copy and paste, verify vdagent is
    # installed and the daemon is running on the guest
    utils_spice.verify_vdagent(guest_session, test_timeout)
    # Start vdagent
    utils_spice.start_vdagent(guest_session, test_timeout)
    # Make sure virtio driver is running
    utils_spice.verify_virtio(guest_session, test_timeout)

    # Command to copy text and put it in the clipboard
    textfile_checksum = verify_text_copy(
        session_to_copy_from,
        interpreter,
        script_call,
        script_create_params,
        string_length,
        final_text_path,
        test_timeout,
    )
    wait_timeout(30)

    # Verify the paste on the session to paste to
    verify_txt_paste_success(
        session_to_paste_to,
        interpreter,
        script_call,
        script_write_params,
        final_text_path,
        textfile_checksum,
        test_timeout,
    )
Example #6
0
def copyandpasteimg_cpdisabled_neg(session_to_copy_from, session_to_paste_to,
                                       guest_session, params):
    """
    Negative Tests Sending the commands to copy an image from one
    session to another; however, copy-paste will be disabled on the VM
    so the pasting should fail.

    @param session_to_copy_from: ssh session of the vm to copy from
    @param session_to_paste_to: ssh session of the vm to paste to
    @param guest_session: guest ssh session
    @param params: Dictionary with the test parameters.
    """
    # Get necessary params
    test_timeout = float(params.get("test_timeout", 600))
    interpreter = params.get("interpreter")
    script = params.get("guest_script")
    script_set_params = params.get("script_params_img_set")
    script_save_params = params.get("script_params_img_save")
    dst_path = params.get("dst_dir", "guest_script")
    dst_image_path = os.path.join(params.get("dst_dir"),
                                  params.get("image_tocopy_name"))
    final_image_path = os.path.join(params.get("dst_dir"),
                                    params.get("final_image"))
    script_call = os.path.join(dst_path, script)

    # Before doing the copy and paste, verify vdagent is
    # installed and the daemon is running on the guest
    utils_spice.verify_vdagent(guest_session, test_timeout)
    # Stop vdagent for this negative test
    utils_spice.start_vdagent(guest_session, test_timeout)
    # Make sure virtio driver is running
    utils_spice.verify_virtio(guest_session, test_timeout)
    wait_timeout()
    # Command to copy text and put it in the keyboard, copy on the client
    place_img_in_clipboard(session_to_copy_from, interpreter, script_call,
                            script_set_params, dst_image_path, test_timeout)
    # Now test to see if the copied text from the one session can be
    # pasted on the other
    verify_img_paste(session_to_copy_from, interpreter,
                                  script_call, script_save_params,
                                  final_image_path, test_timeout)
    wait_timeout(30)

    # Verify the paste on the session to paste to
    verify_img_paste_fails(session_to_paste_to, interpreter,
                             script_call, script_save_params,
                             final_image_path, test_timeout)
Example #7
0
def copyandpasteimg_cpdisabled_neg(session_to_copy_from, session_to_paste_to,
                                   guest_session, params):
    """
    Negative Tests Sending the commands to copy an image from one
    session to another; however, copy-paste will be disabled on the VM
    so the pasting should fail.

    @param session_to_copy_from: ssh session of the vm to copy from
    @param session_to_paste_to: ssh session of the vm to paste to
    @param guest_session: guest ssh session
    @param params: Dictionary with the test parameters.
    """
    # Get necessary params
    test_timeout = float(params.get("test_timeout", 600))
    interpreter = params.get("interpreter")
    script = params.get("guest_script")
    script_set_params = params.get("script_params_img_set")
    script_save_params = params.get("script_params_img_save")
    dst_path = params.get("dst_dir", "guest_script")
    dst_image_path = os.path.join(params.get("dst_dir"),
                                  params.get("image_tocopy_name"))
    final_image_path = os.path.join(params.get("dst_dir"),
                                    params.get("final_image"))
    script_call = os.path.join(dst_path, script)

    # Before doing the copy and paste, verify vdagent is
    # installed and the daemon is running on the guest
    utils_spice.verify_vdagent(guest_session, test_timeout)
    # Stop vdagent for this negative test
    utils_spice.start_vdagent(guest_session, test_timeout)
    # Make sure virtio driver is running
    utils_spice.verify_virtio(guest_session, test_timeout)
    wait_timeout()
    # Command to copy text and put it in the keyboard, copy on the client
    place_img_in_clipboard(session_to_copy_from, interpreter, script_call,
                           script_set_params, dst_image_path, test_timeout)
    # Now test to see if the copied text from the one session can be
    # pasted on the other
    verify_img_paste(session_to_copy_from, interpreter, script_call,
                     script_save_params, final_image_path, test_timeout)
    wait_timeout(30)

    # Verify the paste on the session to paste to
    verify_img_paste_fails(session_to_paste_to, interpreter, script_call,
                           script_save_params, final_image_path, test_timeout)
Example #8
0
def copy_and_paste_largetext(session_to_copy_from, session_to_paste_to,
                             guest_session, params):
    """
    Sending the commands to copy large text from one session to another, and
    make sure the data is still correct.

    @param session_to_copy_from: ssh session of the vm to copy from
    @param session_to_paste_to: ssh session of the vm to paste to
    @param guest_session: guest ssh session
    @param params: Dictionary with the test parameters.
    """
    # Get necessary params
    test_timeout = float(params.get("test_timeout", 600))
    interpreter = params.get("interpreter")
    script = params.get("guest_script")
    script_write_params = params.get("script_params_writef")
    script_create_params = params.get("script_params_createf")
    dst_path = params.get("dst_dir", "guest_script")
    final_text_path = os.path.join(params.get("dst_dir"),
                                   params.get("final_textfile"))
    script_call = os.path.join(dst_path, script)
    string_length = params.get("text_to_test")

    # Before doing the copy and paste, verify vdagent is
    # installed and the daemon is running on the guest
    utils_spice.verify_vdagent(guest_session, test_timeout)
    # Stop vdagent for this negative test
    utils_spice.start_vdagent(guest_session, test_timeout)
    # Make sure virtio driver is running
    utils_spice.verify_virtio(guest_session, test_timeout)
    wait_timeout()

    # Command to copy text and put it in the clipboard
    textfile_checksum = verify_text_copy(session_to_copy_from, interpreter,
                                         script_call, script_create_params,
                                         string_length, final_text_path,
                                         test_timeout)
    wait_timeout(30)

    # Verify the paste on the session to paste to
    verify_txt_paste_success(session_to_paste_to, interpreter, script_call,
                             script_write_params, final_text_path,
                             textfile_checksum, test_timeout)
Example #9
0
def restart_cppaste_image(session_to_copy_from, session_to_paste_to, guest_session, params):
    """
    Sending the commands to copy an image from one session to another.

    @param session_to_copy_from: ssh session of the vm to copy from
    @param session_to_paste_to: ssh session of the vm to paste to
    @param guest_session: guest ssh session
    @param params: Dictionary with the test parameters.
    """
    # Get necessary params
    test_timeout = float(params.get("test_timeout", 600))
    interpreter = params.get("interpreter")
    script = params.get("guest_script")
    image_type = params.get("image_type")
    script_set_params = params.get("script_params_img_set")
    script_save_params = params.get("script_params_img_save")
    dst_path = params.get("dst_dir", "guest_script")
    dst_image_path = os.path.join(params.get("dst_dir"), params.get("image_tocopy_name"))
    dst_image_path_bmp = os.path.join(params.get("dst_dir"), params.get("image_tocopy_name_bmp"))
    final_image_path = os.path.join(params.get("dst_dir"), params.get("final_image"))
    final_image_path_bmp = os.path.join(params.get("dst_dir"), params.get("final_image_bmp"))
    script_call = os.path.join(dst_path, script)

    # Before doing the copy and paste, verify vdagent is
    # installed and the daemon is running on the guest
    utils_spice.verify_vdagent(guest_session, test_timeout)
    # Start vdagent
    utils_spice.start_vdagent(guest_session, test_timeout)
    # Make sure virtio driver is running
    utils_spice.verify_virtio(guest_session, test_timeout)

    if "png" in image_type:
        # Command to copy text and put it in the keyboard, copy on the client
        place_img_in_clipboard(
            session_to_copy_from, interpreter, script_call, script_set_params, dst_image_path, test_timeout
        )
        # Now test to see if the copied text from the one session can be
        # pasted on the other
        image_size = verify_img_paste(
            session_to_copy_from, interpreter, script_call, script_save_params, final_image_path, test_timeout
        )
        wait_timeout(30)

        # Verify the paste on the session to paste to
        verify_img_paste_success(
            session_to_paste_to,
            interpreter,
            script_call,
            script_save_params,
            final_image_path,
            image_size,
            test_timeout,
        )
    else:
        # Testing bmp
        place_img_in_clipboard(
            session_to_copy_from, interpreter, script_call, script_set_params, dst_image_path_bmp, test_timeout
        )

        # Now test to see if the copied text from the one session can be
        # pasted on the other
        image_size = verify_img_paste(
            session_to_copy_from, interpreter, script_call, script_save_params, final_image_path_bmp, test_timeout
        )
        wait_timeout(30)

        # Verify the paste on the session to paste to
        verify_img_paste_success(
            session_to_paste_to,
            interpreter,
            script_call,
            script_save_params,
            final_image_path_bmp,
            image_size,
            test_timeout,
        )
    # Restart vdagent & clear the clipboards.
    utils_spice.restart_vdagent(guest_session, test_timeout)
    clear_cb(session_to_paste_to, params)
    clear_cb(session_to_copy_from, params)
    wait_timeout(5)

    if "png" in image_type:
        # Command to copy text and put it in the keyboard, copy on the client
        place_img_in_clipboard(
            session_to_copy_from, interpreter, script_call, script_set_params, dst_image_path, test_timeout
        )
        # Now test to see if the copied text from the one session can be
        # pasted on the other
        image_size = verify_img_paste(
            session_to_copy_from, interpreter, script_call, script_save_params, final_image_path, test_timeout
        )
        wait_timeout(30)

        # Verify the paste on the session to paste to
        verify_img_paste_success(
            session_to_paste_to,
            interpreter,
            script_call,
            script_save_params,
            final_image_path,
            image_size,
            test_timeout,
        )
    else:
        # Testing bmp
        place_img_in_clipboard(
            session_to_copy_from, interpreter, script_call, script_set_params, dst_image_path_bmp, test_timeout
        )

        # Now test to see if the copied text from the one session can be
        # pasted on the other
        image_size = verify_img_paste(
            session_to_copy_from, interpreter, script_call, script_save_params, final_image_path_bmp, test_timeout
        )
        wait_timeout(30)

        # Verify the paste on the session to paste to
        verify_img_paste_success(
            session_to_paste_to,
            interpreter,
            script_call,
            script_save_params,
            final_image_path_bmp,
            image_size,
            test_timeout,
        )