selftests/nolibc: skip the chroot_root and link_dir tests when not privileged
authorWilly Tarreau <w@1wt.eu>
Sat, 4 Mar 2023 14:28:41 +0000 (15:28 +0100)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 20 Mar 2023 15:45:22 +0000 (08:45 -0700)
commit3e2d337b94688b159e2f014248eb9cb6e0d494b5
tree4ff5cc198bcb6c2022be3df6dbcfbcd096f61647
parent919d0532d48ca1bea62bc04f269b9e72706467c6
selftests/nolibc: skip the chroot_root and link_dir tests when not privileged

These two tests always fail when the program is started natively as an
unprivileged user, and require the user to carefully check the output
of "make run-user" and ignore them.

Let's add an euid check and condition these two tests to euid==0. Now
the test case stops needlessly reporting failures. E.g.:

  $ make -C tools/testing/selftests/nolibc run-user
  ...
    CC      nolibc-test
  123 test(s) passed.

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