mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] selftests/nolibc: improvements to the kselftest runner integration
@ 2026-01-06 11:44 Thomas Weißschuh
  2026-01-06 11:44 ` [PATCH 1/3] selftests/nolibc: try to read from stdin in readv_zero test Thomas Weißschuh
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-01-06 11:44 UTC (permalink / raw)
  To: Willy Tarreau, Shuah Khan
  Cc: linux-kselftest, linux-kernel, Thomas Weißschuh

Fix the execution of 'make run_tests' and also wire up libc-test.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (3):
      selftests/nolibc: try to read from stdin in readv_zero test
      selftests/nolibc: scope custom flags to the nolibc-test target
      selftests/nolibc: also test libc-test through regular selftest framework

 tools/testing/selftests/nolibc/Makefile      | 14 +++++++-------
 tools/testing/selftests/nolibc/nolibc-test.c |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
---
base-commit: 6b6dbf3e4ecfd7d1086bd7cd8b31ca8e45d4dc1f
change-id: 20260106-nolibc-selftests-45ca3266eec5

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] selftests/nolibc: try to read from stdin in readv_zero test
  2026-01-06 11:44 [PATCH 0/3] selftests/nolibc: improvements to the kselftest runner integration Thomas Weißschuh
@ 2026-01-06 11:44 ` Thomas Weißschuh
  2026-01-06 11:44 ` [PATCH 2/3] selftests/nolibc: scope custom flags to the nolibc-test target Thomas Weißschuh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-01-06 11:44 UTC (permalink / raw)
  To: Willy Tarreau, Shuah Khan
  Cc: linux-kselftest, linux-kernel, Thomas Weißschuh

When stdout is redirected to a file this test fails.
This happens when running through the kselftest runner since
commit d9e6269e3303 ("selftests/run_kselftest.sh: exit with
error if tests fail").

For consistency with other tests that read from a file descriptor,
switch to stdin over stdout. The tests are still brittle against
a redirected stdin, but at least they are now consistently so.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 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 3986d55a6ff6..e83c1e7e2beb 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -1404,7 +1404,7 @@ int run_syscall(int min, int max)
 		CASE_TEST(write_badf);        EXPECT_SYSER(1, write(-1, &tmp, 1), -1, EBADF); break;
 		CASE_TEST(write_zero);        EXPECT_SYSZR(1, write(1, &tmp, 0)); break;
 		CASE_TEST(readv_badf);        EXPECT_SYSER(1, readv(-1, &iov_one, 1), -1, EBADF); break;
-		CASE_TEST(readv_zero);        EXPECT_SYSZR(1, readv(1, NULL, 0)); break;
+		CASE_TEST(readv_zero);        EXPECT_SYSZR(1, readv(0, NULL, 0)); break;
 		CASE_TEST(writev_badf);       EXPECT_SYSER(1, writev(-1, &iov_one, 1), -1, EBADF); break;
 		CASE_TEST(writev_zero);       EXPECT_SYSZR(1, writev(1, NULL, 0)); break;
 		CASE_TEST(ptrace);            EXPECT_SYSER(1, ptrace(PTRACE_CONT, getpid(), NULL, NULL), -1, ESRCH); break;

-- 
2.52.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] selftests/nolibc: scope custom flags to the nolibc-test target
  2026-01-06 11:44 [PATCH 0/3] selftests/nolibc: improvements to the kselftest runner integration Thomas Weißschuh
  2026-01-06 11:44 ` [PATCH 1/3] selftests/nolibc: try to read from stdin in readv_zero test Thomas Weißschuh
@ 2026-01-06 11:44 ` Thomas Weißschuh
  2026-01-06 11:44 ` [PATCH 3/3] selftests/nolibc: also test libc-test through regular selftest framework Thomas Weißschuh
  2026-01-11 10:06 ` [PATCH 0/3] selftests/nolibc: improvements to the kselftest runner integration Willy Tarreau
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-01-06 11:44 UTC (permalink / raw)
  To: Willy Tarreau, Shuah Khan
  Cc: linux-kselftest, linux-kernel, Thomas Weißschuh

A new target for 'libc-test' is going to be added which should not be
affected by these options.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 tools/testing/selftests/nolibc/Makefile | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 40f5c2908dda..43f0b608c796 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -9,14 +9,10 @@ cc-option = $(call __cc-option, $(CC),,$(1),$(2))
 
 include Makefile.include
 
-CFLAGS = -nostdlib -nostdinc -static \
+$(OUTPUT)/nolibc-test: CFLAGS = -nostdlib -nostdinc -static \
 	 -isystem $(top_srcdir)/tools/include/nolibc -isystem $(top_srcdir)/usr/include \
 	 $(CFLAGS_NOLIBC_TEST)
-
-ifeq ($(LLVM),)
-LDLIBS := -lgcc
-endif
-
+$(OUTPUT)/nolibc-test: LDLIBS = $(if $(LLVM),,-lgcc)
 $(OUTPUT)/nolibc-test: nolibc-test.c nolibc-test-linkage.c | headers
 
 help:

-- 
2.52.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] selftests/nolibc: also test libc-test through regular selftest framework
  2026-01-06 11:44 [PATCH 0/3] selftests/nolibc: improvements to the kselftest runner integration Thomas Weißschuh
  2026-01-06 11:44 ` [PATCH 1/3] selftests/nolibc: try to read from stdin in readv_zero test Thomas Weißschuh
  2026-01-06 11:44 ` [PATCH 2/3] selftests/nolibc: scope custom flags to the nolibc-test target Thomas Weißschuh
@ 2026-01-06 11:44 ` Thomas Weißschuh
  2026-01-11 10:06 ` [PATCH 0/3] selftests/nolibc: improvements to the kselftest runner integration Willy Tarreau
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-01-06 11:44 UTC (permalink / raw)
  To: Willy Tarreau, Shuah Khan
  Cc: linux-kselftest, linux-kernel, Thomas Weißschuh

Hook up libc-test to the regular selftest build to make sure
nolibc-test.c stays compatible with a normal libc.

As the pattern rule from lib.mk does not handle compiling a target from
a differently named source file, add an explicit rule definition.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 tools/testing/selftests/nolibc/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 43f0b608c796..0370489d938b 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
-TEST_GEN_PROGS := nolibc-test
+TEST_GEN_PROGS := nolibc-test libc-test
 
 include ../lib.mk
 include $(top_srcdir)/scripts/Makefile.compiler
@@ -15,6 +15,10 @@ $(OUTPUT)/nolibc-test: CFLAGS = -nostdlib -nostdinc -static \
 $(OUTPUT)/nolibc-test: LDLIBS = $(if $(LLVM),,-lgcc)
 $(OUTPUT)/nolibc-test: nolibc-test.c nolibc-test-linkage.c | headers
 
+$(OUTPUT)/libc-test: nolibc-test.c nolibc-test-linkage.c
+	$(call msg,CC,,$@)
+	$(Q)$(LINK.c) $^ -o $@
+
 help:
 	@echo "For the custom nolibc testsuite use '$(MAKE) -f Makefile.nolibc'; available targets:"
 	@$(MAKE) -f Makefile.nolibc help

-- 
2.52.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] selftests/nolibc: improvements to the kselftest runner integration
  2026-01-06 11:44 [PATCH 0/3] selftests/nolibc: improvements to the kselftest runner integration Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2026-01-06 11:44 ` [PATCH 3/3] selftests/nolibc: also test libc-test through regular selftest framework Thomas Weißschuh
@ 2026-01-11 10:06 ` Willy Tarreau
  3 siblings, 0 replies; 5+ messages in thread
From: Willy Tarreau @ 2026-01-11 10:06 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: Shuah Khan, linux-kselftest, linux-kernel

Hi Thomas,

On Tue, Jan 06, 2026 at 12:44:56PM +0100, Thomas Weißschuh wrote:
> Fix the execution of 'make run_tests' and also wire up libc-test.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

For the whole series:
Acked-by: Willy Tarreau <w@1wt.eu>

Thanks,
Willy

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-11 10:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-06 11:44 [PATCH 0/3] selftests/nolibc: improvements to the kselftest runner integration Thomas Weißschuh
2026-01-06 11:44 ` [PATCH 1/3] selftests/nolibc: try to read from stdin in readv_zero test Thomas Weißschuh
2026-01-06 11:44 ` [PATCH 2/3] selftests/nolibc: scope custom flags to the nolibc-test target Thomas Weißschuh
2026-01-06 11:44 ` [PATCH 3/3] selftests/nolibc: also test libc-test through regular selftest framework Thomas Weißschuh
2026-01-11 10:06 ` [PATCH 0/3] selftests/nolibc: improvements to the kselftest runner integration Willy Tarreau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®