[PATCH v2 03/11] test: eth: Add test for ethernet addresses

Sean Anderson sean.anderson at seco.com
Mon Apr 18 20:27:42 CEST 2022



On 4/18/22 1:03 PM, Tom Rini wrote:
> On Mon, Apr 04, 2022 at 03:30:32PM -0400, Sean Anderson wrote:
> 
>> This adds a test to make sure that all the ethernet interfaces have
>> their addresses read properly. At the moment everything is read from the
>> environment, but the next few commits will add additional sources.
>> 
>> Signed-off-by: Sean Anderson <sean.anderson at seco.com>
>> Reviewed-by: Simon Glass <sjg at chromium.org>
>> ---
>> 
>> (no changes since v1)
>> 
>>  test/dm/eth.c | 28 ++++++++++++++++++++++++++++
>>  1 file changed, 28 insertions(+)
>> 
>> diff --git a/test/dm/eth.c b/test/dm/eth.c
>> index e4ee695610..d7b1d5a2d2 100644
>> --- a/test/dm/eth.c
>> +++ b/test/dm/eth.c
>> @@ -147,6 +147,34 @@ static int dm_test_eth_act(struct unit_test_state *uts)
>>  }
>>  DM_TEST(dm_test_eth_act, UT_TESTF_SCAN_FDT);
>>  
>> +/* Ensure that all addresses are loaded properly */
>> +static int dm_test_ethaddr(struct unit_test_state *uts)
>> +{
>> +	static const char *const addr[] = {
>> +		"02:00:11:22:33:44",
>> +		"02:00:11:22:33:48", /* dsa slave */
>> +		"02:00:11:22:33:45",
>> +		"02:00:11:22:33:48", /* dsa master */
>> +		"02:00:11:22:33:46",
>> +		"02:00:11:22:33:47",
>> +		"02:00:11:22:33:48", /* dsa slave */
>> +	};
>> +	int i;
>> +
>> +	for (i = 0; i < ARRAY_SIZE(addr); i++) {
>> +		char addrname[10];
>> +
>> +		if (i)
>> +			snprintf(addrname, sizeof(addrname), "eth%daddr", i + 1);
>> +		else
>> +			strcpy(addrname, "ethaddr");
>> +		ut_asserteq_str(addr[i], env_get(addrname));
>> +	}
>> +
>> +	return 0;
>> +}
>> +DM_TEST(dm_test_ethaddr, UT_TESTF_SCAN_FDT);
>> +
>>  /* The asserts include a return on fail; cleanup in the caller */
>>  static int _dm_test_eth_rotate1(struct unit_test_state *uts)
>>  {
> 
> This, and I guess something related to the lists of ethaddrs in
> board/sandbox/sandbox.env causes the test to fail.  Can you please look
> in to it?  Thanks.
> 

Looks like f3dd213e15 ("net: introduce helpers to get PHY ofnode from
MAC") added another fake-host-hwaddr property and messed up the ordering.
I'll send v3 if there are no other comments.

--Sean


More information about the U-Boot mailing list