From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2944E158086 for ; Thu, 21 Oct 2021 02:48:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5CBE3E087F; Thu, 21 Oct 2021 02:48:33 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 35E1EE087F for ; Thu, 21 Oct 2021 02:48:33 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E73933436A0 for ; Thu, 21 Oct 2021 02:48:01 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 62EE810A for ; Thu, 21 Oct 2021 02:48:00 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1634784059.ac981df3077edde8bfc95dc54d8a82943986042f.vapier@gentoo> Subject: [gentoo-commits] proj/sandbox:master commit in: tests/ X-VCS-Repository: proj/sandbox X-VCS-Files: tests/atlocal.in tests/script-1.sh X-VCS-Directories: tests/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: ac981df3077edde8bfc95dc54d8a82943986042f X-VCS-Branch: master Date: Thu, 21 Oct 2021 02:48:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: bd64b188-cb23-4bdc-9cf0-29d9b5797a4a X-Archives-Hash: efa938986aecc0086654bc455cb48841 commit: ac981df3077edde8bfc95dc54d8a82943986042f Author: Mike Frysinger gentoo org> AuthorDate: Thu Oct 21 02:40:59 2021 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Thu Oct 21 02:40:59 2021 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=ac981df3 tests: handle fd leakage from GNU make jobservers Current versions of GNU make (at least v4.3) seem to be leaking its jobserver fds to children which breaks some tests that expect fd 3 and higher to be free. Add some startup logic to clean those to fix `make -j check` failures. Signed-off-by: Mike Frysinger gentoo.org> tests/atlocal.in | 18 ++++++++++++++++++ tests/script-1.sh | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index 91b41b2..e8213c0 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -24,5 +24,23 @@ 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 + # This script must finish with ($? == 0) else the autotest runner gets upset. : diff --git a/tests/script-1.sh b/tests/script-1.sh index 3ac6252..8b18114 100755 --- a/tests/script-1.sh +++ b/tests/script-1.sh @@ -1,5 +1,8 @@ #!/bin/sh # http://bugs.gentoo.org/257418 [ "${at_xfail}" = "yes" ] && exit 77 # see script-0 -(>/dev/fd/3) +( +cd "${devfd}" +>3 +) exit 0