• Willy Tarreau's avatar
    selftests/nolibc: Add a "run-user" target to test the program in user land · c54ba417
    Willy Tarreau authored
    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: default avatarWilly Tarreau <w@1wt.eu>
    Tested-by: default avatarAmmar Faizi <ammarfaizi2@gnuweeb.org>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    c54ba417
Makefile 5.82 KB