[PATCH v2 12/14] test/py: net: add _lwip variants of dhcp, ping and tftpboot tests

Maxim Uvarov muvarov at gmail.com
Thu May 30 16:22:24 CEST 2024


чт, 30 мая 2024 г. в 17:11, Jerome Forissier <jerome.forissier at linaro.org>:
>
>
>
> On 5/28/24 11:53, Maxim Uvarov wrote:
> > пт, 24 мая 2024 г. в 19:22, Jerome Forissier <jerome.forissier at linaro.org>:
> >>
> >> WHen NET_LWIP is enabled, the dhcp/ping/tftpboot commands are enabled
> >> via CMD_DHCP_LWIP, CMD_PING_LWIP and CMD_TFTPBOOT_LWIP, respectively;
> >> therefore the config annotations in the Python test scripts need to be
> >> cmd_dhcp_lwip, cmd_ping_lwip and cmd_tftpboot_lwip.
> >>
> >> The console output of the tftpboot command with lwIP is slightly
> >> different from the non-lwIP implementation. This is taken care of in
> >> test_net_tftpboot().
> >>
> >> Signed-off-by: Jerome Forissier <jerome.forissier at linaro.org>
> >> ---
> >>  test/py/tests/test_net.py | 21 +++++++++++++++++----
> >>  1 file changed, 17 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
> >> index 038a473b239..ba30780903f 100644
> >> --- a/test/py/tests/test_net.py
> >> +++ b/test/py/tests/test_net.py
> >> @@ -127,6 +127,10 @@ def test_net_dhcp(u_boot_console):
> >>      global net_set_up
> >>      net_set_up = True
> >>
> >> + at pytest.mark.buildconfigspec('cmd_dhcp_lwip')
> >> +def test_net_dhcp_lwip(u_boot_console):
> >> +    test_net_dhcp(u_boot_console)
> >> +
> >>  @pytest.mark.buildconfigspec('cmd_dhcp')
> >>  @pytest.mark.buildconfigspec('cmd_mii')
> >>  def test_net_dhcp_abort(u_boot_console):
> >> @@ -230,6 +234,10 @@ def test_net_ping(u_boot_console):
> >>      output = u_boot_console.run_command('ping $serverip')
> >>      assert 'is alive' in output
> >>
> >> + at pytest.mark.buildconfigspec('cmd_ping_lwip')
> >> +def test_net_ping_lwip(u_boot_console):
> >> +    test_net_ping(u_boot_console)
> >> +
> >>  @pytest.mark.buildconfigspec('IPV6_ROUTER_DISCOVERY')
> >>  def test_net_network_discovery(u_boot_console):
> >>      """Test the network discovery feature of IPv6.
> >> @@ -255,7 +263,7 @@ def test_net_network_discovery(u_boot_console):
> >>      assert '0000:0000:0000:0000:0000:0000:0000:0000' not in output
> >>
> >>  @pytest.mark.buildconfigspec('cmd_net')
> >> -def test_net_tftpboot(u_boot_console):
> >> +def test_net_tftpboot(u_boot_console, lwip = False):
> >>      """Test the tftpboot command.
> >>
> >>      A file is downloaded from the TFTP server, its size and optionally its
> >> @@ -279,10 +287,11 @@ def test_net_tftpboot(u_boot_console):
> >>          output = u_boot_console.run_command('tftpboot %s' % (fn))
> >>      else:
> >>          output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn))
> >> -    expected_text = 'Bytes transferred = '
> >>      sz = f.get('size', None)
> >> -    if sz:
> >> -        expected_text += '%d' % sz
> >> +    if lwip:
> >> +        expected_text = f'{sz} bytes transferred'
> >
> > Why not change patch 5 to print with capital character to match this pattern?
>
> I thought unifying the messages of wget and tftp would be a good idea. With
> this series, both commands print hash signs followed by:
> "xxx bytes transferred (yy MB/s)".
>
> Would a patch updating the tftp message when the legacy stack is used be
> acceptable?
>
> --
> Jerome
>

I think yes.

BR,
Maxim.

> > BR,
> > Maxim.
> >
> >> +    else:
> >> +        expected_text = f'Bytes transferred = {sz}'
> >>      assert expected_text in output
> >>
> >>      expected_crc = f.get('crc32', None)
> >> @@ -295,6 +304,10 @@ def test_net_tftpboot(u_boot_console):
> >>      output = u_boot_console.run_command('crc32 $fileaddr $filesize')
> >>      assert expected_crc in output
> >>
> >> + at pytest.mark.buildconfigspec("cmd_net_lwip")
> >> +def test_net_tftpboot_lwip(u_boot_console):
> >> +    test_net_tftpboot(u_boot_console, True)
> >> +
> >>  @pytest.mark.buildconfigspec('cmd_nfs')
> >>  def test_net_nfs(u_boot_console):
> >>      """Test the nfs command.
> >> --
> >> 2.40.1
> >>
> >
> >



-- 
Best regards,
Maxim Uvarov


More information about the U-Boot mailing list