summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2022-06-09 15:20:11 -0400
committerTom Rini <[email protected]>2022-06-09 15:20:11 -0400
commite5028bb227c578ca89273f0b1e0d289ec1987d2f (patch)
treea9b8552bc82bd10d9b0638113c2ed65b87a892d7 /test
parentc0e63bf46848d573b3ef86d5796f8f993c316ed6 (diff)
parent3f51ba926bc138f54dab8d0fa0c363a3b1e71794 (diff)
Merge branch '2022-06-09-add-support-for-nvmem-api' into next
To quote the author: This adds support for the nvmem-cells properties cropping up in manyb device trees. This is an easy way to load configuration, version information, or calibration data from a non-volatile memory source. For more information, refer to patch 6 ("misc: Add support for nvmem cells"). For the moment I have only added some integration tests using the ethernet addresses. This hits the main code paths (looking up nvmem cells) but doesn't test writing. I can add a few stand-alone tests if desired.
Diffstat (limited to 'test')
-rw-r--r--test/dm/eth.c29
-rw-r--r--test/dm/test-fdt.c2
2 files changed, 30 insertions, 1 deletions
diff --git a/test/dm/eth.c b/test/dm/eth.c
index e4ee6956106..5437f9ea4a0 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -147,6 +147,35 @@ static int dm_test_eth_act(struct unit_test_state *uts)
}
DM_TEST(dm_test_eth_act, UT_TESTF_SCAN_FDT);
+/* Ensure that all addresses are loaded properly */
+static int dm_test_ethaddr(struct unit_test_state *uts)
+{
+ static const char *const addr[] = {
+ "02:00:11:22:33:44",
+ "02:00:11:22:33:48", /* dsa slave */
+ "02:00:11:22:33:45",
+ "02:00:11:22:33:48", /* dsa master */
+ "02:00:11:22:33:46",
+ "02:00:11:22:33:47",
+ "02:00:11:22:33:48", /* dsa slave */
+ "02:00:11:22:33:49",
+ };
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(addr); i++) {
+ char addrname[10];
+
+ if (i)
+ snprintf(addrname, sizeof(addrname), "eth%daddr", i + 1);
+ else
+ strcpy(addrname, "ethaddr");
+ ut_asserteq_str(addr[i], env_get(addrname));
+ }
+
+ return 0;
+}
+DM_TEST(dm_test_ethaddr, UT_TESTF_SCAN_FDT);
+
/* The asserts include a return on fail; cleanup in the caller */
static int _dm_test_eth_rotate1(struct unit_test_state *uts)
{
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index e1de066226c..f9e81747595 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -184,7 +184,7 @@ static int dm_test_alias_highest_id(struct unit_test_state *uts)
int ret;
ret = dev_read_alias_highest_id("ethernet");
- ut_asserteq(5, ret);
+ ut_asserteq(8, ret);
ret = dev_read_alias_highest_id("gpio");
ut_asserteq(3, ret);