[tbot] [PATCH] tbot: Provide login_delay parameter for Linux board

Harald Seiler hws at denx.de
Thu Mar 7 15:24:24 UTC 2019


I have applied both patches to `development`.  Thanks!

On Tue, 2019-03-05 at 00:43 +0100, Lukasz Majewski wrote:
> From: lukma <lukma at denx.de>
> 
> This code improves the robustness on board, which by SW design
> floods the console excessively during boot up time.
> 
> However, after some time - specified by login_delay parameter -
> there is no flooding, so the prodecure for logging in can be
> reliably performed (_boot_to_shell)
> 
> Signed-off-by: Lukasz Majewski <lukma at denx.de>
> ---
>  tbot/machine/board/linux.py | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/tbot/machine/board/linux.py b/tbot/machine/board/linux.py
> index 246e262..56f717a 100644
> --- a/tbot/machine/board/linux.py
> +++ b/tbot/machine/board/linux.py
> @@ -30,6 +30,9 @@ class LinuxMachine(linux.LinuxMachine, board.BoardMachine[B]):
>      login_prompt = "login:"
>      """Prompt that indicates tbot should send the username."""
>  
> +    login_delay = 0
> +    """The delay between first occurence of login_prompt and actual login."""
> +
>      @property
>      @abc.abstractmethod
>      def shell(self) -> typing.Type[linux.shell.Shell]:
> @@ -82,6 +85,17 @@ class LinuxMachine(linux.LinuxMachine, board.BoardMachine[B]):
>              self.login_prompt, stream=stream, must_end=False
>          )
>  
> +        # On purpose do not login immediately as we may get some
> +        # console flooding from upper SW layers (and tbot's console setup
> +        # may get broken)
> +        if self.password is None and self.login_delay != 0:
> +            try:
> +                output += chan.read_until_prompt(
> +                    '', stream=stream, timeout=self.login_delay)
> +            except TimeoutError:
> +                pass
> +            chan.send("\n")
> +
>          chan.send(self.username + "\n")
>          if self.password is not None:
>              chan.read_until_prompt("word: ", stream=stream, must_end=False)
-- 
Harald

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-62  Fax: +49-8142-66989-80   Email: hws at denx.de



More information about the tbot mailing list