diff options
Diffstat (limited to 'tests/atlocal.in')
-rw-r--r-- | tests/atlocal.in | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/atlocal.in b/tests/atlocal.in index 91b41b2..adf3bad 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -24,5 +24,32 @@ export SANDBOX_VERBOSE=0 # If the terminal has this flag set, the tests get all messed up. stty -tostop 2>/dev/null || : +# Some tests want this internal path. +for devfd in /proc/self/fd /dev/fd ; do + [ -e "${devfd}" ] && break +done + +# GNU make likes to leak fds when using jobservers (i.e. using -j). +case "${MAKEFLAGS}" in +*--jobserver-auth=*) + flags=${MAKEFLAGS#*--jobserver-auth=} + flags=${flags%% *} + for fd in $(echo "${flags}" | tr ',' ' ') ; do + if [ -e "${devfd}/${fd}" ] ; then + eval "exec ${fd}>&-" + fi + done + ;; +esac + +# Figure out currently YAMA ptrace_scope restriction level. +at_yama_ptrace_scope=$(cat /proc/sys/kernel/yama/ptrace_scope 2>/dev/null || echo 0) +if [ ${at_yama_ptrace_scope} -gt 0 ] ; then + if [ "$(id -u)" -eq 0 ] ; then + at_yama_ptrace_scope=0 + fi +fi +export at_yama_ptrace_scope + # This script must finish with ($? == 0) else the autotest runner gets upset. : |