All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH 25/42] test: Allow connecting to a running board
Date: Tue, 25 Jun 2024 01:56:35 +0200	[thread overview]
Message-ID: <ZnoHs6YiQlsoUWrL@toradex.com> (raw)
In-Reply-To: <20240611200156.2245525-26-sjg@chromium.org>

On Tue, Jun 11, 2024 at 02:01:39PM -0600, Simon Glass wrote:
> Sometimes we know that the board is already running the right software,
> so provide an option to allow running of tests directly, without first
> resetting the board.
> 
> This saves time when re-running a test where only the Python code is
> changing.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  test/py/conftest.py                   |  3 +++
>  test/py/u_boot_console_base.py        | 14 ++++++++++----
>  test/py/u_boot_console_exec_attach.py | 21 ++++++++++++---------
>  3 files changed, 25 insertions(+), 13 deletions(-)
> 
> diff --git a/test/py/conftest.py b/test/py/conftest.py
> index fc9dd3a83f8..ca66b9d9e61 100644
> --- a/test/py/conftest.py
> +++ b/test/py/conftest.py
> @@ -79,6 +79,8 @@ def pytest_addoption(parser):
>      parser.addoption('--gdbserver', default=None,
>          help='Run sandbox under gdbserver. The argument is the channel '+
>          'over which gdbserver should communicate, e.g. localhost:1234')
> +    parser.addoption('--no-prompt-wait', default=False, action='store_true',
> +        help="Assume that U-Boot is ready and don't wait for a prompt")
>  
>  def run_build(config, source_dir, build_dir, board_type, log):
>      """run_build: Build U-Boot
> @@ -238,6 +240,7 @@ def pytest_configure(config):
>      ubconfig.board_type = board_type
>      ubconfig.board_identity = board_identity
>      ubconfig.gdbserver = gdbserver
> +    ubconfig.no_prompt_wait = config.getoption('no_prompt_wait')
>      ubconfig.dtb = build_dir + '/arch/sandbox/dts/test.dtb'
>  
>      env_vars = (
> diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
> index e4f86f6af5b..a61eec31148 100644
> --- a/test/py/u_boot_console_base.py
> +++ b/test/py/u_boot_console_base.py
> @@ -413,11 +413,17 @@ class ConsoleBase(object):
>              if not self.config.gdbserver:
>                  self.p.timeout = TIMEOUT_MS
>              self.p.logfile_read = self.logstream
> -            if expect_reset:
> -                loop_num = 2
> +            if self.config.no_prompt_wait:
> +                # Send an empty command to set up the 'expect' logic. This has
> +                # the side effect of ensuring that there was no partial command
> +                # line entered
> +                self.run_command(' ')
>              else:
> -                loop_num = 1
> -            self.wait_for_boot_prompt(loop_num = loop_num)
> +                if expect_reset:
> +                    loop_num = 2
> +                else:
> +                    loop_num = 1
> +                self.wait_for_boot_prompt(loop_num = loop_num)

Hi Simon,

I had a very bad day, so here you go:

== ?

/Andrejs

>              self.at_prompt = True
>              self.at_prompt_logevt = self.logstream.logfile.cur_evt
>          except Exception as ex:
> diff --git a/test/py/u_boot_console_exec_attach.py b/test/py/u_boot_console_exec_attach.py
> index 5f4916b7da2..42fc15197b9 100644
> --- a/test/py/u_boot_console_exec_attach.py
> +++ b/test/py/u_boot_console_exec_attach.py
> @@ -59,15 +59,18 @@ class ConsoleExecAttach(ConsoleBase):
>          args = [self.config.board_type, self.config.board_identity]
>          s = Spawn(['u-boot-test-console'] + args)
>  
> -        try:
> -            self.log.action('Resetting board')
> -            cmd = ['u-boot-test-reset'] + args
> -            runner = self.log.get_runner(cmd[0], sys.stdout)
> -            runner.run(cmd)
> -            runner.close()
> -        except:
> -            s.close()
> -            raise
> +        if self.config.no_prompt_wait:
> +            self.log.action('Connecting to board without reset')
> +        else:
> +            try:
> +                self.log.action('Resetting board')
> +                cmd = ['u-boot-test-reset'] + args
> +                runner = self.log.get_runner(cmd[0], sys.stdout)
> +                runner.run(cmd)
> +                runner.close()
> +            except:
> +                s.close()
> +                raise
>  
>          return s
>  
> -- 
> 2.34.1
> 


  reply	other threads:[~2024-06-25  1:15 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 20:01 [PATCH 00/42] labgrid: Provide an integration with Labgrid Simon Glass
2024-06-11 20:01 ` [PATCH 01/42] trace: Update test to tolerate different trace-cmd version Simon Glass
2024-06-11 20:01 ` [PATCH 02/42] binman: efi: Correct entry docs Simon Glass
2024-06-11 20:01 ` [PATCH 03/42] binman: Regenerate nxp docs Simon Glass
2024-06-11 20:01 ` [PATCH 04/42] binman: ti: Regenerate entry docs Simon Glass
2024-06-11 20:01 ` [PATCH 05/42] binman: Update the entrydocs header Simon Glass
2024-06-11 20:01 ` [PATCH 06/42] buildman: Make mrproper an argument to _reconfigure() Simon Glass
2024-06-11 20:01 ` [PATCH 07/42] buildman: Make mrproper an argument to _config_and_build() Simon Glass
2024-06-11 20:01 ` [PATCH 08/42] buildman: Make mrproper an argument to run_commit() Simon Glass
2024-06-11 20:01 ` [PATCH 09/42] buildman: Avoid rebuilding when --mrproper is used Simon Glass
2024-06-11 20:01 ` [PATCH 10/42] buildman: Add a flag to force mrproper on failure Simon Glass
2024-06-11 20:01 ` [PATCH 11/42] buildman: Retry the build for current source Simon Glass
2024-06-11 20:01 ` [PATCH 12/42] buildman: Add a way to limit the number of buildmans Simon Glass
2024-06-11 20:01 ` [PATCH 13/42] dm: core: Enhance comments on bind_drivers_pass() Simon Glass
2024-06-11 20:01 ` [PATCH 14/42] initcall: Correct use of relocation offset Simon Glass
2024-06-12  9:04   ` Caleb Connolly
2024-06-11 20:01 ` [PATCH 15/42] am33xx: Provide a function to set up the debug UART Simon Glass
2024-06-11 20:01 ` [PATCH 16/42] sunxi: Mark scp as optional Simon Glass
2024-06-11 20:01 ` [PATCH 17/42] google: Disable TPMv2 on most Chromebooks Simon Glass
2024-06-12  5:50   ` Ilias Apalodimas
2024-06-11 20:01 ` [PATCH 18/42] meson: Correct driver declaration for meson_axg_gpio Simon Glass
2024-06-12  9:38   ` Neil Armstrong
2024-06-11 20:01 ` [PATCH 19/42] test: Allow signaling that U-Boot is ready Simon Glass
2024-06-11 20:01 ` [PATCH 20/42] test: Make bootstd init run only on sandbox Simon Glass
2024-06-11 20:01 ` [PATCH 21/42] test: Use a constant for the test timeout Simon Glass
2024-06-11 20:01 ` [PATCH 22/42] test: Pass stderr to stdout Simon Glass
2024-06-11 20:01 ` [PATCH 23/42] test: Release board after tests complete Simon Glass
2024-06-12 16:02   ` Tom Rini
2024-06-12 20:24     ` Simon Glass
2024-06-11 20:01 ` [PATCH 24/42] log: Allow tests to pass with CONFIG_LOGF_FUNC_PAD set Simon Glass
2024-06-11 20:01 ` [PATCH 25/42] test: Allow connecting to a running board Simon Glass
2024-06-24 23:56   ` Andrejs Cainikovs [this message]
2024-06-25 12:31     ` Simon Glass
2024-06-25 14:14       ` Tom Rini
2024-06-25 15:21         ` Andrejs Cainikovs
2024-06-11 20:01 ` [PATCH 26/42] test: Decode exceptions only with sandbox Simon Glass
2024-06-11 20:01 ` [PATCH 27/42] test: Avoid failing skipped tests Simon Glass
2024-06-11 20:01 ` [PATCH 28/42] test: dm: Show failing driver name Simon Glass
2024-06-11 20:01 ` [PATCH 29/42] test: Check help output Simon Glass
2024-06-11 20:01 ` [PATCH 30/42] test: Create a common function to get the config Simon Glass
2024-06-11 20:01 ` [PATCH 31/42] test: Introduce the concept of a role Simon Glass
2024-06-11 20:01 ` [PATCH 32/42] test: Move the receive code into a function Simon Glass
2024-06-11 20:01 ` [PATCH 33/42] test: Separate out the exception handling Simon Glass
2024-06-11 20:01 ` [PATCH 34/42] test: Detect dead connections Simon Glass
2024-06-11 20:01 ` [PATCH 35/42] test: Tidy up remaining exceptions Simon Glass
2024-06-11 20:01 ` [PATCH 36/42] test: Introduce lab mode Simon Glass
2024-06-11 20:01 ` [PATCH 37/42] test: Improve handling of sending commands Simon Glass
2024-06-11 20:01 ` [PATCH 38/42] test: Fix mulptiplex_log typo Simon Glass
2024-06-11 20:01 ` [PATCH 39/42] test: Avoid double echo when starting up Simon Glass
2024-06-11 20:01 ` [PATCH 40/42] test: Try to shut down the lab console gracefully Simon Glass
2024-06-11 20:01 ` [PATCH 41/42] test: Add a section for closing the connection Simon Glass
2024-06-11 20:01 ` [PATCH 42/42] CI: Allow running tests on sjg lab Simon Glass
2024-06-12  8:43   ` Andrejs Cainikovs
2024-06-11 20:09 ` [PATCH 00/42] labgrid: Provide an integration with Labgrid Simon Glass
2024-06-12  6:08 ` Ilias Apalodimas
2024-06-12 16:03   ` Tom Rini
2024-06-12 20:24     ` Simon Glass
2024-06-12 20:24   ` Simon Glass
2024-06-26  9:43 ` (subset) " Neil Armstrong

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=ZnoHs6YiQlsoUWrL@toradex.com \
    --to=andrejs.cainikovs@toradex.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.