dm: test: Add a new test case for dm_test_eth_rotate
authorBin Meng <bmeng.cn@gmail.com>
Fri, 28 Aug 2015 05:25:53 +0000 (22:25 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 9 Sep 2015 13:48:03 +0000 (07:48 -0600)
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>
arch/sandbox/dts/test.dts
include/configs/sandbox.h
test/dm/eth.c

index c948df8c864bc3fae1fa6b30fd5f9658fb2064bf..f5217fb87778614f783483ef7b0ee774b64ca2c3 100644 (file)
@@ -9,6 +9,7 @@
        aliases {
                console = &uart0;
                eth0 = "/eth@10002000";
+               eth3 = &eth_3;
                eth5 = &eth_5;
                i2c0 = "/i2c@0";
                pci0 = &pci;
                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>;
index 6965d921d9ea3eb1792bfc5a8b928ef533af8610..32e3a9ba559476b5e1bf8f482c9ae0360aaf0182 100644 (file)
 
 #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 \
index 700abdddbdd72c953fd5e766818de202737d38db..fcfb3e1ece840a5ed896c10cbeddbce6d69139a9 100644 (file)
@@ -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;
 }