Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o, Andrew Savchenko <bircoph@g.o>
Subject: Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
Date: Sun, 26 Aug 2018 08:54:45
Message-Id: 1535273675.1066.13.camel@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies" by Zac Medico
1 On Sun, 2018-08-26 at 01:43 -0700, Zac Medico wrote:
2 > On 08/26/2018 01:08 AM, Michał Górny wrote:
3 > > On Sun, 2018-08-26 at 00:58 -0700, Zac Medico wrote:
4 > > > On 08/26/2018 12:39 AM, Michał Górny wrote:
5 > > > > On Sun, 2018-08-26 at 00:28 -0700, Zac Medico wrote:
6 > > > > > On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
7 > > > > > > On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
8 > > > > > > > On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@g.o> wrote:
9 > > > > > > > >
10 > > > > > > > > On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
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..64be9dc 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 > > > > > > > > > +# Disable test phase when test USE flag is disabled
49 > > > > > > > > > +RESTRICT="!test? ( test )"
50 > > > > > > > >
51 > > > > > > > > I do not understand why we need this useless code. If test USE flag
52 > > > > > > > > is disabled, tests must be disabled as well. It is PM's job and
53 > > > > > > > > there is no need to put this obvious stuff into each ebuild with
54 > > > > > > > > tests and extra deps. I see no reason to support running src_test()
55 > > > > > > > > with USE="-test".
56 > > > > > > >
57 > > > > > > > PMS does not specify that behavior (skipping src_test with USE=-test).
58 > > > > > > > It is better to define the requrement explicitly rather than relying
59 > > > > > > > on a Portage-specific behavior.
60 > > > > > >
61 > > > > > > Then PMS should be fixed. Putting useless code in thousands
62 > > > > > > of ebuilds due to bureaucratic reasons is ridiculous. Having strict
63 > > > > > > conformance to the PMS is good, but common sense should still be
64 > > > > > > considered.
65 > > > > >
66 > > > > > Since PMS doesn't specify the behavior of FEATURES, I suppose we could
67 > > > > > make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
68 > > > > > drawbacks to that?
69 > > > >
70 > > > > Except for Portage once again silently letting developers pass with non-
71 > > > > PMS behavior, and making other PMs fail with the ebuilds?
72 > > >
73 > > > Is it really sane for other PMs to behave that way though?
74 > > >
75 > > > In PMS it says src_test "may be disabled by user too, using a
76 > > > PM-specific mechanism", which doesn't explicitly rule out behavior based
77 > > > on USE settings.
78 > >
79 > > It doesn't rule out disabling based on the phase of the moon either, or
80 > > my mood which is degrading badly with this discussion.
81 >
82 > Well, using package.use for this doesn't really make sense within the
83 > context of ebuilds that don't have IUSE=test, which is an argument for
84 > people to use package.env as a consistent means to selectively disable
85 > unit tests.
86
87 ...and this is how it was supposed to work, and AFAIU how it works right
88 now.
89
90 --
91 Best regards,
92 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature