All of lore.kernel.org
 help / color / mirror / Atom feed
From: seanedmond@linux.microsoft.com
To: u-boot@lists.denx.de
Cc: joe.hershberger@ni.com, rfried.dev@gmail.com, sjg@chromium.org,
	v.v.mitrofanov@yadro.com, seanedmond@microsoft.com
Subject: [PATCH v2 3/3] net: dhcp6: Add a sandbox test for dhcp6
Date: Thu,  6 Apr 2023 23:56:19 -0700	[thread overview]
Message-ID: <20230407065619.15908-4-seanedmond@linux.microsoft.com> (raw)
In-Reply-To: <20230407065619.15908-1-seanedmond@linux.microsoft.com>

From: Sean Edmond <seanedmond@microsoft.com>

Requires proper environment with DHCP6 server provisioned.

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
---
 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 3a1f14c60f..f65965f864 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -340,3 +340,4 @@ CONFIG_TEST_FDTDEC=y
 CONFIG_UNIT_TEST=y
 CONFIG_UT_TIME=y
 CONFIG_UT_DM=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


  parent reply	other threads:[~2023-04-07  6:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07  6:56 [PATCH v2 0/3] *** net: DHCPv6 protocol and commands *** seanedmond
2023-04-07  6:56 ` [PATCH v2 1/3] net: dhcp6: Add DHCPv6 (DHCP for IPv6) seanedmond
2023-04-07 18:55   ` Simon Glass
2023-04-25 19:03     ` Ramon Fried
2023-05-02 22:11       ` Sean Edmond
2023-04-07  6:56 ` [PATCH v2 2/3] net: dhcp6: pxe: Add DHCP/PXE commands for IPv6 seanedmond
2023-04-07 18:55   ` Simon Glass
2023-04-11  0:03     ` Sean Edmond
2023-04-19  1:46       ` Simon Glass
2023-04-07  6:56 ` seanedmond [this message]
2023-04-07 18:55   ` [PATCH v2 3/3] net: dhcp6: Add a sandbox test for dhcp6 Simon Glass
2023-04-25 19:04     ` Ramon Fried

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=20230407065619.15908-4-seanedmond@linux.microsoft.com \
    --to=seanedmond@linux.microsoft.com \
    --cc=joe.hershberger@ni.com \
    --cc=rfried.dev@gmail.com \
    --cc=seanedmond@microsoft.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=v.v.mitrofanov@yadro.com \
    /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.