[PATCH 1/4] selftests/nolibc: allow building i386 with multiarch compiler

2023-09-14 Thread Thomas Weißschuh
When building with a multiarch-capable compiler, like those provided by common distributions the -m32 argument is required to build 32bit code. Wrap it in cc-option in case the compiler is not multiarch-capable. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 1

[PATCH 0/4] tools/nolibc: cleanups for syscall fallbacks

2023-09-14 Thread Thomas Weißschuh
Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (4): selftests/nolibc: allow building i386 with multiarch compiler tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks tools/nolibc: don't define new syscall number tools/nolibc: automatically d

[PATCH 2/4] tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks

2023-09-14 Thread Thomas Weißschuh
The ENOSYS fallback code does not use its functions parameters. This can lead to compiler warnings about unused parameters. Explicitly avoid these warnings. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/sys.h | 31 +++ 1 file changed, 31 insertions

[PATCH 4/4] tools/nolibc: automatically detect necessity to use pselect6

2023-09-14 Thread Thomas Weißschuh
We can automatically detect if pselect6 is needed or not from the kernel headers. This removes the need to manually specify it. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-aarch64.h | 3 --- tools/include/nolibc/arch-loongarch.h | 4 +--- tools/include/nolibc/arch-riscv.h

[PATCH 3/4] tools/nolibc: don't define new syscall number

2023-09-14 Thread Thomas Weißschuh
All symbols created by nolibc are also visible to user code. Syscall constants are expected to come from the kernel headers and should not be made up by nolibc. Refactor the logic to avoid defining syscall numbers. Also the new code is easier to understand. Signed-off-by: Thomas Weißschuh

[PATCH RFC 2/3] selftests/nolibc: don't embed initramfs into kernel image

2023-09-16 Thread Thomas Weißschuh
linking the initramfs into the kernel assemble it manually and pass it explicitly to qemu. This avoids all of the kernel relinks. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 47 + 1 file changed, 24 insertions(+), 23 deletions

[PATCH RFC 0/3] selftests/nolibc: avoid spurious kernel relinks

2023-09-16 Thread Thomas Weißschuh
. With a bit of Makefile-shuffling the relinking can be avoided. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (3): kbuild: add toplevel target for usr/gen_init_cpio selftests/nolibc: don't embed initramfs into kernel image selftests/nolibc: drop target "rerun&q

[PATCH RFC 3/3] selftests/nolibc: drop target "rerun"

2023-09-16 Thread Thomas Weißschuh
Now that the target "run" does not relink the kernel all the time anymore it is much faster and we don't need "rerun" anymore. Signed-off-by: Thomas Weißschuh --- Willy: This is an optional commit, "rerun" is still a bit faster than "run". Also

[PATCH RFC 1/3] kbuild: add toplevel target for usr/gen_init_cpio

2023-09-16 Thread Thomas Weißschuh
The nolibc testsuite wants to generate an initrams without linking it into the kernel for which it needs access to gen_init_cpio. Add a new toplevel target for it so it can be built standalone. Signed-off-by: Thomas Weißschuh --- Kbuild maintainers: If there is a way that does not require

Re: [PATCH 2/4] tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks

2023-09-16 Thread Thomas Weißschuh
On 2023-09-17 04:58:51+0200, Willy Tarreau wrote: > On Thu, Sep 14, 2023 at 06:01:18PM +0200, Thomas Weißschuh wrote: > > The ENOSYS fallback code does not use its functions parameters. > > This can lead to compiler warnings about unused parameters. > > > > Expl

Re: [PATCH RFC 0/3] selftests/nolibc: avoid spurious kernel relinks

2023-09-17 Thread Thomas Weißschuh
On 2023-09-17 05:22:19+0200, Willy Tarreau wrote: > On Sat, Sep 16, 2023 at 09:13:26AM +0200, Thomas Weißschuh wrote: > > Currently the nolibc testsuite embeds the test executable into a kernel > > image with CONFIG_INITRAMFS_SOURCE. > > This forces a full kernel reli

Re: [PATCH 2/4] tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks

2023-09-17 Thread Thomas Weißschuh
On 2023-09-17 11:48:27+0200, Willy Tarreau wrote: > [..] > > Maybe the macro-equivalent of this? > > > > static inline int __nolibc_enosys(...) > > { > > return -ENOSYS; > > } > > > > The only-vararg function unfortunately needs C23 so we can't use it. > > > > It's clear to the users that thi

[PATCH RFC v2] selftests/nolibc: don't embed initramfs into kernel image

2023-09-17 Thread Thomas Weißschuh
linking the initramfs into the kernel assemble it manually and pass it explicitly to qemu. This avoids all of the kernel relinks. Signed-off-by: Thomas Weißschuh --- Currently the nolibc testsuite embeds the test executable into a kernel image with CONFIG_INITRAMFS_SOURCE. This forces a full kernel

[PATCH v2 0/4] tools/nolibc: cleanups for syscall fallbacks

2023-09-17 Thread Thomas Weißschuh
Signed-off-by: Thomas Weißschuh --- Changes in v2: - Replace manual casts to (void) with __nolibc_enosys helpers - Link to v1: https://lore.kernel.org/r/20230914-nolibc-syscall-nr-v1-0-e50df410d...@weissschuh.net --- Thomas Weißschuh (4): selftests/nolibc: allow building i386 with

[PATCH v2 3/4] tools/nolibc: don't define new syscall number

2023-09-17 Thread Thomas Weißschuh
: Thomas Weißschuh --- tools/include/nolibc/sys.h | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 8389820e1928..f05144e46b67 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -938,11

[PATCH v2 2/4] tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks

2023-09-17 Thread Thomas Weißschuh
The ENOSYS fallback code does not use its functions parameters. This can lead to compiler warnings about unused parameters. Explicitly avoid these warnings. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/sys.h | 44 +++- 1 file changed, 27

[PATCH v2 4/4] tools/nolibc: automatically detect necessity to use pselect6

2023-09-17 Thread Thomas Weißschuh
We can automatically detect if pselect6 is needed or not from the kernel headers. This removes the need to manually specify it. Acked-by: Willy Tarreau Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-aarch64.h | 3 --- tools/include/nolibc/arch-loongarch.h | 4 +--- tools

[PATCH v2 1/4] selftests/nolibc: allow building i386 with multiarch compiler

2023-09-17 Thread Thomas Weißschuh
When building with a multiarch-capable compiler, like those provided by common distributions the -m32 argument is required to build 32bit code. Wrap it in cc-option in case the compiler is not multiarch-capable. Acked-by: Willy Tarreau Signed-off-by: Thomas Weißschuh --- tools/testing

Re: [PATCH v2 2/4] tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks

2023-09-18 Thread Thomas Weißschuh
On 2023-09-18 18:19:15+0200, Willy Tarreau wrote: > Hi Thomas, > > On Sun, Sep 17, 2023 at 05:36:17PM +0200, Thomas Weißschuh wrote: > > The ENOSYS fallback code does not use its functions parameters. > > This can lead to compiler warnings about unused parameters. > >

[PATCH RFC] tools/nolibc: add support for constructors and destructors

2023-10-05 Thread Thomas Weißschuh
5747 nolibc-test.after 21970 104 88 221625692 nolibc-test.after-only-crt.h-changes The sections are defined by [0]. [0] https://refspecs.linuxfoundation.org/elf/gabi4+/ch5.dynamic.html Signed-off-by: Thomas Weißschuh --- Note: This is only an RFC as I'm not 100% sure it b

Re: [PATCH RFC] tools/nolibc: add support for constructors and destructors

2023-10-07 Thread Thomas Weißschuh
Hi Willy, On 2023-10-07 08:50:25+0200, Willy Tarreau wrote: > On Thu, Oct 05, 2023 at 06:45:07PM +0200, Thomas Weißschuh wrote: > > With the startup code moved to C, implementing support for > > constructors and deconstructors is fairly easy to implement. > [..] > > di

Re: [PATCH RFC] tools/nolibc: add support for constructors and destructors

2023-10-07 Thread Thomas Weißschuh
On 2023-10-07 10:30:35+0200, Willy Tarreau wrote: > On Sat, Oct 07, 2023 at 09:28:45AM +0200, Thomas Weißschuh wrote: > > > In the past I learned the hard way that you can never trust the execution > > > order of constructors, so if you're unlucky above you could very we

[PATCH v2] tools/nolibc: add support for constructors and destructors

2023-10-07 Thread Thomas Weißschuh
5747 nolibc-test.after 21970 104 88 221625692 nolibc-test.after-only-crt.h-changes The sections are defined by [0]. [0] https://refspecs.linuxfoundation.org/elf/gabi4+/ch5.dynamic.html Signed-off-by: Thomas Weißschuh --- Changes in v2: - Drop RFC status. - Add comment to

[PATCH] tools/nolibc: drop test for getauxval(AT_PAGESZ)

2023-10-07 Thread Thomas Weißschuh
("selftests/nolibc: add testcases for startup code") Cc: sta...@vger.kernel.org Signed-off-by: Thomas Weißschuh --- Note: This should probably also make it into 6.6. --- tools/testing/selftests/nolibc/nolibc-test.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selfte

Re: [PATCH] tools/nolibc: drop test for getauxval(AT_PAGESZ)

2023-10-07 Thread Thomas Weißschuh
On 2023-10-07 12:36:20+0200, Willy Tarreau wrote: > On Sat, Oct 07, 2023 at 12:18:55PM +0200, Thomas Weißschuh wrote: > > The test will not work for systems with pagesize != 4096 like aarch64 > > and some others. > > > > Other testcases are already tes

Re: [PATCH] Re: tools/nolibc: drop test for getauxval(AT_PAGESZ)

2023-10-07 Thread Thomas Weißschuh
s getauxval() in general. > > * test_getpagesize() tests pagesize() which directly calls > > getauxval(AT_PAGESZ). > > > > Fixes: 48967b73f8fe ("selftests/nolibc: add testcases for startup code") > > Cc: sta...@vger.kernel.org > > Signed-off-by: Thomas Weißschuh > [..]

[PATCH] selftests/nolibc: use qemu-system-ppc64 for ppc64le

2023-10-08 Thread Thomas Weißschuh
qemu-system-ppc64 can handle both big and little endian kernels. While some setups, like Debian, provide a symlink to execute qemu-system-ppc64 as qemu-system-ppc64le, others, like ArchLinux, do not. So always use qemu-system-ppc64 directly. Signed-off-by: Thomas Weißschuh --- tools/testing

[PATCH 2/5] selftests/nolibc: use EFI -bios for LoongArch qemu

2023-10-10 Thread Thomas Weißschuh
about 'file not found' is better than a hanging test without output that can never succeed. Link: https://lore.kernel.org/loongarch/1738d60a-df3a-4102-b1da-d16a29b6e...@t-8ch.de/ Signed-off-by: Thomas Weißschuh --- Note: I'm wondering how this worked for anybody else. --- too

[PATCH 3/5] selftests/nolibc: anchor paths in $(srcdir) if possible

2023-10-10 Thread Thomas Weißschuh
It is easier to recognize paths from their well-known location in the source tree than having to resolve the relative path in ones head. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools

[PATCH 4/5] selftests/nolibc: support out-of-tree builds

2023-10-10 Thread Thomas Weißschuh
74.git.fal...@tinylab.org/ Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 598d53c5cb7b..21

[PATCH 0/5] selftests/nolibc: various build improvements

2023-10-10 Thread Thomas Weißschuh
uot;selftests/nolibc: use qemu-system-ppc64 also for ppc64le" was already submitted standalone but I included it here again for easier testing and review. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (5): selftests/nolibc: use qemu-system-ppc64 also for ppc64le se

[PATCH 1/5] selftests/nolibc: use qemu-system-ppc64 also for ppc64le

2023-10-10 Thread Thomas Weißschuh
qemu-system-ppc64 can handle both big and little endian kernels. While some setups, like Debian, provide a symlink to execute qemu-system-ppc64 as qemu-system-ppc64le, others, like ArchLinux, do not. So always use qemu-system-ppc64 directly. Signed-off-by: Thomas Weißschuh --- tools/testing

[PATCH 5/5] selftests/nolibc: generate config automatically

2023-10-10 Thread Thomas Weißschuh
This new target generates a .config if none exists yet. Also drop the defconfig target with its hidden call to 'mrproper' which is fairly invasive. If users want to overwrite their kernel existing kernel configuration they can do so easily from the toplevel directory. Signed-off-

Re: [PATCH 2/5] selftests/nolibc: use EFI -bios for LoongArch qemu

2023-10-24 Thread Thomas Weißschuh
Oct 22, 2023 11:21:16 Willy Tarreau : > On Tue, Oct 10, 2023 at 02:33:57PM +0200, Thomas Weißschuh wrote: >> qemu for LoongArch does not work properly with direct kernel boot. >> The kernel will panic during initialization and hang without any output. >> >> When boo

Re: [PATCH 4/5] selftests/nolibc: support out-of-tree builds

2023-10-24 Thread Thomas Weißschuh
Oct 22, 2023 11:31:32 Willy Tarreau : > On Tue, Oct 10, 2023 at 02:33:59PM +0200, Thomas Weißschuh wrote: >> Out of tree builds are much more convenient when building for multiple >> architectures or configurations in parallel. >> >> Only absolute O= parameters are su

Re: [PATCH 5/5] selftests/nolibc: generate config automatically

2023-10-24 Thread Thomas Weißschuh
Oct 22, 2023 11:37:05 Willy Tarreau : > On Tue, Oct 10, 2023 at 02:34:00PM +0200, Thomas Weißschuh wrote: >> This new target generates a .config if none exists yet. >> >> Also drop the defconfig target with its hidden call to 'mrproper' which >> is fairly in

[PATCH 2/3] selftests/nolibc: anchor paths in $(srcdir) if possible

2023-10-31 Thread Thomas Weißschuh
It is easier to recognize paths from their well-known location in the source tree than having to resolve the relative path in ones head. Acked-by: Willy Tarreau Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH 3/3] selftests/nolibc: support out-of-tree builds

2023-10-31 Thread Thomas Weißschuh
74.git.fal...@tinylab.org/ Co-developed-by: Zhangjin Wu Signed-off-by: Zhangjin Wu Acked-by: Willy Tarreau Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/testing/selfte

[PATCH 1/3] selftests/nolibc: use EFI -bios for LoongArch qemu

2023-10-31 Thread Thomas Weißschuh
about 'file not found' is better than a hanging test without output that can never succeed. Link: https://lore.kernel.org/loongarch/1738d60a-df3a-4102-b1da-d16a29b6e...@t-8ch.de/ Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 9 - 1 file change

[PATCH 0/3] selftests/nolibc: various build improvements

2023-10-31 Thread Thomas Weißschuh
ges in v2: - Drop already applied qemu-system-ppc64le patch - Drop config generation patch - Add Co-developed-by for out-of-tree patch - Link to v1: https://lore.kernel.org/lkml/20231010-nolibc-out-of-tree-v1-0-b6a263859...@weissschuh.net/ --- Thomas Weißschuh (3): selftests/nolibc: use EFI -b

Re: [PATCH 0/3] selftests/nolibc: various build improvements

2023-11-02 Thread Thomas Weißschuh
On 2023-11-02 09:50:38+0100, Willy Tarreau wrote: > On Tue, Oct 31, 2023 at 09:36:57PM +0100, Thomas Weißschuh wrote: > > With the out-of-tree builds it's possible do incremental tests fairly fast: > > > > time ./run-tests.sh > > i386: 162 test(s): 162

[PATCH] selftests/nolibc: add script to run testsuite

2023-11-05 Thread Thomas Weißschuh
0 skipped, 0 failed => status: success riscv: 162 test(s): 162 passed, 0 skipped, 0 failed => status: success s390: 162 test(s): 161 passed, 1 skipped, 0 failed => status: warning loongarch: 162 test(s): 161 passed, 1 skipped, 0 failed => status: warning

[PATCH 0/6] tools/nolibc: MIPS bugfixes and refactoring

2023-11-05 Thread Thomas Weißschuh
Two bugfixes and some minor refactorings of the MIPS support. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (6): tools/nolibc: error out on unsupported architecture tools/nolibc: move MIPS ABI validation into arch-mips.h selftests/nolibc: use XARCH for MIPS

[PATCH 4/6] selftests/nolibc: explicitly specify ABI for MIPS

2023-11-05 Thread Thomas Weißschuh
More ABIs exist, for better clarity specify it explicitly everywhere. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc

[PATCH 2/6] tools/nolibc: move MIPS ABI validation into arch-mips.h

2023-11-05 Thread Thomas Weißschuh
When installing nolibc to a sysroot arch.h is not used so its ABI check is bypassed. This makes is possible to compile nolibc with a non O32 ABI which may build but can not run. Move the check into arch-mips.h so it will always be evaluated. Signed-off-by: Thomas Weißschuh --- tools/include

[PATCH 1/6] tools/nolibc: error out on unsupported architecture

2023-11-05 Thread Thomas Weißschuh
When an architecture is unsupported arch.h would silently continue. This leads to a lot of followup errors because my_syscallX() is not defined and the startup code is missing. Avoid these confusing errors and fail the build early with a clear error message and location. Signed-off-by: Thomas

[PATCH 3/6] selftests/nolibc: use XARCH for MIPS

2023-11-05 Thread Thomas Weißschuh
MIPS has many different configurations prepare the support of additional ones by moving the build of MIPS to the generic XARCH infrastructure. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 12 +++- tools/testing/selftests/nolibc/run-tests.sh | 2

[PATCH 5/6] selftests/nolibc: extraconfig support

2023-11-05 Thread Thomas Weißschuh
Allow some postprocessing of defconfig files. Suggested-by: Zhangjin Wu Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 6 ++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index

[PATCH 6/6] selftests/nolibc: add configuration for mipso32be

2023-11-05 Thread Thomas Weißschuh
Allow testing MIPS O32 big endian. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 7 +++ tools/testing/selftests/nolibc/run-tests.sh | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools

Re: [PATCH 3/6] selftests/nolibc: use XARCH for MIPS

2023-11-05 Thread Thomas Weißschuh
On 2023-11-05 11:32:27+0100, Willy Tarreau wrote: > On Sun, Nov 05, 2023 at 11:09:57AM +0100, Thomas Weißschuh wrote: > > MIPS has many different configurations prepare the support of additional > > ones by moving the build of MIPS to the generic XARCH infrastructure. > &g

[PATCH v2 4/6] selftests/nolibc: explicitly specify ABI for MIPS

2023-11-05 Thread Thomas Weißschuh
More ABIs exist, for better clarity specify it explicitly everywhere. Signed-off-by: Thomas Weißschuh Acked-by: Willy Tarreau --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing

[PATCH v2 5/6] selftests/nolibc: extraconfig support

2023-11-05 Thread Thomas Weißschuh
Allow some postprocessing of defconfig files. Suggested-by: Zhangjin Wu Signed-off-by: Thomas Weißschuh Acked-by: Willy Tarreau --- tools/testing/selftests/nolibc/Makefile | 6 ++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing

[PATCH v2 2/6] tools/nolibc: move MIPS ABI validation into arch-mips.h

2023-11-05 Thread Thomas Weißschuh
When installing nolibc to a sysroot arch.h is not used so its ABI check is bypassed. This makes is possible to compile nolibc with a non O32 ABI which may build but can not run. Move the check into arch-mips.h so it will always be evaluated. Signed-off-by: Thomas Weißschuh Acked-by: Willy

[PATCH v2 1/6] tools/nolibc: error out on unsupported architecture

2023-11-05 Thread Thomas Weißschuh
When an architecture is unsupported arch.h would silently continue. This leads to a lot of followup errors because my_syscallX() is not defined and the startup code is missing. Avoid these confusing errors and fail the build early with a clear error message and location. Signed-off-by: Thomas

[PATCH v2 0/6] tools/nolibc: MIPS bugfixes and refactoring

2023-11-05 Thread Thomas Weißschuh
Two bugfixes and some minor refactorings of the MIPS support. Signed-off-by: Thomas Weißschuh --- Changes in v2: - Use olddefconfig instead of oldconfig - mipso32{le,be} -> mips32{le,be} - Link to v1: https://lore.kernel.org/r/20231105-nolibc-mips-be-v1-0-6c2ad3e50...@weissschuh.net --- Tho

[PATCH v2 6/6] selftests/nolibc: add configuration for mipso32be

2023-11-05 Thread Thomas Weißschuh
Allow testing MIPS O32 big endian. Signed-off-by: Thomas Weißschuh Acked-by: Willy Tarreau --- tools/testing/selftests/nolibc/Makefile | 7 +++ tools/testing/selftests/nolibc/run-tests.sh | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests

[PATCH v2 3/6] selftests/nolibc: use XARCH for MIPS

2023-11-05 Thread Thomas Weißschuh
MIPS has many different configurations prepare the support of additional ones by moving the build of MIPS to the generic XARCH infrastructure. Signed-off-by: Thomas Weißschuh Acked-by: Willy Tarreau --- tools/testing/selftests/nolibc/Makefile | 12 +++- tools/testing/selftests

[PATCH] selftests/nolibc: fix testcase status alignment

2023-11-05 Thread Thomas Weißschuh
[OK] Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 2f10541e6f38..e17

Re: [PATCH] selftests/nolibc: fix testcase status alignment

2023-11-05 Thread Thomas Weißschuh
On 2023-11-05 15:27:00+0100, Willy Tarreau wrote: > On Sun, Nov 05, 2023 at 03:22:30PM +0100, Thomas Weißschuh wrote: > > Center-align all possible status reports. > > Before OK and FAIL were center-aligned in relation to each other but > > SKIPPED and FAILED would be left-ali

[PATCH] tools/nolibc: mips: add support for PIC

2023-11-08 Thread Thomas Weißschuh
ation. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-mips.h| 7 ++- tools/testing/selftests/nolibc/Makefile | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/arch-mips.h b/tools/include/nolibc/arch-mips.h index 3a2c76716b83..e9a0184

[PATCH v2] tools/nolibc: mips: add support for PIC

2023-11-08 Thread Thomas Weißschuh
ation. Signed-off-by: Thomas Weißschuh --- Changes in v2: - Preserver 8-byte alignment of stack pointer - Link to v1: https://lore.kernel.org/r/20231108-nolibc-pic-v1-1-9b7a429d5...@weissschuh.net --- tools/include/nolibc/arch-mips.h| 7 ++- tools/testing/selftests/nolibc/Makefile | 2

Re: [PATCH 0/2] selftests/nolibc: run-user improvements

2023-11-09 Thread Thomas Weißschuh
Nov 9, 2023 17:28:45 Konstantin Ryabitsev : > On Wed, Sep 15, 2077 at 02:13:51AM +0200, Thomas Weißschuh wrote: >     > > I'm curious how this happened, especially since this was sent with b4. My system time was messed up. I blame systemd-timesyncd.

[PATCH RFC 2/3] selftests/nolibc: migrate startup tests to new harness

2023-11-15 Thread Thomas Weißschuh
Migrate part of nolibc-test.c to the new test harness. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 106 ++- 1 file changed, 56 insertions(+), 50 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools

[PATCH RFC 0/3] selftests/nolibc: introduce new test harness

2023-11-15 Thread Thomas Weißschuh
the test "mmap_munmap_good" fails. This is a bug in qemu-user and already fixed there on master. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (3): selftests/nolibc: add custom test harness selftests/nolibc: migrate startup tests to new harness selftests/nolib

[PATCH RFC 3/3] selftests/nolibc: migrate vfprintf tests to new harness

2023-11-15 Thread Thomas Weißschuh
Migrate part of nolibc-test.c to the new test harness. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 74 +++- 1 file changed, 28 insertions(+), 46 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools

[PATCH RFC 1/3] selftests/nolibc: add custom test harness

2023-11-15 Thread Thomas Weißschuh
in its support for test suites, the same as google test. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-harness.h | 269 1 file changed, 269 insertions(+) diff --git a/tools/testing/selftests/nolibc/nolibc-harness.h b/tools/testing

Re: [PATCH RFC 1/3] selftests/nolibc: add custom test harness

2023-11-16 Thread Thomas Weißschuh
On 2023-11-16 08:16:22+0100, Willy Tarreau wrote: > Hi Thomas, > > On Wed, Nov 15, 2023 at 10:08:19PM +0100, Thomas Weißschuh wrote: > > The harness provides a framework to write unit tests for nolibc itself > > and kernel selftests using nolibc. > > > > Ad

Re: [PATCH RFC 2/3] selftests/nolibc: migrate startup tests to new harness

2023-11-16 Thread Thomas Weißschuh
On 2023-11-16 08:33:27+0100, Willy Tarreau wrote: > On Wed, Nov 15, 2023 at 10:08:20PM +0100, Thomas Weißschuh wrote: > > Migrate part of nolibc-test.c to the new test harness. > > > > Signed-off-by: Thomas Weißschuh > > A few points, mostly questions and food for th

Re: [PATCH RFC 3/3] selftests/nolibc: migrate vfprintf tests to new harness

2023-11-16 Thread Thomas Weißschuh
On 2023-11-16 08:48:02+0100, Willy Tarreau wrote: > On Wed, Nov 15, 2023 at 10:08:21PM +0100, Thomas Weißschuh wrote: > > Migrate part of nolibc-test.c to the new test harness. > > > > Signed-off-by: Thomas Weißschuh > > --- > > tools/testing/se

[PATCH 3/3] selftests/nolibc: disable coredump via setrlimit

2023-11-22 Thread Thomas Weißschuh
. Link: https://lore.kernel.org/qemu-devel/20231115-qemu-user-dumpable-v1-2-edbe7f0fb...@t-8ch.de/ Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing

[PATCH 2/3] tools/nolibc: add support for getrlimit/setrlimit

2023-11-22 Thread Thomas Weißschuh
The implementation uses the prlimit64 systemcall as that is available on all architectures. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/sys.h | 38 tools/testing/selftests/nolibc/nolibc-test.c | 29 + 2 files

[PATCH 1/3] tools/nolibc: drop custom definition of struct rusage

2023-11-22 Thread Thomas Weißschuh
A future commit will include linux/resource.h, which will conflict with the private definition of struct rusage in nolibc. Avoid the conflict by dropping the private definition and use the one from the UAPI headers. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/types.h | 21

[PATCH 0/3] tools/nolibc: rlimit support

2023-11-22 Thread Thomas Weißschuh
The series adds support for setrlimit/getrlimit. Mainly to avoid spurious coredumps when running the tests under qemu-user. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (3): tools/nolibc: drop custom definition of struct rusage tools/nolibc: add support for getrlimit

Re: [PATCH 2/3] tools/nolibc: add support for getrlimit/setrlimit

2023-11-26 Thread Thomas Weißschuh
On 2023-11-26 10:28:28+0100, Willy Tarreau wrote: > Hi Thomas, > > > +int test_rlimit(void) > > +{ > > + struct rlimit rlim = { > > + .rlim_cur = 1 << 20, > > + .rlim_max = 1 << 20, > > + }; > > + int ret; > > + > > + ret = setrlimit(RLIMIT_CORE, &rlim); > > + if (ret

Re: [PATCH] selftests/nolibc: libc-test: avoid -Wstringop-overflow warnings

2023-09-11 Thread Thomas Weißschuh
On 2023-09-11 16:30:25+0200, Willy Tarreau wrote: > On Mon, Sep 11, 2023 at 04:26:41PM +0200, Thomas Weißschuh wrote: > > On 2023-09-11 08:04:49+0200, Willy Tarreau wrote: > > > On Sun, Sep 10, 2023 at 09:29:01PM +0200, Thomas Weißschuh wrote: > > > > Newer versi

Re: [PATCH] selftests/nolibc: libc-test: avoid -Wstringop-overflow warnings

2023-09-11 Thread Thomas Weißschuh
Hi Willy! On 2023-09-11 08:04:49+0200, Willy Tarreau wrote: > On Sun, Sep 10, 2023 at 09:29:01PM +0200, Thomas Weißschuh wrote: > > Newer versions of glibc annotate the poll() function with > > __attribute__(access) which triggers a compiler warning inside the > > testcase

[PATCH 02/12] tools/nolibc: limit powerpc stack-protector workaround to GCC

2024-07-28 Thread Thomas Weißschuh
As mentioned in the comment, the workaround for __attribute__((no_stack_protector)) is only necessary on GCC. Avoid applying the workaround on clang, as clang does not recognize __attribute__((__optimize__)) and would fail. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-powerpc.h

[PATCH 03/12] tools/nolibc: move entrypoint specifics to compiler.h

2024-07-28 Thread Thomas Weißschuh
, so move that one, too. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-aarch64.h | 4 ++-- tools/include/nolibc/arch-arm.h | 4 ++-- tools/include/nolibc/arch-i386.h | 4 ++-- tools/include/nolibc/arch-loongarch.h | 4 ++-- tools/include/nolibc/arch-mips.h | 4

[PATCH 04/12] tools/nolibc: use attribute((naked)) if available

2024-07-28 Thread Thomas Weißschuh
C for all targets, so only use it where available. This also provides compatibility with clang, which recognizes the "naked" attribute but not the previously used attribute "optimized". Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/compiler.h | 9 + 1

[PATCH 00/12] tools/nolibc: improve LLVM/clang support

2024-07-28 Thread Thomas Weißschuh
s.sh This series extends this support. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (12): tools/nolibc: use clang-compatible asm syntax in arch-arm.h tools/nolibc: limit powerpc stack-protector workaround to GCC tools/nolibc: move entrypoint specifics to compiler.h to

[PATCH 01/12] tools/nolibc: use clang-compatible asm syntax in arch-arm.h

2024-07-28 Thread Thomas Weißschuh
The clang assembler rejects the current syntax. Switch to a syntax accepted by both GCC and clang. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/arch-arm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/arch-arm.h b/tools/include/nolibc

[PATCH 08/12] selftests/nolibc: setup objtree without Makefile.include

2024-07-28 Thread Thomas Weißschuh
Makefile. As we want to use its llvm handling in the future, reimplement its objtree := $(O). While at it, also move "$(objtree) ?= $(srctree)" for consistency. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 de

[PATCH 06/12] selftests/nolibc: avoid passing NULL to printf("%s")

2024-07-28 Thread Thomas Weißschuh
Clang on higher optimization levels detects that NULL is passed to printf("%s") and warns about it. Avoid the warning. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing

[PATCH 11/12] selftests/nolibc: run-tests.sh: avoid overwriting CFLAGS_EXTRA

2024-07-28 Thread Thomas Weißschuh
If the user specified their own CFLAGS_EXTRA these should not be overwritten by `-e`. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/run-tests.sh | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/run-tests.sh b/tools

[PATCH 05/12] selftests/nolibc: report failure if no testcase passed

2024-07-28 Thread Thomas Weißschuh
When nolibc-test is so broken, it doesn't even start, don't report success. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selfte

[PATCH 10/12] selftests/nolibc: add cc-option compatible with clang cross builds

2024-07-28 Thread Thomas Weißschuh
The cc-option macro from Build.include is not compatible with clang cross builds, as it does not respect the "--target" and similar flags, set up by Mekfile.include. Provide a custom variant which works correctly. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Ma

[PATCH 12/12] selftests/nolibc: run-tests.sh: allow building through LLVM

2024-07-28 Thread Thomas Weißschuh
The nolibc tests can now be properly built with LLVM. Expose this through run-tests.sh. Not all architectures are compatible, add a list for those. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/run-tests.sh | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions

[PATCH 09/12] selftests/nolibc: add support for LLVM= parameter

2024-07-28 Thread Thomas Weißschuh
Makefile.include can modify CC and CFLAGS for usage with clang. Make use of it. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile

[PATCH 07/12] selftests/nolibc: determine $(srctree) first

2024-07-28 Thread Thomas Weißschuh
Avoid needing relative includes. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 46dfbb50fae5

[PATCH] tools/nolibc: pass argc, argv and envp to constructors

2024-07-28 Thread Thomas Weißschuh
Mirror glibc behavior for compatibility. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/crt.h | 23 --- tools/testing/selftests/nolibc/nolibc-test.c | 5 +++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tools/include/nolibc

[PATCH 0/2] tools/nolibc: add support for [v]sscanf()

2024-07-31 Thread Thomas Weißschuh
The implementation is limited and only supports numeric arguments. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (2): tools/nolibc: add support for [v]sscanf() Revert "selftests: kselftest: Fix build failure with NOLIBC" tools/include/nolibc/stdio.h

[PATCH 2/2] Revert "selftests: kselftest: Fix build failure with NOLIBC"

2024-07-31 Thread Thomas Weißschuh
This reverts commit 16767502aa990cca2cb7d1372b31d328c4c85b40. Nolibc gained support for uname(2) and sscanf(3) which are the dependencies of ksft_min_kernel_version(). So re-enable support for ksft_min_kernel_version() under nolibc. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests

[PATCH 1/2] tools/nolibc: add support for [v]sscanf()

2024-07-31 Thread Thomas Weißschuh
The implementation is limited and only supports numeric arguments. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdio.h | 93 tools/testing/selftests/nolibc/nolibc-test.c | 59 ++ 2 files changed, 152 insertions(+) diff

Re: [PATCH 1/2] tools/nolibc: add support for [v]sscanf()

2024-08-02 Thread Thomas Weißschuh
On 2024-07-31 17:01:09+, Shuah Khan wrote: > On 7/31/24 12:32, Thomas Weißschuh wrote: > > The implementation is limited and only supports numeric arguments. > > I would like to see more information in here. Why is this needed > etc. etc. Ack. > > > > S

[PATCH] tools/nolibc: add support for uname(2)

2024-04-14 Thread Thomas Weißschuh
All supported kernels are assumed to use struct new_utsname. This is validated in test_uname(). uname(2) can for example be used in ksft_min_kernel_version() from the kernels selftest framework. Link: https://lore.kernel.org/lkml/20240412123536.ga32...@redhat.com/ Signed-off-by: Thomas Weißschuh

Re: [PATCH] tools/nolibc: add support for uname(2)

2024-04-14 Thread Thomas Weißschuh
Hi Willy! On 2024-04-14 12:56:46+0200, Willy Tarreau wrote: > On Sun, Apr 14, 2024 at 09:56:23AM +0200, Thomas Weißschuh wrote: > > All supported kernels are assumed to use struct new_utsname. > > This is validated in test_uname(). > > > > uname(2)

[PATCH] selftests/nolibc: run-tests.sh: use -Werror by default

2024-04-23 Thread Thomas Weißschuh
run-tests.sh hides the output from the compiler unless the compilation fails. To recognize newly introduced warnings use -Werror by default. Also add a switch to disable -Werror in case the warnings are expected. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile

[PATCH] selftests/nolibc: disable brk()/sbrk() tests on musl

2024-04-23 Thread Thomas Weißschuh
On musl calls to brk() and sbrk() always fail with ENOMEM. Detect this and skip the tests on musl. Tested on glibc 2.39 and musl 1.2.5 in addition to nolibc. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 10 +++--- 1 file changed, 7 insertions(+), 3

[PATCH 0/2] tools/nolibc: implement strtol() and friends

2024-04-25 Thread Thomas Weißschuh
I wanted to implement sscanf() for ksft_min_kernel_version() and this is a prerequisite for it. It's also useful on its own so it gets its own submission. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (2): tools/nolibc: add limits for {u,}intmax_t, ulong and {u,}llong

[PATCH 2/2] tools/nolibc: implement strtol() and friends

2024-04-25 Thread Thomas Weißschuh
The implementation always works on uintmax_t values. This is inefficient when only 32bit are needed. However for all functions this only happens for strtol() on 32bit platforms. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdlib.h| 109

  1   2   >