selftests/nolibc: implement a few tests for various syscalls
authorWilly Tarreau <w@1wt.eu>
Tue, 19 Jul 2022 21:44:37 +0000 (23:44 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 31 Aug 2022 12:17:44 +0000 (05:17 -0700)
commitb4844fa0bdb4075ad842e89d6c41e3d0c6124848
treeecb48e211de959001dad2ec026acaa594438be8f
parent23da7bc923609bc90b6989c6c6a17e74c8f433ed
selftests/nolibc: implement a few tests for various syscalls

This adds 63 tests covering about 34 syscalls. Both successes and
failures are tested. Two tests fail when run as unprivileged user
(link_dir which returns EACCESS instead of EPERM, and chroot which
returns EPERM). One test (execve("/")) expects to fail on EACCESS,
but needs to have valid arguments otherwise the kernel will log a
message. And a few tests require /proc to be mounted.

The code is not pretty since all tests are one-liners, sometimes
resulting in long lines, especially when using compount statements to
preset a line, but it's convenient and doesn't obfuscate the code,
which is important to understand what failed.

Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/testing/selftests/nolibc/nolibc-test.c