How to add eth1 to test device tree?
Simon Glass
sjg at chromium.org
Mon Mar 27 22:14:46 CEST 2023
Hi Ehsan,
On Tue, 28 Mar 2023 at 08:58, Ehsan Mohandesi
<emohandesi at linux.microsoft.com> 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 -k testname.py
>
> I am specifically interested in running the network tests.
>
> ./test/py/test.py -k test_net.py
>
> These Python tests use test.dts device tree which does not have eth1 in
> it. I can replace the test.dts file with sandbox.dts to enable eth1 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.dts or -D to use sandbox.dts; however, there is no such option 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 at 10002000
>
> *arch/sandbox/dts/test.dts*
>
> Net: eth0: eth at 10002000, eth5: eth at 10003000, eth3: sbe5, eth6:
> eth at 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.c for that
For 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://u-boot.readthedocs.io/en/latest/develop/tests_writing.html
[2] https://u-boot.readthedocs.io/en/latest/develop/tests_sandbox.html#running-sandbox-tests-directly
More information about the U-Boot
mailing list