1 |
commit: c53568d93df9e2c94d0334e1e42e8a6de1a6797a |
2 |
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 24 18:21:10 2018 +0000 |
4 |
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 10 15:18:05 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=c53568d9 |
7 |
|
8 |
Add section about defining "Test Dependencies" |
9 |
|
10 |
Reviewed-by: Ulrich Müller <ulm <AT> gentoo.org> |
11 |
|
12 |
general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++++++++++ |
13 |
1 file changed, 38 insertions(+) |
14 |
|
15 |
diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml |
16 |
index 2f10380..6b0ce38 100644 |
17 |
--- a/general-concepts/dependencies/text.xml |
18 |
+++ b/general-concepts/dependencies/text.xml |
19 |
@@ -578,6 +578,44 @@ valid. |
20 |
</body> |
21 |
</section> |
22 |
|
23 |
+<section> |
24 |
+<title>Test Dependencies</title> |
25 |
+<body> |
26 |
+ |
27 |
+<p> |
28 |
+Packages often have optional dependencies that are needed only when running |
29 |
+tests. These should be specified in DEPEND behind a USE flag. Often, the |
30 |
+'test' USE flag is used for this purpose. |
31 |
+</p> |
32 |
+ |
33 |
+<p> |
34 |
+Since testing will likely fail when test dependencies are not installed, the |
35 |
+test phase should be disabled in this case. This may be accomplished via USE |
36 |
+conditionals in the RESTRICT variable. |
37 |
+</p> |
38 |
+ |
39 |
+<p> |
40 |
+If other optional features must be enabled/disabled when testing, REQUIRED_USE |
41 |
+may be set to express this. |
42 |
+</p> |
43 |
+ |
44 |
+<codesample lang="ebuild"> |
45 |
+# Define some USE flags |
46 |
+IUSE="debug test" |
47 |
+ |
48 |
+# Require debug support when tests are enabled |
49 |
+REQUIRED_USE="test? ( debug )" |
50 |
+ |
51 |
+# Disable test phase when test USE flag is disabled |
52 |
+RESTRICT="!test? ( test )" |
53 |
+ |
54 |
+# Running tests requires 'foo' to be installed |
55 |
+DEPEND="test? ( dev-util/foo )" |
56 |
+</codesample> |
57 |
+ |
58 |
+</body> |
59 |
+</section> |
60 |
+ |
61 |
</body> |
62 |
</chapter> |
63 |
</guide> |