[U-Boot] [RFC PATCH v4 18/23] test: dm: eth: Add testing for ethrotate env var

Joe Hershberger joe.hershberger at ni.com
Wed Feb 25 01:02:27 CET 2015


Make sure that the ethrotate behavior occurs as expected.

Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>

---

Changes in v4:
-Added testing for ethrotate

Changes in v3: None
Changes in v2: None

 test/dm/eth.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/test/dm/eth.c b/test/dm/eth.c
index 96e3c46..a3cbd3f 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -80,3 +80,27 @@ static int dm_test_eth_prime(struct dm_test_state *dms)
 	return 0;
 }
 DM_TEST(dm_test_eth_prime, DM_TESTF_SCAN_FDT);
+
+static int dm_test_eth_rotate(struct dm_test_state *dms)
+{
+	char ethaddr[18];
+
+	NetPingIP = string_to_ip("1.1.2.2");
+	strcpy(ethaddr, getenv("eth1addr"));
+	setenv("ethact", "eth at 10004000");
+	setenv("eth1addr", NULL);
+	ut_assertok(NetLoop(PING));
+	ut_asserteq_str("eth at 10002000", getenv("ethact"));
+
+	setenv("ethact", "eth at 10004000");
+	setenv("ethrotate", "no");
+	ut_asserteq(-1, NetLoop(PING));
+	ut_asserteq_str("eth at 10004000", getenv("ethact"));
+
+	/* Restore the env */
+	setenv("eth1addr", ethaddr);
+	setenv("ethrotate", NULL);
+
+	return 0;
+}
+DM_TEST(dm_test_eth_rotate, DM_TESTF_SCAN_FDT);
-- 
1.7.11.5



More information about the U-Boot mailing list