History log of /linux/tools/testing/selftests/nolibc/ (Results 1 – 25 of 297)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
b070dc3608-Apr-2026 Thomas Weißschuh <linux@weissschuh.net>

selftests/nolibc: use gcc 15

Newer compilers tend to detect more problematic code.

Update the testsuite to use gcc 15.2.0 by default.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: h

selftests/nolibc: use gcc 15

Newer compilers tend to detect more problematic code.

Update the testsuite to use gcc 15.2.0 by default.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20260408-nolibc-gcc-15-v1-3-330d0c40f894@weissschuh.net

show more ...

598b670a04-Jan-2026 Thomas Weißschuh <linux@weissschuh.net>

selftests/nolibc: don't skip tests for unimplemented syscalls anymore

The automatic skipping of tests on ENOSYS returns was introduced in
commit 349afc8a52f8 ("selftests/nolibc: skip tests for unimp

selftests/nolibc: don't skip tests for unimplemented syscalls anymore

The automatic skipping of tests on ENOSYS returns was introduced in
commit 349afc8a52f8 ("selftests/nolibc: skip tests for unimplemented
syscalls"). It handled the fact that nolibc would return ENOSYS for many
syscall wrappers on riscv32.

Nowadays nolibc handles all these correctly, so this logic is not used
anymore. To make missing nolibc functionality more obvious fail the
tests again if something is not implemented.

Revert the mentioned commit again.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260406-nolibc-no-skip-enosys-v1-2-c046b1ac7d73@weissschuh.net/

show more ...

9a5206f204-Jan-2026 Thomas Weißschuh <linux@weissschuh.net>

selftests/nolibc: explicitly handle ENOSYS from ptrace()

The automatic ENOSYS handling in EXPECT_SYSER() is about to be removed.
ptrace() will return legitimately return ENOSYS on qemu-user, so hand

selftests/nolibc: explicitly handle ENOSYS from ptrace()

The automatic ENOSYS handling in EXPECT_SYSER() is about to be removed.
ptrace() will return legitimately return ENOSYS on qemu-user, so handle
it explicitly.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260406-nolibc-no-skip-enosys-v1-1-c046b1ac7d73@weissschuh.net/

show more ...

ce834c9c05-Apr-2026 Thomas Weißschuh <linux@weissschuh.net>

tools/nolibc: add byteorder conversions

Add some standard functions to convert between different byte orders.
Conveniently the UAPI headers provide all the necessary functionality.

Signed-off-by: T

tools/nolibc: add byteorder conversions

Add some standard functions to convert between different byte orders.
Conveniently the UAPI headers provide all the necessary functionality.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260405-nolibc-bswap-v1-1-f7699ca9cee0@weissschuh.net

show more ...

2eb64b9305-Apr-2026 Thomas Weißschuh <linux@weissschuh.net>

tools/nolibc: add the _syscall() macro

The standard syscall() function or macro uses the libc return value
convention. Errors returned from the kernel as negative values are
stored in errno and -1 i

tools/nolibc: add the _syscall() macro

The standard syscall() function or macro uses the libc return value
convention. Errors returned from the kernel as negative values are
stored in errno and -1 is returned. Users who want to avoid using
errno don't have a way to call raw syscalls and check the returned
error.

Add a new macro _syscall() which works like the standard syscall()
but passes through the return value from the kernel unchanged.
The naming scheme and return values match the named _sys_foo()
system call wrappers already part of nolibc.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260405-nolibc-syscall-v1-3-e5b12bc63211@weissschuh.net

show more ...

08b96aa904-Apr-2026 Thomas Weißschuh <linux@weissschuh.net>

selftests/nolibc: only use libgcc when really necessary

nolibc should work without libgcc to be compatible with as many
toolchains as possible. Currently the functionality tested by
nolibc-test does

selftests/nolibc: only use libgcc when really necessary

nolibc should work without libgcc to be compatible with as many
toolchains as possible. Currently the functionality tested by
nolibc-test does not contain any dependencies, make sure it stays
this way by not linking libgcc anymore.

On the ppc target GCC always emits references to '_restgpr_' functions,
so keep linking libgcc there.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260404-nolibc-libgcc-v1-1-eb3ecfe0e176@weissschuh.net

show more ...

e70a7bb504-Apr-2026 Thomas Weißschuh <linux@weissschuh.net>

selftests/nolibc: test the memory allocator

The memory allocator has not seen any testing so far.

Add a simple testcase for it.

Suggested-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org

selftests/nolibc: test the memory allocator

The memory allocator has not seen any testing so far.

Add a simple testcase for it.

Suggested-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/lkml/adDRK8D6YBZgv36H@1wt.eu/
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260404-nolibc-asprintf-v2-2-17d2d0df9763@weissschuh.net

show more ...

12496aad01-Apr-2026 Thomas Weißschuh <linux@weissschuh.net>

tools/nolibc: add support for asprintf()

Add support for dynamically allocating formatted strings through
asprintf() and vasprintf().

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by

tools/nolibc: add support for asprintf()

Add support for dynamically allocating formatted strings through
asprintf() and vasprintf().

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260401-nolibc-asprintf-v1-3-46292313439f@weissschuh.net

show more ...

572246dc04-Apr-2026 Thomas Weißschuh <linux@weissschuh.net>

tools/nolibc: handle all major and minor numbers in makedev() and friends

Remove the limitation of only handling small major and minor numbers.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net

tools/nolibc: handle all major and minor numbers in makedev() and friends

Remove the limitation of only handling small major and minor numbers.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260404-nolibc-makedev-v2-5-456a429bf60c@weissschuh.net

show more ...

5afc7e9b04-Apr-2026 Thomas Weißschuh <linux@weissschuh.net>

selftests/nolibc: add a test for stat().st_rdev

The handling of 'dev_t' values is about to be changed.

Add a test to make sure they are returned correctly from stat().

Signed-off-by: Thomas Weißsc

selftests/nolibc: add a test for stat().st_rdev

The handling of 'dev_t' values is about to be changed.

Add a test to make sure they are returned correctly from stat().

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260404-nolibc-makedev-v2-2-456a429bf60c@weissschuh.net

show more ...

9c0ff25704-Apr-2026 Thomas Weißschuh <linux@weissschuh.net>

selftests/nolibc: add some tests for makedev() and friends

These functions/macros are about to be changed.

Add some tests to make sure they continue working.
As they only handle small dev_t values,

selftests/nolibc: add some tests for makedev() and friends

These functions/macros are about to be changed.

Add some tests to make sure they continue working.
As they only handle small dev_t values, only test those for now.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260404-nolibc-makedev-v2-1-456a429bf60c@weissschuh.net

show more ...

1dff9ac223-Mar-2026 David Laight <david.laight.linux@gmail.com>

tools/nolibc/printf: Support negative variable width and precision

For (eg) "%*.*s" treat a negative field width as a request to left align
the output (the same as the '-' flag), and a negative prec

tools/nolibc/printf: Support negative variable width and precision

For (eg) "%*.*s" treat a negative field width as a request to left align
the output (the same as the '-' flag), and a negative precision to
request the default precision.

Set the default precision to -1 (not INT_MAX) and add explicit checks
to the string handling for negative values (makes the tet unsigned).

For numeric output check for 'precision >= 0' instead of testing
_NOLIBC_PF_FLAGS_CONTAIN(flags, '.').
This needs an inverted test, some extra goto and removes an indentation.
The changed conditionals fix printf("%0-#o", 0) - but '0' and '-' shouldn't
both be specified.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Link: https://patch.msgid.link/20260323112247.3196-1-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

show more ...

c8f6a4bb18-Mar-2026 Thomas Weißschuh <linux@weissschuh.net>

selftests/nolibc: enable -Wundef

Users might use -Wundef, so also use it in the nolibc testsuite to
ensure no warnings are triggered.

The existing line with warning options is getting too long,
so

selftests/nolibc: enable -Wundef

Users might use -Wundef, so also use it in the nolibc testsuite to
ensure no warnings are triggered.

The existing line with warning options is getting too long,
so move all warnings to a dedicated line.

Acked-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20260318-nolibc-wundef-v1-2-fcb7f9ac7298@weissschuh.net

show more ...

b74be92218-Mar-2026 Thomas Weißschuh <linux@weissschuh.net>

tools/nolibc: add support for program_invocation_{,short_}name

Add support for the GNU extensions 'program_invocation_name' and
'program_invocation_short_name'. These are useful to print error
messa

tools/nolibc: add support for program_invocation_{,short_}name

Add support for the GNU extensions 'program_invocation_name' and
'program_invocation_short_name'. These are useful to print error
messages, which by convention include the program name.

As these are global variables which take up memory even if not used,
similar to 'errno', gate them behind NOLIBC_IGNORE_ERRNO.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260318-nolibc-err-h-v4-1-08247a694bd9@weissschuh.net

show more ...

5662ec0011-Mar-2026 Thomas Weißschuh <linux@weissschuh.net>

selftests/nolibc: validate NOLIBC_IGNORE_ERRNO compilation

When NOLIBC_IGNORE_ERRNO is set, various bits of nolibc are disabled.

Make sure that all the ifdeffery does not result in any compilation

selftests/nolibc: validate NOLIBC_IGNORE_ERRNO compilation

When NOLIBC_IGNORE_ERRNO is set, various bits of nolibc are disabled.

Make sure that all the ifdeffery does not result in any compilation
errors by compiling a dummy source file.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260311-nolibc-err-h-v1-2-735a9de7f15d@weissschuh.net

show more ...

e290017611-Mar-2026 Thomas Weißschuh <linux@weissschuh.net>

selftests/nolibc: add a variable for nolibc-test source files

The list of the nolibc-test source files is repeated many times.
Another source file is about to be added, adding to the mess.

Introduc

selftests/nolibc: add a variable for nolibc-test source files

The list of the nolibc-test source files is repeated many times.
Another source file is about to be added, adding to the mess.

Introduce a common variable instead.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260311-nolibc-err-h-v1-1-735a9de7f15d@weissschuh.net

show more ...

9bc019e708-Mar-2026 David Laight <david.laight.linux@gmail.com>

selftests/nolibc: Use printf variable field widths and precisions

Now that printf supports '*' for field widths and precisions
then can be used to simplify the test output.
- aligning the "[OK]" st

selftests/nolibc: Use printf variable field widths and precisions

Now that printf supports '*' for field widths and precisions
then can be used to simplify the test output.
- aligning the "[OK]" strings.
- reporting the expected sprintf() output when there is a mismatch.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260308113742.12649-18-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

show more ...

248c7cf608-Mar-2026 David Laight <david.laight.linux@gmail.com>

tools/nolibc/printf: Add support for octal output

Octal output isn't often used, but adding it costs very little.

Supporting "%#o" is mildly annoying, it has to add a leading '0' if
there isn't one

tools/nolibc/printf: Add support for octal output

Octal output isn't often used, but adding it costs very little.

Supporting "%#o" is mildly annoying, it has to add a leading '0' if
there isn't one present. In simple cases this is the same as adding a sign
of '0' - but that adds an extra '0' in a few places.
So you need 3 tests, %o, # and no leading '0' (which can only be checked
after the zero pad for precision).
If all the test are deferred until after zero padding then too many values
are 'live' across the call to _nolibc_u64toa_base() and get spilled to stack.
Hence the check that ignores the 'sign' if it is the same as the first
character of the output string.

Add tests for octal output.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260308113742.12649-17-david.laight.linux@gmail.com
[Thomas: avoid a -Wsign-compare]
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

show more ...

d3d3f64f08-Mar-2026 David Laight <david.laight.linux@gmail.com>

tools/nolibc/printf: Add support for zero padding and field precision

Includes support for variable field widths (eg "%*.*d").

Zero padding is limited to 31 zero characters.
This is wider than the

tools/nolibc/printf: Add support for zero padding and field precision

Includes support for variable field widths (eg "%*.*d").

Zero padding is limited to 31 zero characters.
This is wider than the largest numeric field so shouldn't be a problem.

All the standard printf formats are now supported except octal
and floating point.

Add tests for new features

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260308113742.12649-16-david.laight.linux@gmail.com
[Thomas: fixup testcases for musl libc]
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

show more ...

b5f3f59c08-Mar-2026 David Laight <david.laight.linux@gmail.com>

tools/nolibc/printf: Add support for left aligning fields

Output the characters before or after the pad - writing the pad takes more code.

Include additional/changed tests

Signed-off-by: David Lai

tools/nolibc/printf: Add support for left aligning fields

Output the characters before or after the pad - writing the pad takes more code.

Include additional/changed tests

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260308113742.12649-15-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

show more ...

5eae5f1a08-Mar-2026 David Laight <david.laight.linux@gmail.com>

tools/nolibc/printf: Special case 0 and add support for %#x

The output for %#x is almost the same as that for %p, both output in
hexadecimal with a leading "0x".
However for zero %#x should just out

tools/nolibc/printf: Special case 0 and add support for %#x

The output for %#x is almost the same as that for %p, both output in
hexadecimal with a leading "0x".
However for zero %#x should just output "0" (the same as decimal and ocal).
For %p match glibc and output "(nil)" rather than "0x0" or "0".

Add tests for "%#x", "% d", "%+d" and passing NULL to "%p".

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260308113742.12649-14-david.laight.linux@gmail.com
[Thomas: fix up testcases for musl libc]
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

show more ...

1256328708-Mar-2026 David Laight <david.laight.linux@gmail.com>

tools/nolibc/printf: Add support for length modifiers tzqL and formats iX

Length modifiers t (ptrdiff_t) and z (size_t) are aliases for l (long),
q and L are 64bit the same as j (intmax).
Format i i

tools/nolibc/printf: Add support for length modifiers tzqL and formats iX

Length modifiers t (ptrdiff_t) and z (size_t) are aliases for l (long),
q and L are 64bit the same as j (intmax).
Format i is an alias for d and X similar to x but upper case.
Supporting them is mostly just adding the relevant bit to the bit
pattern used for matching characters.
Although %X is detected the output will be lower case.

Change/add tests to use conversions i and X, and length modifiers L and ll.
Use the correct minimum value for "%Li".

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260308113742.12649-10-david.laight.linux@gmail.com
[Thomas: Fix up testcases for musl libc]
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

show more ...

2177dd3708-Mar-2026 David Laight <david.laight.linux@gmail.com>

tools/nolibc: Implement strerror() in terms of strerror_r()

strerror() can be the only part of a program that has a .data section.
This requires 4k in the program file.

Add a simple implementation

tools/nolibc: Implement strerror() in terms of strerror_r()

strerror() can be the only part of a program that has a .data section.
This requires 4k in the program file.

Add a simple implementation of strerror_r() and use that in strerror()
so that the "errno=" string is copied at run-time.
Use __builtin_memcpy() because that optimises away the input string
and just writes the required constants to the target buffer.

Code size change largely depends on whether the inlining decision for
strerror() changes.

Change the tests to use the normal EXPECT_VFPRINTF() when testing %m.
Skip the tests when !is_nolibc.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260308113742.12649-4-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

show more ...

ab7cd32908-Mar-2026 David Laight <david.laight.linux@gmail.com>

selftests/nolibc: Rename w to written in expect_vfprintf()

Single character variable names don't make code easy to read.
Rename 'w' (used for the return value from snprintf()) 'written'.

Signed-off

selftests/nolibc: Rename w to written in expect_vfprintf()

Single character variable names don't make code easy to read.
Rename 'w' (used for the return value from snprintf()) 'written'.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260308113742.12649-3-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

show more ...

cf34708802-Mar-2026 David Laight <david.laight.linux@gmail.com>

selftests/nolibc: Let EXPECT_VFPRINTF() tests be skipped

Tests that check explicit nolibc behavior (eg "%m") or test places
where the nolibc behaviour deviates from the libc need skipping
when compi

selftests/nolibc: Let EXPECT_VFPRINTF() tests be skipped

Tests that check explicit nolibc behavior (eg "%m") or test places
where the nolibc behaviour deviates from the libc need skipping
when compiled to use the host libc.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260302101815.3043-8-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

show more ...

12345678910>>...12