U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Jerome Forissier <jerome.forissier@linaro.org>
Cc: u-boot@lists.denx.de,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Javier Tia <javier.tia@linaro.org>,
	Raymond Mao <raymond.mao@linaro.org>,
	Maxim Uvarov <muvarov@gmail.com>,
	Tim Harvey <tharvey@gateworks.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>
Subject: Re: [PATCH v8 22/23] test/py: add HTTP (wget) test for the EFI loader
Date: Wed, 7 Aug 2024 11:57:40 -0600	[thread overview]
Message-ID: <20240807175740.GH1626301@bill-the-cat> (raw)
In-Reply-To: <9b055b18f84755d775bf0cf4064e66801608839c.1723050310.git.jerome.forissier@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 4795 bytes --]

On Wed, Aug 07, 2024 at 07:12:06PM +0200, Jerome Forissier wrote:
> Add a test to test_efi_loader.py similar to the TFTP test but for HTTP
> with the wget command.
> 
> Suggested-by: Tom Rini <trini@konsulko.com>
> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> ---
>  test/py/tests/test_efi_loader.py | 52 +++++++++++++++++++++++---------
>  1 file changed, 37 insertions(+), 15 deletions(-)
> 
> diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py
> index 85473a9049b..64c994fdf95 100644
> --- a/test/py/tests/test_efi_loader.py
> +++ b/test/py/tests/test_efi_loader.py
> @@ -50,6 +50,8 @@ env__efi_loader_helloworld_file = {
>  import pytest
>  import u_boot_utils
>  
> +PROTO_TFTP, PROTO_HTTP = range(0, 2)
> +
>  net_set_up = False
>  
>  def test_efi_pre_commands(u_boot_console):
> @@ -110,10 +112,10 @@ def test_efi_setup_static(u_boot_console):
>      global net_set_up
>      net_set_up = True
>  
> -def fetch_tftp_file(u_boot_console, env_conf):
> -    """Grab an env described file via TFTP and return its address
> +def fetch_file(u_boot_console, env_conf, proto):
> +    """Grab an env described file via TFTP or HTTP and return its address
>  
> -    A file as described by an env config <env_conf> is downloaded from the TFTP
> +    A file as described by an env config <env_conf> is downloaded from the
>      server. The address to that file is returned.
>      """
>      if not net_set_up:
> @@ -128,7 +130,13 @@ def fetch_tftp_file(u_boot_console, env_conf):
>          addr = u_boot_utils.find_ram_base(u_boot_console)
>  
>      fn = f['fn']
> -    output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn))
> +    if proto == PROTO_TFTP:
> +        cmd = 'tftpboot'
> +    elif proto == PROTO_HTTP:
> +        cmd = 'wget'
> +    else:
> +        assert False
> +    output = u_boot_console.run_command('%s %x %s' % (cmd, addr, fn))
>      expected_text = 'Bytes transferred = '
>      sz = f.get('size', None)
>      if sz:
> @@ -147,16 +155,8 @@ def fetch_tftp_file(u_boot_console, env_conf):
>  
>      return addr
>  
> -@pytest.mark.buildconfigspec('of_control')
> -@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile')
> -def test_efi_helloworld_net(u_boot_console):
> -    """Run the helloworld.efi binary via TFTP.
> -
> -    The helloworld.efi file is downloaded from the TFTP server and is executed
> -    using the fallback device tree at $fdtcontroladdr.
> -    """
> -
> -    addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_helloworld_file')
> +def do_test_efi_helloworld_net(u_boot_console, proto):
> +    addr = fetch_file(u_boot_console, 'env__efi_loader_helloworld_file', proto)
>  
>      output = u_boot_console.run_command('bootefi %x' % addr)
>      expected_text = 'Hello, world'
> @@ -164,6 +164,28 @@ def test_efi_helloworld_net(u_boot_console):
>      expected_text = '## Application failed'
>      assert expected_text not in output
>  
> +@pytest.mark.buildconfigspec('of_control')
> +@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile')
> +def test_efi_helloworld_net_tftp(u_boot_console):
> +    """Run the helloworld.efi binary via TFTP.
> +
> +    The helloworld.efi file is downloaded from the TFTP server and is executed
> +    using the fallback device tree at $fdtcontroladdr.
> +    """
> +
> +    do_test_efi_helloworld_net(u_boot_console, PROTO_TFTP);
> +
> +@pytest.mark.buildconfigspec('of_control')
> +@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile')
> +def test_efi_helloworld_net_http(u_boot_console):
> +    """Run the helloworld.efi binary via HTTP.
> +
> +    The helloworld.efi file is downloaded from the HTTP server and is executed
> +    using the fallback device tree at $fdtcontroladdr.
> +    """
> +
> +    do_test_efi_helloworld_net(u_boot_console, PROTO_HTTP);
> +
>  @pytest.mark.buildconfigspec('cmd_bootefi_hello')
>  def test_efi_helloworld_builtin(u_boot_console):
>      """Run the builtin helloworld.efi binary.
> @@ -185,7 +207,7 @@ def test_efi_grub_net(u_boot_console):
>      executed.
>      """
>  
> -    addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_grub_file')
> +    addr = fetch_file(u_boot_console, 'env__efi_loader_grub_file', PROTO_TFTP)
>  
>      u_boot_console.run_command('bootefi %x' % addr, wait_for_prompt=False)

Looking at this now that I've added wget to my Pi builds, erm:
U-Boot> wget 200000 EFI/arm64/helloworld.efi

That's not going to work. That's what works fine for a tftp server. I
think the test is going to need to require some http specific
configuration added (and I'll locally start firing off the python
trivial http server or something, for tests).

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  parent reply	other threads:[~2024-08-07 17:57 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07 17:11 [PATCH v8 00/23] Introduce the lwIP network stack Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 01/23] flash: prefix error codes with FL_ Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 02/23] net: wget: removed unused function wget_success() Jerome Forissier
2024-08-09 10:50   ` Ilias Apalodimas
2024-08-07 17:11 ` [PATCH v8 03/23] net: wget: allow EFI boot Jerome Forissier
2024-08-09 10:53   ` Ilias Apalodimas
2024-08-09 12:38     ` Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 04/23] net: introduce alternative implementation as net-lwip/ Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 05/23] configs: replace '# CONFIG_NET is not set' with CONFIG_NO_NET=y Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 06/23] net: fec_mxc_init(): do not ignore return status of fec_open() Jerome Forissier
2024-08-07 18:05   ` Fabio Estevam
2024-08-08 13:01     ` Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 07/23] net: split include/net.h into net{, -common, -legacy, -lwip}.h Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 08/23] net: eth-uclass: add function eth_start_udev() Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 09/23] net-lwip: build lwIP Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 10/23] net-lwip: add DHCP support and dhcp commmand Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 11/23] net-lwip: add TFTP support and tftpboot command Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 12/23] net-lwip: add ping command Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 13/23] net-lwip: add dns command Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 14/23] net: split cmd/net.c into cmd/net.c and cmd/net-common.c Jerome Forissier
2024-08-07 17:11 ` [PATCH v8 15/23] net-lwip: add wget command Jerome Forissier
2024-08-07 17:12 ` [PATCH v8 16/23] net-lwip: lwIP wget supports user defined port in the uri, so allow it Jerome Forissier
2024-08-07 17:12 ` [PATCH v8 17/23] cmd: bdinfo: enable -e when CONFIG_CMD_NET_LWIP=y Jerome Forissier
2024-08-07 17:12 ` [PATCH v8 18/23] configs: add qemu_arm64_lwip_defconfig Jerome Forissier
2024-08-07 17:12 ` [PATCH v8 19/23] lwip: tftp: add support of blksize option to client Jerome Forissier
2024-08-07 17:12 ` [PATCH v8 20/23] net-lwip: add TFTP_BLOCKSIZE Jerome Forissier
2024-08-07 17:12 ` [PATCH v8 21/23] CI: add qemu_arm64_lwip to the test matrix Jerome Forissier
2024-08-07 17:12 ` [PATCH v8 22/23] test/py: add HTTP (wget) test for the EFI loader Jerome Forissier
2024-08-07 17:52   ` Tom Rini
2024-08-08 13:15     ` Jerome Forissier
2024-08-07 17:57   ` Tom Rini [this message]
2024-08-08 13:06     ` Jerome Forissier
2024-08-08 15:52       ` Tom Rini
2024-08-08 16:10         ` Jerome Forissier
2024-08-08 16:20       ` Tom Rini
2024-08-08 16:30         ` Jerome Forissier
2024-08-07 17:12 ` [PATCH v8 23/23] MAINTAINERS: net-lwip: add myself as a maintainer Jerome Forissier
2024-08-07 20:44 ` [PATCH v8 00/23] Introduce the lwIP network stack Tom Rini
2024-08-08 16:41   ` Jerome Forissier
2024-08-08 17:24     ` Tom Rini
2024-08-09 13:19       ` Jerome Forissier
2024-08-09 19:46         ` Tom Rini
2024-08-16 16:21   ` Jerome Forissier
2024-08-16 18:40     ` Tom Rini
2024-08-19 14:53       ` Jerome Forissier
2024-08-19 22:08         ` Tom Rini
2024-08-21  9:04           ` Jerome Forissier

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=20240807175740.GH1626301@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=javier.tia@linaro.org \
    --cc=jerome.forissier@linaro.org \
    --cc=muvarov@gmail.com \
    --cc=raymond.mao@linaro.org \
    --cc=tharvey@gateworks.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox