aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2018-08-24 14:21:10 -0400
committerMike Gilbert <floppym@gentoo.org>2018-09-10 11:18:05 -0400
commitc53568d93df9e2c94d0334e1e42e8a6de1a6797a (patch)
tree86c3d80790afd283ebba7afcfb46a0bb9607876f /general-concepts
parentkeywording: sort keywords out (diff)
downloaddevmanual-c53568d93df9e2c94d0334e1e42e8a6de1a6797a.tar.gz
devmanual-c53568d93df9e2c94d0334e1e42e8a6de1a6797a.tar.bz2
devmanual-c53568d93df9e2c94d0334e1e42e8a6de1a6797a.zip
Add section about defining "Test Dependencies"
Reviewed-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'general-concepts')
-rw-r--r--general-concepts/dependencies/text.xml38
1 files changed, 38 insertions, 0 deletions
diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
index 2f10380..6b0ce38 100644
--- a/general-concepts/dependencies/text.xml
+++ b/general-concepts/dependencies/text.xml
@@ -578,6 +578,44 @@ valid.
</body>
</section>
+<section>
+<title>Test Dependencies</title>
+<body>
+
+<p>
+Packages often have optional dependencies that are needed only when running
+tests. These should be specified in DEPEND behind a USE flag. Often, the
+'test' USE flag is used for this purpose.
+</p>
+
+<p>
+Since testing will likely fail when test dependencies are not installed, the
+test phase should be disabled in this case. This may be accomplished via USE
+conditionals in the RESTRICT variable.
+</p>
+
+<p>
+If other optional features must be enabled/disabled when testing, REQUIRED_USE
+may be set to express this.
+</p>
+
+<codesample lang="ebuild">
+# Define some USE flags
+IUSE="debug test"
+
+# Require debug support when tests are enabled
+REQUIRED_USE="test? ( debug )"
+
+# Disable test phase when test USE flag is disabled
+RESTRICT="!test? ( test )"
+
+# Running tests requires 'foo' to be installed
+DEPEND="test? ( dev-util/foo )"
+</codesample>
+
+</body>
+</section>
+
</body>
</chapter>
</guide>