public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: autotest@test.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 1/9] KVM test: Introduce the prompt assist
Date: Thu, 06 May 2010 12:18:50 -0300	[thread overview]
Message-ID: <1273159130.15652.1.camel@freedom> (raw)
In-Reply-To: <4BE22FB3.4000401@redhat.com>

On Thu, 2010-05-06 at 10:55 +0800, Jason Wang wrote:
> Michael Goldish wrote:
> > On 04/26/2010 01:03 PM, Jason Wang wrote:
> >   
> >> Sometimes we need to send an assist string to a session in order to
> >> get the prompt especially when re-connecting to an already logged
> >> serial session. This patch send the assist string before doing the
> >> pattern matching of remote_login.
> >>     
> >
> > Can you give an example of a prompt assist string, and a typical usage
> > example?  What guests require prompt assist strings?
> >
> >   
> It was just used by serial console, consider when the first test case 
> have already connected to the serial console, so the second test must 
> send something in order to get the prompt string. But it may be better 
> to log out during when the session is closed.

This has a upside of making things cleaner, I'd consider that.

> >> Signed-off-by: Jason Wang <jasowang@redhat.com>
> >> ---
> >>  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..9adbaee 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):
> >>     
> >                                  ^ ^
> > These spaces do not conform with PEP 8.
> >   
> Would change them.
> >   
> >>      """
> >>      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)
> >> -
> >> +    @prarm prompt_assist: An assistant string sent before the pattern
> >>     
> >
> > Typo    ^
> >
> >   
> >> +            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*$",
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe kvm" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >>     
> >
> >   
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-05-06 15:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 10:03 [PATCH 0/9] Make use of the redirection of guest serial Jason Wang
2010-04-26 10:03 ` [PATCH 1/9] KVM test: Introduce the prompt assist Jason Wang
2010-04-28 11:28   ` Michael Goldish
2010-05-06  2:55     ` Jason Wang
2010-05-06 15:18       ` Lucas Meneghel Rodrigues [this message]
2010-04-26 10:03 ` [PATCH 2/9] KVM test: Add the ability to send the username in remote_login() Jason Wang
2010-04-28 11:32   ` Michael Goldish
2010-04-26 10:03 ` [PATCH 3/9] KVM test: Make the login re suitable for serial console Jason Wang
2010-04-28 11:18   ` Michael Goldish
2010-05-06  2:57     ` Jason Wang
2010-04-26 10:03 ` [PATCH 4/9] KVM test: Redirect the serial to the unix domain socket Jason Wang
2010-04-26 10:04 ` [PATCH 5/9] KVM test: Log the content from guest serial console Jason Wang
2010-04-28 13:26   ` Michael Goldish
2010-05-06  3:03     ` Jason Wang
2010-04-26 10:04 ` [PATCH 6/9] KVM test: Raise error when met unknown type in kvm_vm.remote_login() Jason Wang
2010-05-06 15:15   ` [Autotest] " Lucas Meneghel Rodrigues
2010-04-26 10:04 ` [PATCH 7/9] KVM test: Introduce the local_login() Jason Wang
2010-04-28 12:01   ` Michael Goldish
2010-04-28 23:44     ` Amos Kong
     [not found]     ` <20100428234409.GA2738@akong@redhat.com>
2010-05-05  9:37       ` [Autotest] " Michael Goldish
2010-05-06  3:07     ` Jason Wang
2010-04-26 10:04 ` [PATCH 8/9] KVM test: Create the background threads before calling process() Jason Wang
2010-04-28 11:55   ` Michael Goldish
2010-05-06 15:35     ` [Autotest] " Lucas Meneghel Rodrigues
2010-04-26 10:04 ` [PATCH 9/9] KVM test: Redirect the console to serial for all linux guests Jason Wang
2010-04-28 12:24   ` Michael Goldish
2010-05-06  3:08     ` Jason Wang
2010-05-06 15:43       ` Lucas Meneghel Rodrigues

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1273159130.15652.1.camel@freedom \
    --to=lmr@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox