diff mbox

[U-Boot,v3,3/9] dm: test: Add a new test case for dm_test_eth_rotate

Message ID 1440739559-16225-3-git-send-email-bmeng.cn@gmail.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng Aug. 28, 2015, 5:25 a.m. UTC
Add one more ethernet device node in the sandbox test device tree,
with name 'sbe5'. This is to support a new test case for testing
network device rotation.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

---

Changes in v3: None
Changes in v2:
- New patch to add a new test case for dm_test_eth_rotate

 arch/sandbox/dts/test.dts | 7 +++++++
 include/configs/sandbox.h | 3 ++-
 test/dm/eth.c             | 5 +++++
 3 files changed, 14 insertions(+), 1 deletion(-)

Comments

Simon Glass Sept. 1, 2015, 12:32 a.m. UTC | #1
On 27 August 2015 at 23:25, Bin Meng <bmeng.cn@gmail.com> wrote:
> Add one more ethernet device node in the sandbox test device tree,
> with name 'sbe5'. This is to support a new test case for testing
> network device rotation.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>
> ---
>
> Changes in v3: None
> Changes in v2:
> - New patch to add a new test case for dm_test_eth_rotate
>
>  arch/sandbox/dts/test.dts | 7 +++++++
>  include/configs/sandbox.h | 3 ++-
>  test/dm/eth.c             | 5 +++++
>  3 files changed, 14 insertions(+), 1 deletion(-)

Applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index c948df8..f5217fb 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -9,6 +9,7 @@ 
 	aliases {
 		console = &uart0;
 		eth0 = "/eth@10002000";
+		eth3 = &eth_3;
 		eth5 = &eth_5;
 		i2c0 = "/i2c@0";
 		pci0 = &pci;
@@ -121,6 +122,12 @@ 
 		fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x11>;
 	};
 
+	eth_3: sbe5 {
+		compatible = "sandbox,eth";
+		reg = <0x10005000 0x1000>;
+		fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x33>;
+	};
+
 	eth@10004000 {
 		compatible = "sandbox,eth";
 		reg = <0x10004000 0x1000>;
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 6965d92..32e3a9b 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -187,7 +187,8 @@ 
 
 #define SANDBOX_ETH_SETTINGS		"ethaddr=00:00:11:22:33:44\0" \
 					"eth1addr=00:00:11:22:33:45\0" \
-					"eth5addr=00:00:11:22:33:46\0" \
+					"eth3addr=00:00:11:22:33:46\0" \
+					"eth5addr=00:00:11:22:33:47\0" \
 					"ipaddr=1.2.3.4\0"
 
 #define MEM_LAYOUT_ENV_SETTINGS \
diff --git a/test/dm/eth.c b/test/dm/eth.c
index 700abdd..fcfb3e1 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -106,6 +106,11 @@  static int _dm_test_eth_rotate2(struct unit_test_state *uts)
 	ut_assertok(net_loop(PING));
 	ut_asserteq_str("eth@10004000", getenv("ethact"));
 
+	/* Make sure we can handle device name which is not eth# */
+	setenv("ethact", "sbe5");
+	ut_assertok(net_loop(PING));
+	ut_asserteq_str("sbe5", getenv("ethact"));
+
 	return 0;
 }