Re: [PATCH 3/3] selftests: kselftest: also use strerror() on nolibc

2024-05-27 Thread Thomas Weißschuh
Hi Shuah, Could you Ack the patch below to kselftest.h? Thanks, Thomas On 2024-04-26 13:08:58+, Thomas Weißschuh wrote: > nolibc gained an implementation of strerror() recently. > Use it and drop the ifdeffery. > > Signed-off-by: Thomas Weißschuh > --- > tools

Re: [PATCH v4 37/66] selftests/nolibc: Drop define _GNU_SOURCE

2024-05-10 Thread Thomas Weißschuh
Hi Edward, On 2024-05-10 00:06:54+, Edward Liaw wrote: > _GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent > redefinition warnings. The nolibc tests do not use lib.mk. This change breaks "make libc-test", please drop it. > Signed-off-by: Edward Liaw > --- >

Re: [PATCH 0/3] tools/nolibc: implement strerror()

2024-05-02 Thread Thomas Weißschuh
Hi Shuah, On 2024-04-26 13:08:55+, Thomas Weißschuh wrote: > Adds a simple implementation of strerror() and makes use of it in > kselftests. > > Shuah, could you Ack patch 3? Friendly ping for an Ack of patch 3 of this series. After that I'd like to submit an updated nolibc

[PATCH 2/3] tools/nolibc: implement strerror()

2024-04-26 Thread Thomas Weißschuh
strerror() is commonly used. For example in kselftest which currently needs to do an #ifdef NOLIBC to handle the lack of strerror(). Keep it simple and reuse the output format of perror() for strerror(). Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdio.h | 10

[PATCH 0/3] tools/nolibc: implement strerror()

2024-04-26 Thread Thomas Weißschuh
Adds a simple implementation of strerror() and makes use of it in kselftests. Shuah, could you Ack patch 3? Willy, this should work *without* your Ack. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (3): selftests/nolibc: introduce condition to run tests only on nolibc tools

[PATCH 1/3] selftests/nolibc: introduce condition to run tests only on nolibc

2024-04-26 Thread Thomas Weißschuh
Some tests only make sense on nolibc. To avoid gaps in the test numbers do to inline "#ifdef NOLIBC", add a condition to formally skip these tests. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 32 +--- 1 file changed, 19

[PATCH 3/3] selftests: kselftest: also use strerror() on nolibc

2024-04-26 Thread Thomas Weißschuh
nolibc gained an implementation of strerror() recently. Use it and drop the ifdeffery. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/kselftest.h | 8 1 file changed, 8 deletions(-) diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h

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

2024-04-25 Thread Thomas Weißschuh
On 2024-04-25 18:30:39+, Willy Tarreau wrote: > Hi again Thomas, > > On Thu, Apr 25, 2024 at 06:09:25PM +0200, Thomas Weißschuh wrote: > > I wanted to implement sscanf() for ksft_min_kernel_version() and this is > > a prerequisite for it. > > > > It's also

[PATCH 1/2] tools/nolibc: add limits for {u,}intmax_t, ulong and {u,}llong

2024-04-25 Thread Thomas Weißschuh
They are useful for users and necessary for strtol() and friends. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdint.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/tools/include/nolibc/stdint.h b/tools/include/nolibc/stdint.h index 6665e272e213

[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

[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 tools

[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] 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

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

[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 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, ); > > + if (ret) >

[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

[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 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 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

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

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 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

[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

[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

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 v2] tools/nolibc: mips: add support for PIC

2023-11-08 Thread Thomas Weißschuh
. 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 +- 2

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

2023-11-08 Thread Thomas Weißschuh
. 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..e9a01847c2b8

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] 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

[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 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 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

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. >

[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

[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 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 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] 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

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 pass

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

2023-10-31 Thread Thomas Weißschuh
n 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 -bios f

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

2023-10-31 Thread Thomas Weißschuh
'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 changed, 8 insertions

[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

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 invasive. &g

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 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

[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-by: Thomas

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

2023-10-10 Thread Thomas Weißschuh
elftests/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 selftes

[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 2/5] selftests/nolibc: use EFI -bios for LoongArch qemu

2023-10-10 Thread Thomas Weißschuh
'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. --- tools/testing/selftests

[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] 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

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 > [..]

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

[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

[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

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 wel

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

[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 belong

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 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

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

2023-09-17 Thread Thomas Weißschuh
-by: 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 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

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

2023-09-17 Thread Thomas Weißschuh
of 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

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

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-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

[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

[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 maybe

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

2023-09-16 Thread Thomas Weißschuh
of 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"

[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 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 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 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 detect

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

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