From nobody Mon Apr 6 17:29:20 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0067263C8C for ; Wed, 18 Mar 2026 17:20:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773854451; cv=none; b=eQ1RQHMK45PzqJt3mzazXP7306ufok7O0rgt3SqU+dw1ByPPIiocezQiaW0eLy3MexX+NK6aRB02e4GLRPhYWLyRuoFMjLdXrYoYbeCbYI+Mlf3selh885Y93hD0Fl5FlhL/2ZqBbWSwt2YcWcSIa97NJplREodlLHI1lh27PuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773854451; c=relaxed/simple; bh=tmOu+mJXpPN0ewH3UbTNdRVwzy0z/iIDyT5L92wpMyE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=Yn9wI3Vv4BtJb9Mu+FmnpI+QI6g5lKiLrFz018WwVXadZVoxXIHgyr8l8SruQaanfTBDZrFRg7bSM7FOGjsmG/AbTWn/vQFhKtiJrNoTtkAuVhNXbp59TIarPJglGa/VH01f2p9fkVJtKbSI8r9k1lQqnNhLaDPdxG5goEXUe44= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=g8GXI5pN; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="g8GXI5pN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773854447; bh=tmOu+mJXpPN0ewH3UbTNdRVwzy0z/iIDyT5L92wpMyE=; h=From:Date:Subject:To:Cc:From; b=g8GXI5pNpRAfxYKDXAbHaPBBBr0tSc0TJhHF7VP1d0xx7ThYzhH2PdyqOJARLvNqf QwLZRGK5Ya3uHxcxeMoKf/4XYMC3jWPiadBFM8QVYNRkbEoAKGd8RPwm0sNibJhDNw AdCUz69E3dW5bzf7RUTr3IAs+PD3JFgiIHloJo4U= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 18 Mar 2026 18:20:46 +0100 Subject: [PATCH] selftests/nolibc: fix libc-test with musl libc Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260318-nolibc-tests-musl-v1-1-884cd7f48646@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/x3MQQqAIBBA0avErBtQC5GuEi3KxhooC6ciiO6et HyL/x8QSkwCTfFAoouFt5ihywL83MeJkMdsMMpYVWmHcVt48HiQHILrKQta7WsbnAkDecjdnij w/T/b7n0/ArLlj2MAAAA= X-Change-ID: 20260318-nolibc-tests-musl-61c46f82fbec To: Willy Tarreau , Daniel Palmer , David Laight Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773854447; l=3538; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=tmOu+mJXpPN0ewH3UbTNdRVwzy0z/iIDyT5L92wpMyE=; b=3nkXy9kI3xgF0pfDAd7r5Aiy7yB/T+Gd6ovHYBHjTK+Jo/RNlyKA3H/knzK77uzY7PXdy0/6w 5+rebUtCapLB8RT/ry7y6z5LqHkrkSUWViDggoJPwGA7P8bTn4JpHOH X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Some of the nolibc testcases fail on musl. In these cases nolibc mirrors the non-standard behavior of glibc. Avoid the failures by only running these testcases on nolibc itself. Fixes: a5f00be9b3b0 ("tools/nolibc: Add a simple test for writing to a FILE= and reading it back") Fixes: d94393e48c09 ("tools/nolibc/printf: Add support for length modifiers= tzqL and formats iX") Fixes: c2d234d3dc56 ("tools/nolibc/printf: Special case 0 and add support f= or %#x") Fixes: 63befd993da4 ("tools/nolibc/printf: Add support for zero padding and= field precision") Fixes: d94393e48c09 ("tools/nolibc/printf: Add support for length modifiers= tzqL and formats iX") Signed-off-by: Thomas Wei=C3=9Fschuh --- I am thinking about folding the printf fixups directly into the original patches. Any objections? --- tools/testing/selftests/nolibc/nolibc-test.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/s= elftests/nolibc/nolibc-test.c index 180611aabbfb..b03fb9aeb54e 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -867,7 +867,7 @@ int test_file_stream(void) =20 errno =3D 0; r =3D fwrite("foo", 1, 3, f); - if (r !=3D 0 || errno !=3D EBADF) { + if (r !=3D 0 || (is_nolibc && errno !=3D EBADF)) { fclose(f); return -1; } @@ -1824,13 +1824,13 @@ static int run_printf(int min, int max) CASE_TEST(hex_alt_prec); EXPECT_VFPRINTF(1, "| 0x02|0x03| 0x123|", "|%#5= .2x|%#04x|%#6.2x|", 2, 3, 0x123); break; CASE_TEST(hex_0_alt); EXPECT_VFPRINTF(1, "|0|0000| 00|", "|%#x|%#04= x|%#5.2x|", 0, 0, 0); break; CASE_TEST(pointer); EXPECT_VFPRINTF(1, "0x1", "%p", (void *) 0x1); = break; - CASE_TEST(pointer_NULL); EXPECT_VFPRINTF(1, "|(nil)|(nil)|", "|%p|%.4p|"= , (void *)0, (void *)0); break; - CASE_TEST(string_NULL); EXPECT_VFPRINTF(1, "|(null)||(null)|", "|%s|%.5= s|%.6s|", (void *)0, (void *)0, (void *)0); break; + CASE_TEST(pointer_NULL); EXPECT_VFPRINTF(is_nolibc, "|(nil)|(nil)|", "|%= p|%.4p|", (void *)0, (void *)0); break; + CASE_TEST(string_NULL); EXPECT_VFPRINTF(is_nolibc, "|(null)||(null)|", = "|%s|%.5s|%.6s|", (void *)0, (void *)0, (void *)0); break; CASE_TEST(percent); EXPECT_VFPRINTF(1, "a%d42%69%", "a%%d%d%%%d%%",= 42, 69); break; - CASE_TEST(perc_qual); EXPECT_VFPRINTF(1, "a%d2", "a%-14l%d%d", 2); br= eak; - CASE_TEST(invalid); EXPECT_VFPRINTF(1, "a%12yx3%y42%P", "a%12yx%d%y= %d%P", 3, 42); break; + CASE_TEST(perc_qual); EXPECT_VFPRINTF(is_nolibc, "a%d2", "a%-14l%d%d"= , 2); break; + CASE_TEST(invalid); EXPECT_VFPRINTF(is_nolibc, "a%12yx3%y42%P", "a%= 12yx%d%y%d%P", 3, 42); break; CASE_TEST(intmax_max); EXPECT_VFPRINTF(1, "9223372036854775807", "%lld= ", ~0ULL >> 1); break; - CASE_TEST(intmax_min); EXPECT_VFPRINTF(1, "-9223372036854775808", "%Li= ", (~0ULL >> 1) + 1); break; + CASE_TEST(intmax_min); EXPECT_VFPRINTF(is_nolibc, "-922337203685477580= 8", "%Li", (~0ULL >> 1) + 1); break; CASE_TEST(uintmax_max); EXPECT_VFPRINTF(1, "18446744073709551615", "%ju= ", ~0ULL); break; CASE_TEST(truncation); EXPECT_VFPRINTF(1, "012345678901234567890123456= 789", "%s", "012345678901234567890123456789"); break; CASE_TEST(string_width); EXPECT_VFPRINTF(1, " 1", "%10s", "1"); = break; --- base-commit: d59131de97ee69ab4e4b8926089a6e953d699b11 change-id: 20260318-nolibc-tests-musl-61c46f82fbec Best regards, --=20 Thomas Wei=C3=9Fschuh