summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorDavid Laight <david.laight.linux@gmail.com>2026-03-02 13:17:55 +0300
committerThomas Weißschuh <linux@weissschuh.net>2026-03-20 19:46:01 +0300
commitb42f02da2bf99460a7b1c5c25008f2e4a65ea4e3 (patch)
tree98482a1a7a46b8a7772c2d959c905443ea981b18 /tools/testing
parent4045e7b19bbf7338452cda11e64cfe7ae3361964 (diff)
downloadlinux-b42f02da2bf99460a7b1c5c25008f2e4a65ea4e3.tar.xz
selftests/nolibc: Return correct value when printf test fails
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@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260302101815.3043-4-david.laight.linux@gmail.com Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/nolibc/nolibc-test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 801b2ad18853..7588212df124 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -1691,7 +1691,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;