[PATCH v4 next 03/23] selftests/nolibc: Return correct value when printf test fails
From: david . laight . linux
Date: Mon Mar 02 2026 - 05:19:42 EST
From: David Laight <david.laight.linux@xxxxxxxxx>
Correctly return 1 (the number of errors) when strcmp()
fails rather than the return value from strncmp() which is the
signed difference between the mismatching characters.
Signed-off-by: David Laight <david.laight.linux@xxxxxxxxx>
---
New patch for v4.
Corrects the error reporting for test failures.
But is really replaced by the next patch.
tools/testing/selftests/nolibc/nolibc-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 0e8b3b9a86ef..9787e493523c 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -1683,7 +1683,7 @@ static int expect_vfprintf(int llen, int c, const char *expected, const char *fm
}
llen += printf(" \"%s\" = \"%s\"", expected, buf);
- ret = strncmp(expected, buf, c);
+ ret = strncmp(expected, buf, c) != 0;
result(llen, ret ? FAIL : OK);
return ret;
--
2.39.5