Re: [PATCH v3 2/2] selftests/nolibc: Add a very basic test for fallocate()
From: Thomas Weißschuh
Date: Sun May 03 2026 - 12:21:19 EST
On 2026-05-01 01:41:25+0900, Daniel Palmer wrote:
> 1: Create a tmp file, fallocate() to make it a bit bigger, check the
> size is what was expected.
>
> 2: Try to fallocate() (1 << 20), this should work.
>
> 3: Try to fallocate() (1 << 52), this should cause ENOSPC or EFBIG.
>
> 2 and 3 are basically to make sure if the offset or size are split
> into a pair of registers for the syscall that we are passing them
> the correct way around.
>
> sparc32 seems to return EOPNOTSUPP for fallocate() so skip the
> test there.
This is because the kernel created in our testsuite does not enable
CONFIG_TMPFS, falling back to ramfs/rootfs for /tmp. We should
gracefully handle EOPNOTSUPP from fallocate() but also enable
CONFIG_TMPFS for our test kernels to increase the test coverage.
> Signed-off-by: Daniel Palmer <daniel@xxxxxxxxx>
> ---
> tools/testing/selftests/nolibc/nolibc-test.c | 69 ++++++++++++++++++++
> 1 file changed, 69 insertions(+)
>
> diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
> index 08610cacf030..a586e9d9ede2 100644
(...)