Gentoo Archives: gentoo-dev

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

Replies