Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: Gentoo Dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
Date: Sat, 25 Aug 2018 18:24:19
Message-Id: CAJ0EP43T64f96+552b3vY43DXXqk0ahge=dMnAcq_cetWCoK5A@mail.gmail.com
In Reply to: Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies" by Andrew Savchenko
1 On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@g.o> wrote:
2 >
3 > On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
4 > > ---
5 > > general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
6 > > 1 file changed, 38 insertions(+)
7 > >
8 > > diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
9 > > index 2f10380..64be9dc 100644
10 > > --- a/general-concepts/dependencies/text.xml
11 > > +++ b/general-concepts/dependencies/text.xml
12 > > @@ -578,6 +578,44 @@ valid.
13 > > </body>
14 > > </section>
15 > >
16 > > +<section>
17 > > +<title>Test Dependencies</title>
18 > > +<body>
19 > > +
20 > > +<p>
21 > > +Packages often have optional dependencies that are needed only when running
22 > > +tests. These should be specified in DEPEND behind a USE flag. Often, the
23 > > +'test' USE flag is used for this purpose.
24 > > +</p>
25 > > +
26 > > +<p>
27 > > +Since testing will likely fail when test dependencies are not installed, the
28 > > +test phase should be disabled in this case. This may be accomplished via USE
29 > > +conditionals in the RESTRICT variable.
30 > > +</p>
31 > > +
32 > > +<p>
33 > > +If other optional features must be enabled/disabled when testing, REQUIRED_USE
34 > > +may be set to express this.
35 > > +</p>
36 > > +
37 > > +<codesample lang="ebuild">
38 > > +# Define some USE flags
39 > > +IUSE="debug test"
40 > > +
41 > > +# Disable test phase when test USE flag is disabled
42 > > +RESTRICT="!test? ( test )"
43 >
44 > I do not understand why we need this useless code. If test USE flag
45 > is disabled, tests must be disabled as well. It is PM's job and
46 > there is no need to put this obvious stuff into each ebuild with
47 > tests and extra deps. I see no reason to support running src_test()
48 > with USE="-test".
49
50 PMS does not specify that behavior (skipping src_test with USE=-test).
51 It is better to define the requrement explicitly rather than relying
52 on a Portage-specific behavior.

Replies

Subject Author
Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies" Andrew Savchenko <bircoph@g.o>