[U-Boot] [PATCH v3 17/26] test: dm: Don't bail on all tests if one test fails

Joe Hershberger joe.hershberger at ni.com
Sun May 3 22:12:53 CEST 2015


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 at ni.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
---

Changes in v3: None
Changes in v2:
-New for version 2

 test/dm/test-main.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/test/dm/test-main.c b/test/dm/test-main.c
index 54aade8..3c27472 100644
--- a/test/dm/test-main.c
+++ b/test/dm/test-main.c
@@ -23,8 +23,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,13 +104,12 @@ 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;
 }
-- 
1.7.11.5



More information about the U-Boot mailing list