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 3B5231396D0 for ; Thu, 24 Aug 2017 19:02:10 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 07ED5E0D76; Thu, 24 Aug 2017 19:02:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C9B48E0D76 for ; Thu, 24 Aug 2017 19:02:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E464033C770 for ; Thu, 24 Aug 2017 19:02:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1F0548150 for ; Thu, 24 Aug 2017 19:02:05 +0000 (UTC) From: "Göktürk Yüksek" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Göktürk Yüksek" Message-ID: <1503601237.1118c727fbb60fb6b26fd1e2845ecca51685a7ee.gokturk@gentoo> Subject: [gentoo-commits] proj/devmanual:master commit in: ebuild-writing/functions/src_test/ X-VCS-Repository: proj/devmanual X-VCS-Files: ebuild-writing/functions/src_test/text.xml X-VCS-Directories: ebuild-writing/functions/src_test/ X-VCS-Committer: gokturk X-VCS-Committer-Name: Göktürk Yüksek X-VCS-Revision: 1118c727fbb60fb6b26fd1e2845ecca51685a7ee X-VCS-Branch: master Date: Thu, 24 Aug 2017 19:02:05 +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-Archives-Salt: 0d381381-a4cf-468c-a8dc-828ccb6b903b X-Archives-Hash: f1b4662791852ca35235828341d4f080 commit: 1118c727fbb60fb6b26fd1e2845ecca51685a7ee Author: Michał Górny gentoo org> AuthorDate: Tue Aug 22 09:44:48 2017 +0000 Commit: Göktürk Yüksek gentoo org> CommitDate: Thu Aug 24 19:00:37 2017 +0000 URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=1118c727 ebuild-writing/.../src_test: Expand on network & service access problems ebuild-writing/functions/src_test/text.xml | 101 +++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/ebuild-writing/functions/src_test/text.xml b/ebuild-writing/functions/src_test/text.xml index bd8f297..6ce3b79 100644 --- a/ebuild-writing/functions/src_test/text.xml +++ b/ebuild-writing/functions/src_test/text.xml @@ -63,6 +63,107 @@ src_test() {
+Tests that require network or service access + +

+Sometimes test suites (and other build-time programs) attempt to use +remote or local network, or production servers running on the host. All +of these are strictly forbidden. Developers should either fix such tests +to work in an isolated environment, or disable them completely unless +explicitly allowed by the user. At the bare minimum, the tests must +not fail with FEATURES=network-sandbox being enabled. +

+ +

+Internet access within the build procedure is forbidden for +the following reasons: +

+
    +
  • + the build may be running in an environment with no or restricted + Internet access, and this must not cause the tests (build) to fail; +
  • + +
  • + the Internet connection may be unstable (e.g. poor reception) + in which case an interrupted connection or packet loss must not + cause the tests to fail or hang, and it should not cause unnecessary + delays; +
  • + +
  • + the Internet connection may be running on a limited data plan + in which case the additional network use may cause additional + charges or other inconveniences to the user; +
  • + +
  • + the remote network services used by the tests may become unavailable + temporarily or permanently, causing unexpected test failures; +
  • + +
  • + accessing remote sites always poses a privacy issue, and possibly + a threat to security (e.g. through inadvertently exposing + information about the system). +
  • +
+ +

+Fixing tests that require Internet access usually requires cooperation +with upstream, and porting the tests to use test techniques such as +mocking or using replay data. For this reason, developers report +the issue upstream and skip tests that require network access. +It is recommended to explicitly leave a note as to why the tests are +skipped, so that other developers can re-enable them locally to run +a more complete test suite. +

+ +

+Local server access within the build procedure is additionally +forbidden for the following reasons: +

+
    +
  • + tests must run reliably independently of whether a particular + server is running throughout the build process or not, +
  • + +
  • + using production services for running tests is extremely + dangerous as it may inadvertently expose bugs in those + services, causing instability, data loss or even exposing security + vulnerabilities. +
  • +
+ +

+Fixing tests that require access to local services is usually done +via starting additional isolated instances of those services during +the test phase. Those services must either be running on a UNIX +socket or on the loopback interface, to reliably prevent remote access. +

+ +

+For all networked services exposed during the test phase (either by +the ebuild or the tests themselves), UNIX sockets are strongly preferred +over IP sockets as they provide better means for unique naming +and access control mechanisms. IP sockets can be subject to port +collisions with other local services and they can be accessed by local +system users who may exploit a vulnerability through the tests. +

+ +

+Additional protection against those issues is provided through +FEATURES=network-sandbox. However, this is only an optional +Portage feature relying on specific Linux kernel namespace mechanisms +and developers should not rely on it being enabled. +

+ + +
+ +
Tests that require X11