Re: [PATCH v3 3/3] net: dhcp6: Add a sandbox test for dhcp6
On Tue, Apr 11, 2023 at 10:48:48AM -0700, seanedm...@linux.microsoft.com wrote: > From: Sean Edmond > > Requires proper environment with DHCP6 server provisioned. > > Signed-off-by: Sean Edmond > Reviewed-by: Ramon Fried Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v3 3/3] net: dhcp6: Add a sandbox test for dhcp6
On Tue, Apr 11, 2023 at 8:48 PM wrote: > > From: Sean Edmond > > Requires proper environment with DHCP6 server provisioned. > > Signed-off-by: Sean Edmond > --- > configs/sandbox_defconfig | 1 + > test/py/tests/test_net.py | 25 + > 2 files changed, 26 insertions(+) > > diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig > index ca95b2c5d2..d7ceedd601 100644 > --- a/configs/sandbox_defconfig > +++ b/configs/sandbox_defconfig > @@ -341,3 +341,4 @@ CONFIG_UNIT_TEST=y > CONFIG_UT_TIME=y > CONFIG_UT_DM=y > CONFIG_CMD_2048=y > +CONFIG_CMD_DHCP6=y > diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py > index 9ca6743afd..0447c0b2e0 100644 > --- a/test/py/tests/test_net.py > +++ b/test/py/tests/test_net.py > @@ -29,6 +29,11 @@ env__net_uses_pci = True > # set to False. > env__net_dhcp_server = True > > +# True if a DHCPv6 server is attached to the network, and should be tested. > +# If DHCPv6 testing is not possible or desired, this variable may be omitted > or > +# set to False. > +env__net_dhcp6_server = True > + > # A list of environment variables that should be set in order to configure a > # static IP. If solely relying on DHCP, this variable may be omitted or set > to > # an empty list. > @@ -58,6 +63,7 @@ env__net_nfs_readable_file = { > """ > > net_set_up = False > +net6_set_up = False > > def test_net_pre_commands(u_boot_console): > """Execute any commands required to enable network hardware. > @@ -93,6 +99,25 @@ def test_net_dhcp(u_boot_console): > global net_set_up > net_set_up = True > > +@pytest.mark.buildconfigspec('cmd_dhcp6') > +def test_net_dhcp6(u_boot_console): > +"""Test the dhcp6 command. > + > +The boardenv_* file may be used to enable/disable this test; see the > +comment at the beginning of this file. > +""" > + > +test_dhcp6 = u_boot_console.config.env.get('env__net_dhcp6_server', > False) > +if not test_dhcp6: > +pytest.skip('No DHCP6 server available') > + > +u_boot_console.run_command('setenv autoload no') > +output = u_boot_console.run_command('dhcp6') > +assert 'DHCP6 client bound to ' in output > + > +global net6_set_up > +net6_set_up = True > + > @pytest.mark.buildconfigspec('net') > def test_net_setup_static(u_boot_console): > """Set up a static IP configuration. > -- > 2.40.0 > Reviewed-by: Ramon Fried
[PATCH v3 3/3] net: dhcp6: Add a sandbox test for dhcp6
From: Sean Edmond Requires proper environment with DHCP6 server provisioned. Signed-off-by: Sean Edmond --- configs/sandbox_defconfig | 1 + test/py/tests/test_net.py | 25 + 2 files changed, 26 insertions(+) diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index ca95b2c5d2..d7ceedd601 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -341,3 +341,4 @@ CONFIG_UNIT_TEST=y CONFIG_UT_TIME=y CONFIG_UT_DM=y CONFIG_CMD_2048=y +CONFIG_CMD_DHCP6=y diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py index 9ca6743afd..0447c0b2e0 100644 --- a/test/py/tests/test_net.py +++ b/test/py/tests/test_net.py @@ -29,6 +29,11 @@ env__net_uses_pci = True # set to False. env__net_dhcp_server = True +# True if a DHCPv6 server is attached to the network, and should be tested. +# If DHCPv6 testing is not possible or desired, this variable may be omitted or +# set to False. +env__net_dhcp6_server = True + # A list of environment variables that should be set in order to configure a # static IP. If solely relying on DHCP, this variable may be omitted or set to # an empty list. @@ -58,6 +63,7 @@ env__net_nfs_readable_file = { """ net_set_up = False +net6_set_up = False def test_net_pre_commands(u_boot_console): """Execute any commands required to enable network hardware. @@ -93,6 +99,25 @@ def test_net_dhcp(u_boot_console): global net_set_up net_set_up = True +@pytest.mark.buildconfigspec('cmd_dhcp6') +def test_net_dhcp6(u_boot_console): +"""Test the dhcp6 command. + +The boardenv_* file may be used to enable/disable this test; see the +comment at the beginning of this file. +""" + +test_dhcp6 = u_boot_console.config.env.get('env__net_dhcp6_server', False) +if not test_dhcp6: +pytest.skip('No DHCP6 server available') + +u_boot_console.run_command('setenv autoload no') +output = u_boot_console.run_command('dhcp6') +assert 'DHCP6 client bound to ' in output + +global net6_set_up +net6_set_up = True + @pytest.mark.buildconfigspec('net') def test_net_setup_static(u_boot_console): """Set up a static IP configuration. -- 2.40.0