• Willy Tarreau's avatar
    selftests/nolibc: recreate and populate /dev and /proc if missing · 1a5454f6
    Willy Tarreau authored
    Most of the time the program will be run alone in an initramfs. There
    is no value in requiring the user to populate /dev and /proc for such
    tests, we can do it ourselves, and it participates to the tests at the
    same time.
    
    What's done here is that when called as init (getpid()==1) we check
    if /dev exists or create it, if /dev/console and /dev/null exists,
    otherwise we try to mount a devtmpfs there, and if it fails we fall
    back to mknod. The console is reopened if stdout was closed. Finally
    /proc is created and mounted if /proc/self cannot be found. This is
    sufficient for most tests.
    Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    1a5454f6
nolibc-test.c 21.7 KB