Re: [Autotest] [PATCH v2 01/10] KVM test: Introduce prompt assist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jason, just hold on cause next week I'm back and will finish work
on your patchset.

Cheers,

On Tue, May 11, 2010 at 6:03 AM, Jason Wang <jasowang@xxxxxxxxxx> wrote:
> We need to send an assist string to a session in order to get the
> prompt when re-connecting to session through serial. This patch sends
> assist string before matching the prompt in remote_login().
>
> Signed-off-by: Jason Wang <jasowang@xxxxxxxxxx>
> ---
>  client/tests/kvm/kvm_utils.py |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
> index 25f3c8c..11f2b1a 100644
> --- a/client/tests/kvm/kvm_utils.py
> +++ b/client/tests/kvm/kvm_utils.py
> @@ -451,7 +451,8 @@ def check_kvm_source_dir(source_dir):
>  # The following are functions used for SSH, SCP and Telnet communication with
>  # guests.
>
> -def remote_login(command, password, prompt, linesep="\n", timeout=10):
> +def remote_login(command, password, prompt, linesep="\n", timeout=10,
> +                 prompt_assist=None):
>     """
>     Log into a remote host (guest) using SSH or Telnet. Run the given command
>     using kvm_spawn and provide answers to the questions asked. If timeout
> @@ -468,7 +469,8 @@ def remote_login(command, password, prompt, linesep="\n", timeout=10):
>     @param timeout: The maximal time duration (in seconds) to wait for each
>             step of the login procedure (i.e. the "Are you sure" prompt, the
>             password prompt, the shell prompt, etc)
> -
> +    @param prompt_assist: An assistant string sent before the pattern
> +            matching in order to get the prompt for some kinds of shell_client.
>     @return Return the kvm_spawn object on success and None on failure.
>     """
>     sub = kvm_subprocess.kvm_shell_session(command,
> @@ -479,6 +481,9 @@ def remote_login(command, password, prompt, linesep="\n", timeout=10):
>
>     logging.debug("Trying to login with command '%s'" % command)
>
> +    if prompt_assist is not None:
> +        sub.sendline(prompt_assist)
> +
>     while True:
>         (match, text) = sub.read_until_last_line_matches(
>                 [r"[Aa]re you sure", r"[Pp]assword:\s*$", r"^\s*[Ll]ogin:\s*$",
>
> _______________________________________________
> Autotest mailing list
> Autotest@xxxxxxxxxxxxxxx
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>



-- 
Lucas
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux