* [PATCH] test/py: net: Add a test for 'pxe get' command
@ 2023-10-03 13:12 Love Kumar
2023-10-06 20:27 ` Ramon Fried
2023-10-13 9:00 ` Michal Simek
0 siblings, 2 replies; 4+ messages in thread
From: Love Kumar @ 2023-10-03 13:12 UTC (permalink / raw)
To: u-boot
Cc: michal.simek, git, rfried.dev, v.v.mitrofanov, seanedmond, emohandesi
Execute the 'pxe get' command to download a pxe configuration file from
the TFTP server and validate its interpretation.
Signed-off-by: Love Kumar <love.kumar@amd.com>
---
test/py/tests/test_net.py | 66 +++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
index cd4b4dc53cbc..b2241ae6a482 100644
--- a/test/py/tests/test_net.py
+++ b/test/py/tests/test_net.py
@@ -6,6 +6,7 @@
import pytest
import u_boot_utils
+import uuid
"""
Note: This test relies on boardenv_* containing configuration values to define
@@ -61,6 +62,16 @@ env__net_nfs_readable_file = {
'crc32': 'c2244b26',
}
+# Details regarding a file that may be read from a TFTP server. This variable
+# may be omitted or set to None if PXE testing is not possible or desired.
+env__net_pxe_readable_file = {
+ 'fn': 'default',
+ 'addr': 0x2000000,
+ 'size': 74,
+ 'timeout': 50000,
+ 'pattern': 'Linux',
+}
+
# True if a router advertisement service is connected to the network, and should
# be tested. If router advertisement testing is not possible or desired, this
variable may be omitted or set to False.
@@ -260,3 +271,58 @@ def test_net_nfs(u_boot_console):
output = u_boot_console.run_command('crc32 %x $filesize' % addr)
assert expected_crc in output
+
+@pytest.mark.buildconfigspec("cmd_net")
+@pytest.mark.buildconfigspec("cmd_pxe")
+def test_net_pxe_get(u_boot_console):
+ """Test the pxe get command.
+
+ A pxe configuration file is downloaded from the TFTP server and interpreted
+ to boot the images mentioned in pxe configuration file.
+
+ The details of the file to download are provided by the boardenv_* file;
+ see the comment at the beginning of this file.
+ """
+
+ if not net_set_up:
+ pytest.skip("Network not initialized")
+
+ test_net_setup_static(u_boot_console)
+
+ f = u_boot_console.config.env.get("env__net_pxe_readable_file", None)
+ if not f:
+ pytest.skip("No PXE readable file to read")
+
+ addr = f.get("addr", None)
+ timeout = f.get("timeout", u_boot_console.p.timeout)
+
+ pxeuuid = uuid.uuid1()
+ u_boot_console.run_command(f"setenv pxeuuid {pxeuuid}")
+ expected_text_uuid = f"Retrieving file: pxelinux.cfg/{pxeuuid}"
+
+ ethaddr = u_boot_console.run_command("echo $ethaddr")
+ ethaddr = ethaddr.replace(':', '-')
+ expected_text_ethaddr = f"Retrieving file: pxelinux.cfg/01-{ethaddr}"
+
+ ip = u_boot_console.run_command("echo $ipaddr")
+ ip = ip.split('.')
+ ipaddr_file = "".join(['%02x' % int(x) for x in ip]).upper()
+ expected_text_ipaddr = f"Retrieving file: pxelinux.cfg/{ipaddr_file}"
+ expected_text_default = f"Retrieving file: pxelinux.cfg/default"
+
+ with u_boot_console.temporary_timeout(timeout):
+ output = u_boot_console.run_command("pxe get")
+
+ assert "TIMEOUT" not in output
+ assert expected_text_uuid in output
+ assert expected_text_ethaddr in output
+ assert expected_text_ipaddr in output
+
+ i = 1
+ for i in range(0, len(ipaddr_file) - 1):
+ expected_text_ip = f"Retrieving file: pxelinux.cfg/{ipaddr_file[:-i]}"
+ assert expected_text_ip in output
+ i += 1
+
+ assert expected_text_default in output
+ assert "Config file 'default.boot' found" in output
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] test/py: net: Add a test for 'pxe get' command
2023-10-03 13:12 [PATCH] test/py: net: Add a test for 'pxe get' command Love Kumar
@ 2023-10-06 20:27 ` Ramon Fried
2023-10-10 12:56 ` Michal Simek
2023-10-13 9:00 ` Michal Simek
1 sibling, 1 reply; 4+ messages in thread
From: Ramon Fried @ 2023-10-06 20:27 UTC (permalink / raw)
To: Love Kumar
Cc: u-boot, michal.simek, git, v.v.mitrofanov, seanedmond, emohandesi
On Tue, Oct 3, 2023 at 4:12 PM Love Kumar <love.kumar@amd.com> wrote:
>
> Execute the 'pxe get' command to download a pxe configuration file from
> the TFTP server and validate its interpretation.
>
> Signed-off-by: Love Kumar <love.kumar@amd.com>
> ---
> test/py/tests/test_net.py | 66 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 66 insertions(+)
>
> diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
> index cd4b4dc53cbc..b2241ae6a482 100644
> --- a/test/py/tests/test_net.py
> +++ b/test/py/tests/test_net.py
> @@ -6,6 +6,7 @@
>
> import pytest
> import u_boot_utils
> +import uuid
>
> """
> Note: This test relies on boardenv_* containing configuration values to define
> @@ -61,6 +62,16 @@ env__net_nfs_readable_file = {
> 'crc32': 'c2244b26',
> }
>
> +# Details regarding a file that may be read from a TFTP server. This variable
> +# may be omitted or set to None if PXE testing is not possible or desired.
> +env__net_pxe_readable_file = {
> + 'fn': 'default',
> + 'addr': 0x2000000,
> + 'size': 74,
> + 'timeout': 50000,
> + 'pattern': 'Linux',
> +}
> +
> # True if a router advertisement service is connected to the network, and should
> # be tested. If router advertisement testing is not possible or desired, this
> variable may be omitted or set to False.
> @@ -260,3 +271,58 @@ def test_net_nfs(u_boot_console):
>
> output = u_boot_console.run_command('crc32 %x $filesize' % addr)
> assert expected_crc in output
> +
> +@pytest.mark.buildconfigspec("cmd_net")
> +@pytest.mark.buildconfigspec("cmd_pxe")
> +def test_net_pxe_get(u_boot_console):
> + """Test the pxe get command.
> +
> + A pxe configuration file is downloaded from the TFTP server and interpreted
> + to boot the images mentioned in pxe configuration file.
> +
> + The details of the file to download are provided by the boardenv_* file;
> + see the comment at the beginning of this file.
> + """
> +
> + if not net_set_up:
> + pytest.skip("Network not initialized")
> +
> + test_net_setup_static(u_boot_console)
> +
> + f = u_boot_console.config.env.get("env__net_pxe_readable_file", None)
> + if not f:
> + pytest.skip("No PXE readable file to read")
> +
> + addr = f.get("addr", None)
> + timeout = f.get("timeout", u_boot_console.p.timeout)
> +
> + pxeuuid = uuid.uuid1()
> + u_boot_console.run_command(f"setenv pxeuuid {pxeuuid}")
> + expected_text_uuid = f"Retrieving file: pxelinux.cfg/{pxeuuid}"
> +
> + ethaddr = u_boot_console.run_command("echo $ethaddr")
> + ethaddr = ethaddr.replace(':', '-')
> + expected_text_ethaddr = f"Retrieving file: pxelinux.cfg/01-{ethaddr}"
> +
> + ip = u_boot_console.run_command("echo $ipaddr")
> + ip = ip.split('.')
> + ipaddr_file = "".join(['%02x' % int(x) for x in ip]).upper()
> + expected_text_ipaddr = f"Retrieving file: pxelinux.cfg/{ipaddr_file}"
> + expected_text_default = f"Retrieving file: pxelinux.cfg/default"
> +
> + with u_boot_console.temporary_timeout(timeout):
> + output = u_boot_console.run_command("pxe get")
> +
> + assert "TIMEOUT" not in output
> + assert expected_text_uuid in output
> + assert expected_text_ethaddr in output
> + assert expected_text_ipaddr in output
> +
> + i = 1
> + for i in range(0, len(ipaddr_file) - 1):
> + expected_text_ip = f"Retrieving file: pxelinux.cfg/{ipaddr_file[:-i]}"
> + assert expected_text_ip in output
> + i += 1
> +
> + assert expected_text_default in output
> + assert "Config file 'default.boot' found" in output
> --
> 2.25.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] test/py: net: Add a test for 'pxe get' command
2023-10-06 20:27 ` Ramon Fried
@ 2023-10-10 12:56 ` Michal Simek
0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2023-10-10 12:56 UTC (permalink / raw)
To: Ramon Fried, Love Kumar
Cc: u-boot, git, v.v.mitrofanov, seanedmond, emohandesi
On 10/6/23 22:27, Ramon Fried wrote:
> On Tue, Oct 3, 2023 at 4:12 PM Love Kumar <love.kumar@amd.com> wrote:
>>
>> Execute the 'pxe get' command to download a pxe configuration file from
>> the TFTP server and validate its interpretation.
>>
>> Signed-off-by: Love Kumar <love.kumar@amd.com>
>> ---
>> test/py/tests/test_net.py | 66 +++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 66 insertions(+)
>>
>> diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
>> index cd4b4dc53cbc..b2241ae6a482 100644
>> --- a/test/py/tests/test_net.py
>> +++ b/test/py/tests/test_net.py
>> @@ -6,6 +6,7 @@
>>
>> import pytest
>> import u_boot_utils
>> +import uuid
>>
>> """
>> Note: This test relies on boardenv_* containing configuration values to define
>> @@ -61,6 +62,16 @@ env__net_nfs_readable_file = {
>> 'crc32': 'c2244b26',
>> }
>>
>> +# Details regarding a file that may be read from a TFTP server. This variable
>> +# may be omitted or set to None if PXE testing is not possible or desired.
>> +env__net_pxe_readable_file = {
>> + 'fn': 'default',
>> + 'addr': 0x2000000,
>> + 'size': 74,
>> + 'timeout': 50000,
>> + 'pattern': 'Linux',
>> +}
>> +
>> # True if a router advertisement service is connected to the network, and should
>> # be tested. If router advertisement testing is not possible or desired, this
>> variable may be omitted or set to False.
>> @@ -260,3 +271,58 @@ def test_net_nfs(u_boot_console):
>>
>> output = u_boot_console.run_command('crc32 %x $filesize' % addr)
>> assert expected_crc in output
>> +
>> +@pytest.mark.buildconfigspec("cmd_net")
>> +@pytest.mark.buildconfigspec("cmd_pxe")
>> +def test_net_pxe_get(u_boot_console):
>> + """Test the pxe get command.
>> +
>> + A pxe configuration file is downloaded from the TFTP server and interpreted
>> + to boot the images mentioned in pxe configuration file.
>> +
>> + The details of the file to download are provided by the boardenv_* file;
>> + see the comment at the beginning of this file.
>> + """
>> +
>> + if not net_set_up:
>> + pytest.skip("Network not initialized")
>> +
>> + test_net_setup_static(u_boot_console)
>> +
>> + f = u_boot_console.config.env.get("env__net_pxe_readable_file", None)
>> + if not f:
>> + pytest.skip("No PXE readable file to read")
>> +
>> + addr = f.get("addr", None)
>> + timeout = f.get("timeout", u_boot_console.p.timeout)
>> +
>> + pxeuuid = uuid.uuid1()
>> + u_boot_console.run_command(f"setenv pxeuuid {pxeuuid}")
>> + expected_text_uuid = f"Retrieving file: pxelinux.cfg/{pxeuuid}"
>> +
>> + ethaddr = u_boot_console.run_command("echo $ethaddr")
>> + ethaddr = ethaddr.replace(':', '-')
>> + expected_text_ethaddr = f"Retrieving file: pxelinux.cfg/01-{ethaddr}"
>> +
>> + ip = u_boot_console.run_command("echo $ipaddr")
>> + ip = ip.split('.')
>> + ipaddr_file = "".join(['%02x' % int(x) for x in ip]).upper()
>> + expected_text_ipaddr = f"Retrieving file: pxelinux.cfg/{ipaddr_file}"
>> + expected_text_default = f"Retrieving file: pxelinux.cfg/default"
>> +
>> + with u_boot_console.temporary_timeout(timeout):
>> + output = u_boot_console.run_command("pxe get")
>> +
>> + assert "TIMEOUT" not in output
>> + assert expected_text_uuid in output
>> + assert expected_text_ethaddr in output
>> + assert expected_text_ipaddr in output
>> +
>> + i = 1
>> + for i in range(0, len(ipaddr_file) - 1):
>> + expected_text_ip = f"Retrieving file: pxelinux.cfg/{ipaddr_file[:-i]}"
>> + assert expected_text_ip in output
>> + i += 1
>> +
>> + assert expected_text_default in output
>> + assert "Config file 'default.boot' found" in output
>> --
>> 2.25.1
>>
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
I can't see any issue in CI loop when this is applied.
Ramon: Do you want to take it via your tree?
Or should I take it?
Thanks,
Michal
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] test/py: net: Add a test for 'pxe get' command
2023-10-03 13:12 [PATCH] test/py: net: Add a test for 'pxe get' command Love Kumar
2023-10-06 20:27 ` Ramon Fried
@ 2023-10-13 9:00 ` Michal Simek
1 sibling, 0 replies; 4+ messages in thread
From: Michal Simek @ 2023-10-13 9:00 UTC (permalink / raw)
To: Love Kumar, u-boot
Cc: git, rfried.dev, v.v.mitrofanov, seanedmond, emohandesi
On 10/3/23 15:12, Love Kumar wrote:
> Execute the 'pxe get' command to download a pxe configuration file from
> the TFTP server and validate its interpretation.
>
> Signed-off-by: Love Kumar <love.kumar@amd.com>
> ---
> test/py/tests/test_net.py | 66 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 66 insertions(+)
>
> diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
> index cd4b4dc53cbc..b2241ae6a482 100644
> --- a/test/py/tests/test_net.py
> +++ b/test/py/tests/test_net.py
> @@ -6,6 +6,7 @@
>
> import pytest
> import u_boot_utils
> +import uuid
>
> """
> Note: This test relies on boardenv_* containing configuration values to define
> @@ -61,6 +62,16 @@ env__net_nfs_readable_file = {
> 'crc32': 'c2244b26',
> }
>
> +# Details regarding a file that may be read from a TFTP server. This variable
> +# may be omitted or set to None if PXE testing is not possible or desired.
> +env__net_pxe_readable_file = {
> + 'fn': 'default',
> + 'addr': 0x2000000,
> + 'size': 74,
> + 'timeout': 50000,
> + 'pattern': 'Linux',
> +}
> +
> # True if a router advertisement service is connected to the network, and should
> # be tested. If router advertisement testing is not possible or desired, this
> variable may be omitted or set to False.
> @@ -260,3 +271,58 @@ def test_net_nfs(u_boot_console):
>
> output = u_boot_console.run_command('crc32 %x $filesize' % addr)
> assert expected_crc in output
> +
> +@pytest.mark.buildconfigspec("cmd_net")
> +@pytest.mark.buildconfigspec("cmd_pxe")
> +def test_net_pxe_get(u_boot_console):
> + """Test the pxe get command.
> +
> + A pxe configuration file is downloaded from the TFTP server and interpreted
> + to boot the images mentioned in pxe configuration file.
> +
> + The details of the file to download are provided by the boardenv_* file;
> + see the comment at the beginning of this file.
> + """
> +
> + if not net_set_up:
> + pytest.skip("Network not initialized")
> +
> + test_net_setup_static(u_boot_console)
> +
> + f = u_boot_console.config.env.get("env__net_pxe_readable_file", None)
> + if not f:
> + pytest.skip("No PXE readable file to read")
> +
> + addr = f.get("addr", None)
> + timeout = f.get("timeout", u_boot_console.p.timeout)
> +
> + pxeuuid = uuid.uuid1()
> + u_boot_console.run_command(f"setenv pxeuuid {pxeuuid}")
> + expected_text_uuid = f"Retrieving file: pxelinux.cfg/{pxeuuid}"
> +
> + ethaddr = u_boot_console.run_command("echo $ethaddr")
> + ethaddr = ethaddr.replace(':', '-')
> + expected_text_ethaddr = f"Retrieving file: pxelinux.cfg/01-{ethaddr}"
> +
> + ip = u_boot_console.run_command("echo $ipaddr")
> + ip = ip.split('.')
> + ipaddr_file = "".join(['%02x' % int(x) for x in ip]).upper()
> + expected_text_ipaddr = f"Retrieving file: pxelinux.cfg/{ipaddr_file}"
> + expected_text_default = f"Retrieving file: pxelinux.cfg/default"
> +
> + with u_boot_console.temporary_timeout(timeout):
> + output = u_boot_console.run_command("pxe get")
> +
> + assert "TIMEOUT" not in output
> + assert expected_text_uuid in output
> + assert expected_text_ethaddr in output
> + assert expected_text_ipaddr in output
> +
> + i = 1
> + for i in range(0, len(ipaddr_file) - 1):
> + expected_text_ip = f"Retrieving file: pxelinux.cfg/{ipaddr_file[:-i]}"
> + assert expected_text_ip in output
> + i += 1
> +
> + assert expected_text_default in output
> + assert "Config file 'default.boot' found" in output
Applied.
M
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-13 9:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03 13:12 [PATCH] test/py: net: Add a test for 'pxe get' command Love Kumar
2023-10-06 20:27 ` Ramon Fried
2023-10-10 12:56 ` Michal Simek
2023-10-13 9:00 ` Michal Simek
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.