On some platforms, lsns::filter test failed with the following
message:
+test_mkfds: failed to write to /proc/self/uid_map: -1: Operation
not permitted
This change is to skip the test case on such platforms.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
"failed to open /proc/self/uid_map");
r = write (mapfd, buf, n);
if (r < 0)
- err(EXIT_FAILURE,
+ err((errno == EPERM? EXIT_EPERM: EXIT_FAILURE),
"failed to write to /proc/self/uid_map");
if (r != n)
errx(EXIT_FAILURE,
ts_failed "failed to use a AF_VSOCK socket: $msg [$err]";;
esac
}
+
+function lsfd_check_userns
+{
+ ts_check_test_command "$TS_HELPER_MKFDS"
+
+ local msg
+ local err
+
+ msg=$("$TS_HELPER_MKFDS" -c userns 3 2>&1)
+ err=$?
+
+ case $err in
+ 0)
+ return;;
+ "$EPERM")
+ ts_skip "maybe /proc/self/uid_map it not writable";;
+ *)
+ ts_failed "failed to use a AF_VSOCK socket: $msg [$err]";;
+ esac
+}
# unshare(2) used in userns factory of test_mkfds reports "Invalid argument".
ts_skip_qemu_user
+lsfd_check_userns
+
ts_cd "$TS_OUTDIR"
PID=
FD=4