diff options
| author | Simon Glass <[email protected]> | 2022-10-20 18:22:49 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2022-10-31 11:02:44 -0400 |
| commit | c43635bdbc6cb1e4ba2d9e2f28f7f3cb3b287bf8 (patch) | |
| tree | 2b4a6c1620f2a966857661d0b1ce4179e195b27d /test/dm/ofnode.c | |
| parent | 1facaadea1871c1b6962272dd21569a4aafda18c (diff) | |
test: Update tests to use the skip feature
Some tests currently return 0 when they want to be skipped. Update them to
return -EAGAIN instead, so they are counted as skipped.
A few tests are in two parts, with the latter part being skipped in
certain situations. Split these into two and use the correct condition for
the second part.
Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'test/dm/ofnode.c')
| -rw-r--r-- | test/dm/ofnode.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 41811ec3bb5..8077affabb7 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -753,10 +753,7 @@ static int make_ofnode_fdt(struct unit_test_state *uts, void *fdt, int size, static int dm_test_ofnode_root(struct unit_test_state *uts) { - char fdt[256]; - oftree tree; ofnode node; - int ret; /* Check that aliases work on the control FDT */ node = ofnode_get_aliases_node("ethernet3"); @@ -765,14 +762,22 @@ static int dm_test_ofnode_root(struct unit_test_state *uts) ut_assert(!oftree_valid(oftree_null())); - ut_assertok(make_ofnode_fdt(uts, fdt, sizeof(fdt), 0)); - ret = get_oftree(uts, fdt, &tree); + return 0; +} +DM_TEST(dm_test_ofnode_root, UT_TESTF_SCAN_FDT); - /* skip the rest of this test if multiple FDTs are not supported */ - if (ret == -EOVERFLOW) - return 0; +static int dm_test_ofnode_root_mult(struct unit_test_state *uts) +{ + char fdt[256]; + oftree tree; + ofnode node; - ut_assertok(ret); + /* skip this test if multiple FDTs are not supported */ + if (!IS_ENABLED(CONFIG_OFNODE_MULTI_TREE)) + return -EAGAIN; + + ut_assertok(make_ofnode_fdt(uts, fdt, sizeof(fdt), 0)); + ut_assertok(get_oftree(uts, fdt, &tree)); ut_assert(oftree_valid(tree)); /* Make sure they don't work on this new tree */ @@ -791,7 +796,7 @@ static int dm_test_ofnode_root(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_ofnode_root, UT_TESTF_SCAN_FDT); +DM_TEST(dm_test_ofnode_root_mult, UT_TESTF_SCAN_FDT); static int dm_test_ofnode_livetree_writing(struct unit_test_state *uts) { |
