]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - test/dm/eth.c
04ccf4982098d9a81b4f4bbfe073c9682ef6c9b8
[karo-tx-uboot.git] / test / dm / eth.c
1 /*
2  * Copyright (c) 2015 National Instruments
3  *
4  * (C) Copyright 2015
5  * Joe Hershberger <joe.hershberger@ni.com>
6  *
7  * SPDX-License-Identifier:     GPL-2.0
8  */
9
10 #include <common.h>
11 #include <dm.h>
12 #include <dm/test.h>
13 #include <dm/ut.h>
14 #include <fdtdec.h>
15 #include <malloc.h>
16 #include <net.h>
17
18 DECLARE_GLOBAL_DATA_PTR;
19
20 static int dm_test_eth(struct dm_test_state *dms)
21 {
22         NetPingIP = string_to_ip("1.1.2.2");
23
24         setenv("ethact", "eth@10002000");
25         ut_assertok(NetLoop(PING));
26         ut_asserteq_str("eth@10002000", getenv("ethact"));
27
28         setenv("ethact", "eth@10003000");
29         ut_assertok(NetLoop(PING));
30         ut_asserteq_str("eth@10003000", getenv("ethact"));
31
32         setenv("ethact", "eth@10004000");
33         ut_assertok(NetLoop(PING));
34         ut_asserteq_str("eth@10004000", getenv("ethact"));
35
36         return 0;
37 }
38 DM_TEST(dm_test_eth, DM_TESTF_SCAN_FDT);