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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 93CFE158041 for ; Wed, 28 Feb 2024 06:26:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D15F8E2AB2; Wed, 28 Feb 2024 06:26:10 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B1818E2AB2 for ; Wed, 28 Feb 2024 06:26:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E3C9234067D for ; Wed, 28 Feb 2024 06:26:09 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4E4AC14DF for ; Wed, 28 Feb 2024 06:26:08 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1709101545.e882b1e956d50808a0143875a8ca35f2fc21f368.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/tests/process/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/tests/process/test_unshare_net.py X-VCS-Directories: lib/portage/tests/process/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: e882b1e956d50808a0143875a8ca35f2fc21f368 X-VCS-Branch: master Date: Wed, 28 Feb 2024 06:26:08 +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: 6b080f38-870a-4a5a-b557-13da29eb7151 X-Archives-Hash: 1ef2809aeafe0181cb56ab5ea111dc25 commit: e882b1e956d50808a0143875a8ca35f2fc21f368 Author: Zac Medico gentoo org> AuthorDate: Wed Feb 28 06:25:45 2024 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Feb 28 06:25:45 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e882b1e9 UnshareNetTestCase: Initialize ABILITY_TO_UNSHARE in setUp Initialize ABILITY_TO_UNSHARE in setUp so that _unshare_validate uses the correct PORTAGE_MULTIPROCESSING_START_METHOD setup from super().setUp(), eliminating messages like this from CI runs for the multiprocessing start method spawn: /opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/multiprocessing/popen_fork.py:66: DeprecationWarning: This process (pid=2886) is multi-threaded, use of fork() may lead to deadlocks in the child. The cause of these messages can be traced by patching python's multiprocessing popen_fork.py like this: --- /usr/lib/python3.12/multiprocessing/popen_fork.py +++ /usr/lib/python3.12/multiprocessing/popen_fork.py @@ -2,2 +2,3 @@ import signal +import traceback @@ -62,2 +63,3 @@ def _launch(self, process_obj): + traceback.print_stack() code = 1 Fixes: 3110ec376cbc ("actions: Fix interaction between start-method and pytest-xdist") Signed-off-by: Zac Medico gentoo.org> lib/portage/tests/process/test_unshare_net.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/portage/tests/process/test_unshare_net.py b/lib/portage/tests/process/test_unshare_net.py index dabf15585f..ad3b288ef4 100644 --- a/lib/portage/tests/process/test_unshare_net.py +++ b/lib/portage/tests/process/test_unshare_net.py @@ -20,19 +20,27 @@ ping -c 1 -W 1 10.0.0.1 || exit 1 ping -c 1 -W 1 ::1 || exit 1 ping -c 1 -W 1 fd::1 || exit 1 """ -ABILITY_TO_UNSHARE = portage.process._unshare_validate(CLONE_NEWNET) class UnshareNetTestCase(TestCase): - @pytest.mark.skipif( - ABILITY_TO_UNSHARE != 0, - reason=f"Unable to unshare: {errno.errorcode.get(ABILITY_TO_UNSHARE, '?')}", - ) + def setUp(self): + """ + Initialize ABILITY_TO_UNSHARE in setUp so that _unshare_validate + uses the correct PORTAGE_MULTIPROCESSING_START_METHOD setup + from super().setUp(). + """ + super().setUp() + self.ABILITY_TO_UNSHARE = portage.process._unshare_validate(CLONE_NEWNET) + @pytest.mark.skipif( portage.process.find_binary("ping") is None, reason="ping not found" ) @pytest.mark.skipif(platform.system() != "Linux", reason="not Linux") def testUnshareNet(self): + if self.ABILITY_TO_UNSHARE != 0: + pytest.skip( + f"Unable to unshare: {errno.errorcode.get(self.ABILITY_TO_UNSHARE, '?')}" + ) env = os.environ.copy() env["IPV6"] = "1" if portage.process._has_ipv6() else "" self.assertEqual(