]> git.sur5r.net Git - u-boot/commitdiff
test: dm: Don't bail on all tests if one test fails
authorJoe Hershberger <joe.hershberger@ni.com>
Wed, 20 May 2015 19:27:32 +0000 (14:27 -0500)
committerTom Rini <trini@konsulko.com>
Thu, 21 May 2015 13:16:17 +0000 (09:16 -0400)
There's not much point in having a failure count if we always give up on
the first failure. Also stop clearing the entire state between tests.

Make sure that any failures are still passed out to the command line.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
test/dm/test-main.c

index a2fe1765791191b9cd96281b9dc64962b06711bb..53c3a6ebbd41fc814ce09c9bb2b967ed263069bf 100644 (file)
@@ -24,8 +24,6 @@ static int dm_test_init(struct unit_test_state *uts)
 {
        struct dm_test_state *dms = uts->priv;
 
-       memset(uts, '\0', sizeof(*uts));
-       uts->priv = dms;
        memset(dms, '\0', sizeof(*dms));
        gd->dm_root = NULL;
        memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count));
@@ -106,15 +104,14 @@ static int dm_test_main(const char *test_name)
                if (test->flags & DM_TESTF_SCAN_FDT)
                        ut_assertok(dm_scan_fdt(gd->fdt_blob, false));
 
-               if (test->func(uts))
-                       break;
+               test->func(uts);
 
                ut_assertok(dm_test_destroy(uts));
        }
 
        printf("Failures: %d\n", uts->fail_count);
 
-       return 0;
+       return uts->fail_count ? CMD_RET_FAILURE : 0;
 }
 
 int do_ut_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])