aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Forissier <jerome.forissier@linaro.org>2024-05-24 18:20:06 +0200
committerTom Rini <trini@konsulko.com>2024-05-25 08:43:17 -0600
commit4ea1e2162d7b5a9db5ec26de30c68d9598a4abaa (patch)
tree29a4feb6fff39de6a3406f425a6d4a1686bfdc2b
parentb3f69d7f003db5c0eb87e629435727337c6e9626 (diff)
downloadu-boot-4ea1e2162d7b5a9db5ec26de30c68d9598a4abaa.zip
u-boot-4ea1e2162d7b5a9db5ec26de30c68d9598a4abaa.tar.gz
u-boot-4ea1e2162d7b5a9db5ec26de30c68d9598a4abaa.tar.bz2
test/py: net: add _lwip variants of dhcp, ping and tftpboot tests
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@linaro.org>
-rw-r--r--test/py/tests/test_net.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
index 038a473..ba30780 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
+@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
+@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'
+ 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
+@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.