[U-Boot] [RFC PATCH v3 13/14] dm: eth: Add testing for netretry env var

Joe Hershberger joe.hershberger at ni.com
Wed Feb 11 02:30:32 CET 2015


Make sure that the retry behavior occurs as expected.

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

---

Changes in v3:
-Added testing for netretry

Changes in v2: None

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

diff --git a/test/dm/eth.c b/test/dm/eth.c
index b39a94a..831a994 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -83,3 +83,28 @@ static int dm_test_eth_prime(struct dm_test_state *dms)
 }
 
 DM_TEST(dm_test_eth_prime, DM_TESTF_SCAN_FDT);
+
+static int dm_test_eth_retry(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("netretry", "no");
+	ut_asserteq(-1, NetLoop(PING));
+	ut_asserteq_str("eth at 10004000", getenv("ethact"));
+
+	/* Restore the env */
+	setenv("eth1addr", ethaddr);
+	setenv("netretry", NULL);
+
+	return 0;
+}
+
+DM_TEST(dm_test_eth_retry, DM_TESTF_SCAN_FDT);
-- 
1.7.11.5



More information about the U-Boot mailing list