Gentoo Archives: gentoo-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-dev@l.g.o, "Michał Górny" <mgorny@g.o>, Andrew Savchenko <bircoph@g.o>
Subject: Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
Date: Sun, 26 Aug 2018 08:43:18
Message-Id: 7299221e-2219-0f5c-173c-938868004794@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies" by "Michał Górny"
1 On 08/26/2018 01:08 AM, Michał Górny wrote:
2 > On Sun, 2018-08-26 at 00:58 -0700, Zac Medico wrote:
3 >> On 08/26/2018 12:39 AM, Michał Górny wrote:
4 >>> On Sun, 2018-08-26 at 00:28 -0700, Zac Medico wrote:
5 >>>> On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
6 >>>>> On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
7 >>>>>> On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@g.o> wrote:
8 >>>>>>>
9 >>>>>>> On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
10 >>>>>>>> ---
11 >>>>>>>> general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
12 >>>>>>>> 1 file changed, 38 insertions(+)
13 >>>>>>>>
14 >>>>>>>> diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
15 >>>>>>>> index 2f10380..64be9dc 100644
16 >>>>>>>> --- a/general-concepts/dependencies/text.xml
17 >>>>>>>> +++ b/general-concepts/dependencies/text.xml
18 >>>>>>>> @@ -578,6 +578,44 @@ valid.
19 >>>>>>>> </body>
20 >>>>>>>> </section>
21 >>>>>>>>
22 >>>>>>>> +<section>
23 >>>>>>>> +<title>Test Dependencies</title>
24 >>>>>>>> +<body>
25 >>>>>>>> +
26 >>>>>>>> +<p>
27 >>>>>>>> +Packages often have optional dependencies that are needed only when running
28 >>>>>>>> +tests. These should be specified in DEPEND behind a USE flag. Often, the
29 >>>>>>>> +'test' USE flag is used for this purpose.
30 >>>>>>>> +</p>
31 >>>>>>>> +
32 >>>>>>>> +<p>
33 >>>>>>>> +Since testing will likely fail when test dependencies are not installed, the
34 >>>>>>>> +test phase should be disabled in this case. This may be accomplished via USE
35 >>>>>>>> +conditionals in the RESTRICT variable.
36 >>>>>>>> +</p>
37 >>>>>>>> +
38 >>>>>>>> +<p>
39 >>>>>>>> +If other optional features must be enabled/disabled when testing, REQUIRED_USE
40 >>>>>>>> +may be set to express this.
41 >>>>>>>> +</p>
42 >>>>>>>> +
43 >>>>>>>> +<codesample lang="ebuild">
44 >>>>>>>> +# Define some USE flags
45 >>>>>>>> +IUSE="debug test"
46 >>>>>>>> +
47 >>>>>>>> +# Disable test phase when test USE flag is disabled
48 >>>>>>>> +RESTRICT="!test? ( test )"
49 >>>>>>>
50 >>>>>>> I do not understand why we need this useless code. If test USE flag
51 >>>>>>> is disabled, tests must be disabled as well. It is PM's job and
52 >>>>>>> there is no need to put this obvious stuff into each ebuild with
53 >>>>>>> tests and extra deps. I see no reason to support running src_test()
54 >>>>>>> with USE="-test".
55 >>>>>>
56 >>>>>> PMS does not specify that behavior (skipping src_test with USE=-test).
57 >>>>>> It is better to define the requrement explicitly rather than relying
58 >>>>>> on a Portage-specific behavior.
59 >>>>>
60 >>>>> Then PMS should be fixed. Putting useless code in thousands
61 >>>>> of ebuilds due to bureaucratic reasons is ridiculous. Having strict
62 >>>>> conformance to the PMS is good, but common sense should still be
63 >>>>> considered.
64 >>>>
65 >>>> Since PMS doesn't specify the behavior of FEATURES, I suppose we could
66 >>>> make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
67 >>>> drawbacks to that?
68 >>>
69 >>> Except for Portage once again silently letting developers pass with non-
70 >>> PMS behavior, and making other PMs fail with the ebuilds?
71 >>
72 >> Is it really sane for other PMs to behave that way though?
73 >>
74 >> In PMS it says src_test "may be disabled by user too, using a
75 >> PM-specific mechanism", which doesn't explicitly rule out behavior based
76 >> on USE settings.
77 >
78 > It doesn't rule out disabling based on the phase of the moon either, or
79 > my mood which is degrading badly with this discussion.
80
81 Well, using package.use for this doesn't really make sense within the
82 context of ebuilds that don't have IUSE=test, which is an argument for
83 people to use package.env as a consistent means to selectively disable
84 unit tests.
85 --
86 Thanks,
87 Zac

Attachments

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

Replies