Skip to contentSkip to conversation

test: ut: run every suite in a comma separated list

PATCH In review Anders Roxell 4 participants 4 messages Sep 30 – Oct 13

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test: ut: run every suite in a comma separated list

"ut lib,mem" only runs lib. The loop sets name to NULL after strsep(), but strsep() has already moved it past the comma.

Loop on strsep() until it returns NULL.

Fixes fa0b68d22add ("test: Allow running a selection of suites")
---
 test/cmd_ut.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/cmd_ut.c +1 -1
index 4328670d0d67..bd9905caf518 100644
@@ -297,7 +297,7 @@ static int do_ut(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 		int any_fail = 0;
 		const char *p;
 
-		for (; p = strsep(&name, ","), p; name = NULL) {
+		while ((p = strsep(&name, ","))) {
 			ste = find_suite(p);
 			if (!ste) {
 				printf("Suite '%s' not found\n", p);
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Anders,

Quoted 15 lines · Anders Roxell

test: ut: run every suite in a comma separated list

"ut lib,mem" only runs lib. The loop sets name to NULL after strsep(), but strsep() has already moved it past the comma.

Loop on strsep() until it returns NULL.

Fixes fa0b68d22add ("test: Allow running a selection of suites")

test/cmd_ut.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)

test/cmd_ut.c static int do_ut(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) · line 301

Quoted 2 lines
test/cmd_ut.c +1 -1
@@ -301,7 +301,7 @@ static int do_ut(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-             for (; p = strsep(&name, ","), p; name = NULL) {
+             while ((p = strsep(&name, ","))) {

Thanks for fixing this.

BTW, test_suite.py already checks this with 'ut bloblist,setexpr,mem' and expects 'Suites run: 3', but the test is disabled because it is named xtest_suite(), which probably explains why nobody noticed. It would be nice to re-enable it, perhaps in a follow-up.

Regards,
Simon

Reviewed-by on v1 1/1
#2 lore raw
In reply to Anders Roxell
Quoted 9 lines · Anders Roxell

"ut lib,mem" only runs lib. The loop sets name to NULL after strsep(), but strsep() has already moved it past the comma.

Loop on strsep() until it returns NULL.

Fixes fa0b68d22add ("test: Allow running a selection of suites")

---

Quoted 19 lines
 test/cmd_ut.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/cmd_ut.c +1 -2
index 4328670d0d67..bd9905caf518 100644
@@ -297,7 +297,7 @@ static int do_ut(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
                int any_fail = 0;
                const char *p;
 
-               for (; p = strsep(&name, ","), p; name = NULL) {
+               while ((p = strsep(&name, ","))) {
                        ste = find_suite(p);
                        if (!ste) {
                                printf("Suite '%s' not found\n", p);
--

2.53.0

#3 lore raw
In reply to Anders Roxell
Quoted 6 lines · Anders Roxell

"ut lib,mem" only runs lib. The loop sets name to NULL after strsep(), but strsep() has already moved it past the comma.

Loop on strsep() until it returns NULL.

Applied to u-boot/main, thanks!

[1/1] test: ut: run every suite in a comma separated list

      commit: 6bbb926339da1267496089d857b74cc7e897a7b1
Signature · 1 line
Tom