How to add eth1 to test device tree?
Hi Simon,
Quoted 172 lines
-----Original Message-----
From: Simon Glass <[email protected] <mailto:[email protected]>>
Sent: Monday, March 27, 2023 3:15 PM
To: Ehsan Mohandesi <[email protected] <mailto:[email protected]>>
Cc [email protected] <mailto:[email protected]>; [email protected] <mailto:[email protected]>; [email protected] <mailto:[email protected]>;[email protected] <mailto:[email protected]>
Subject: [EXTERNAL] Re: How to add eth1 to test device tree?
Hi Ehsan,
On Tue, 28 Mar 2023 at 08:58, Ehsan Mohandesi
Quoted 72 lines · <[email protected] <mailto:[email protected]>> wrote:
Hi All,
When running the sandbox tests, I want to know how to enable eth1 in
order to be able to test network features.
The following command is used to run sandbox tests.
./test/py/test.py-ktestname.pyI am specifically interested in running the network tests.
./test/py/test.py-ktest_net.pyThese Python tests use
test.dtsdevice tree which does not have eth1in it. I can replace the
test.dtsfile withsandbox.dtsto enableeth1 and run the network tests; however, I think there should be a
better way to do it.
Can anyone help me with this issue?
When running U-Boot, the -T option could be used to tell it to use
the
test.dtsor -D to usesandbox.dts; however, there is no suchoption when running
test.py.Eth1 is needed in order to enable the network. Enabling the sandbox
network is explained after line 250 in
doc/arch/sandbox.rst.For more information, the following is the list of network
interfaces when each device tree is used.
**
*arch/sandbox/dts/sandbox.dts**
*Net:eth0:
host_lo, *eth1: host_eth0*, eth2:host_br1, eth3: eth@10002000Quoted 9 lines
*arch/sandbox/dts/test.dts*
Net:eth0: eth@10002000, eth5: eth@10003000, eth3: sbe5, eth6:
eth@10004000, eth4: dsa-test-eth, eth2: lan0, eth7: lan1
You should write tests in C where possible. See [1].
If you are just trying to try something out locally, then you can run
a sandbox test without Python. See [2]. You can use the -D flag as
usual. Of course you can't
Network tests should generate their own traffic and check it
internally, rather than relying on the real network features of the
host machine. You can see
test/dm/eth.cfor thatFor local hacking you can change
u_boot_console_sandbox.py.get_spawn()to pass -D instead of the -d xxx it currently does.
So it depends on what you are trying to do.
Regards,
Simon
[1]
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fu-
boot.readthedocs.io%2Fen%2Flatest%2Fdevelop%2Ftests_writing.html&data=
0 5%7C01%7Cemohandesi%40microsoft.com%7Ccb2205b7fa56490d6b0008db2ef
ff21e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C63815544908078
1196%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzI
iLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qi8G4i64eXd
S4VpzMz9F5LL3BcEh0C87%2BvsTBg4IRic%3D&reserved=0
[2]
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fu-
boot.readthedocs.io%2Fen%2Flatest%2Fdevelop%2Ftests_sandbox.html%23run
ning-sandbox-tests-
directly&data=05%7C01%7Cemohandesi%40microsoft.com%7Ccb2205b7fa564
90d6b0008db2efff21e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C
Quoted 7 lines
638155449080781196%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD
AiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&s
data=YiBTpwZ4sjvKAu9H%2B4%2BBGFJUjoe3zT5pERDtBA5oDms%3D&reserved
=0
Let me add a little bit of information on my change and how I want to test it.
I have implemented the IPv6 network discovery and have sent it upstream. Now I am working on writing the sandbox tests. I have implemented some tests in C and one in Python when using C was not possible.
Tests written in C are in test/dm/eth.c and they use fake networks as you have instructed.
Test written in Python is in test/py/tests/test_net.py. The Python test is similar to the DHCP and TFTP tests where they deal with real network traffic. My question is how those tests succeed. Do they use eth1? For them to succeed, they need to be connected to a DHCP server or other servers. How do the users run such tests?