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

Attachments

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

Replies