OSDN Git Service

selftests/nolibc: Add a "run-user" target to test the program in user land
authorWilly Tarreau <w@1wt.eu>
Sat, 21 Jan 2023 08:53:20 +0000 (09:53 +0100)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 24 Jan 2023 23:35:45 +0000 (15:35 -0800)
commitc54ba4178159e440bea3826d22d43a9d0d94b071
tree83de82d0a0383116522324bb87b1a619179da3fb
parentf9b06695ba64bca310ada3df05264273106c5184
selftests/nolibc: Add a "run-user" target to test the program in user land

When developing tests, it is much faster to use the QEMU Linux
emulator instead of the system emulator, which among other things avoids
kernel-build latencies.  Although use of the QEMU Linux emulator does have
its limitations (please see below), it is sufficient to test startup code,
stdlib code, and syscall calling conventions.

However, the current mainline Linux-kernel nolibc setup does not
support this.  Therefore, add a "run-user" target that immediately
executes the prebuilt executable.

Again, this approach does have its limitations.  For example, the
executable runs with the user's privilege level, which can cause some
false-positive failures due to insufficient permissions.  In addition,
if the underlying kernel is old enough to lack some features that
nolibc relies on, the result will be false-positive failures in the
corresponding tests.  However, for nolibc changes not affected by these
limittions, the result is a much faster code-compile-test-debug cycle.

With this patch, running a userland test is as simple as issuing:

  make ARCH=xxx CROSS_COMPILE=xxx run-user

Signed-off-by: Willy Tarreau <w@1wt.eu>
Tested-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/testing/selftests/nolibc/Makefile